-
- Supercontest docker work.
- Only the db image reads the postgres config information in docker-compose. Instead of passing it via env variables to the flask image so that it can connect to the db as well, the flask image directly reads the config files. This means that the app can be started without docker, in the usual ways I’m used to (runserver, etc).
- Started testing the full system with docker-compose up.
- docker system prune -af
- If containers ever can’t be stopped even with -f (due to apparmor, or other), run
- sudo killall docker-containerd-shim
- docker-compose down
- Successfully got `docker-compose up –build -d` to work. Just need to debug the actual application now.
- To open a shell in the nginx container: docker exec -it nginx /bin/bash
- Most base images on the official docker registry will pipe their main logs to stdout/stderr, so you can simply view them with `docker logs <containername>`.
- For example, /var/log/nginx/access.log -> /dev/stdout, so you can do `docker logs nginx`
- Eventually ran `sudo systemctl stop apparmor && sudo systemctl disable apparmor` so I didn’t have to deal with the container removal errors anymore.
- Backed up the existing db just in case
- pg_dumpall -l supercontest > backups/dump.sql
- Stopped postgres on my host machine so the container could use the default port (5432).
- sudo service postgresql stop
- sudo update-rc.d postgresql disable
- Stopped nginx on my host machine so the container could use the default port (80).
- sudo servicectl stop nginx
- sudo servicectl disable nginx
- Added a postgres Dockerfile instead of just relying on the docker-compose yaml. Copied my dump to the /docker-entrypoint-initdbd/ folder so the existing database gets create when the container starts.
- To open psql in the container, just run `docker exec -it postgres psql`
- To perform a dev cycle, you can’t just modify the code locally then rerun `docker-compose up –build -d`. It does use a cache, but because the container has already been created, and files have already been copied, it doesn’t think it needs to do anything. What you really need to do is mount the source directory (if you’re copying the whole over). If you’re building a python package, just copying that over is fine.
- Resolvconf. To make the nameserver changes permanent (they get overwritten by the system).
- sudo apt install resolvconf
- sudo mkdir /etc/resolvconf/resolv.conf.d
- sudo vim /etc/resolvconf/resolv.conf.d/base
- nameserver 8.8.8.8
- nameserver 8.8.4.4
- sudo resolvconf -u
- netstat -na | grep <port_number>
- 8.8.8.8 and 8.8.4.4 are Google’s public DNS servers (for IPv4).
- Remember, websockets are a protocol wrapped around tcp. They’re very similar to http. Regular sockets are more generic, they’re just tcp (usually).
-
- Ryan Cabrera and O-Town performed at Saint Rocke last night, the bar literally 2 blocks up from my house, so a bunch of us went.
- Purchase offer. Created a few sheets and read lots of info on the details.
- I’ve found no great solutions for streaming from ubuntu to roku.
- Supercontest docker work.
- Added nameserver 8.8.8.8 and 8.8.4.4. to /etc/resolv.conf again.
- sudo docker run -it python:2.7 /bin/bash
- This command fetches the container (remotely, at first), then shells into it and enters a bash prompt.
- Made it so I don’t have to type sudo every time. Just add yourself to the docker group.
- sudo gpasswd -a $USER docker
- newgrp docker # refreshes this login within your current shell
- Basically got all three containers and supporting files into a good place. Did test builds of a few dev images. Just need to test the actual application in container space now.
-
- Supercontest
- Postgres (#19)
- Changed the postgres ‘supercontest’ user’s password to match the mail password, all inject into the app.config at the same time during initialization.
- In PyCharm’s db navigator, my actual tables are under schemas -> public -> tables.
- Ahhhhhhhhhh. It did migrate my users properly. I was selecting the literal user table from postgres, which just had me. `select * from public.user` shows all 42 supercontest users. “public” is the schema which you have to run the query against.
- The leaderboard view works again. The select has to match the group_by in postgres. Postgres also has `DISTINCT ON`, which is useful.
- Fixed the week ordering issue. Just had to add .order_by(Matchup.week) to a couple queries. It looks like distinct() is what does the reordering. group_by() and all() and filter() didn’t affect any of the existing order of the returns.
- Created a new alembic version, even though there had been no changes in the model yet. Alembic seemed to persist through the underlying sqlite->postgres migration without any issue. This makes sense, since it transacts with the db and manages it purely with SQL, independent of the DB implementation, but I’m still surprised that there were no gotchas here. Maybe there will be. I’m still suspicious.
- Alembic correctly autodetected the implementation context. It has a PostgresqlImpl class.
- Postgres has the notion of “sequences” which are commonly used as the primary key IDs for tables. You have to be explicit about this by defining SQLAlchemy().Sequence() in the schema (next to integer and primary key).
- PRed and merged the postgres branch after testing locally. Did not push to production server. I will wait until I implement the db container (next) to make that a bit easier to handle (revert/change).
- Docker
- sudo apt install docker.io docker-compose
- HN. Ya, common mispractices in hiring: http://tonsky.me/blog/hiring/.
- You can actually run linux containers on a windows host (but not vice versa) because newer windows machines ship with a base image of ubuntu in addition to the windows os.
- Enabled “Career Interests” on LinkedIn which lets recruiters know that I’m looking. Also provided my information to gain access to salary insights.
- Remember the command to compare your current branch to master: `git diff origin/master…`
-
- Was able to get the facial verification process started for Binance. Should receive an email within a few days, then I can link my Binance account to cointracker, export a csv with all transactions, attach it to turbotax, file taxes, and delete the binance app from my phone.
- Nice, actually got verification later today. Added an API key for cointracker to my binance account, so I should have full tax info now.
- In order to get the forms necessary to input to turbotax, you have to buy the cointracker tax plan. This is bullshit. It’s $49. I did it for convenience, but that’s an insane fee.
- Total capital loss was about $6.2k. The max you can claim in a single tax year is 3k, so this will last me two years (2019’s is called a capital loss carryover).
- Final submission of taxes!
- Another new thing: royalty distribution from my mesabi trust cbi shares. Reported on 1099-MISC, had to claim on Schedule E. Was only $42.
- Changed my medium digest back to daily. I just skim over the weekly and never look at anything. The daily would spark something cool every morning.
- My confluence space at SpaceX is actually saved. The user account is inactive, but all of the content is preserved: blog, pages, comments, everything.
- PW
- New versions of pycharm and django.
- Remember, Selenium can do more than just load dynamic content (js) into the dom for you. It can simulate the clicking of buttons, text input, scrolling, downloading, changing cookies, etc.
- sh returns 127 when it can’t find the executable on path.
- systemctl communicates with systemd over dbus.
- Great collection of flask+nginx dockerfiles: https://github.com/tiangolo/uwsgi-nginx-flask-docker.
- Bottled this kombucha brew for second fermentation, finally. Used apple cider. The final brew time was 6 weeks, about 3x as long as usual. The cultures were super old and took forever, but the pH is ~2.5 and it’s slightly tart. I added a little extra apple juice to bring the sweetness back up. Second fermentation should go in the fridge on Monday afternoon, 4 days is fine.
- Supercontest.
- Docker caches previous build results so you can step through a dockerfile as you develop on it.
- Read a lot about docker-compose and the final config of server/app/db in 3 separate containers. Gonna upgrade to postgres and python 3 first, then come back to that. Then enable backups.
- Changed the password for the southbaysupercontest@gmail.com account. It was getting correct-password attempts from elsewhere. It’s now stored in my personal Google account.
- You can migrate a database to another type. Often, it means “dumping” the current db into a single file of pure SQL commands, which most databases’ CLI allows you to do. Then you can import it into another database.
- This is also how backups often work. You just recreate the db from a dumped file.
- There are tools to perform this migration for you. pgloader is the main one to convert into Postgres, which is what I used to migrate the Supercontest db from sqlite.
- Upgraded to postgres (#19). Didn’t finish, but got quite far.
- sudo apt install postgresql postgresql-contrib postgresql-client postgresql-client-common libpq-dev pgloader
- pip install psycopg2 (inside the sc venv)
- Added `export PGDATABASE=supercontest` to ~/.bashrc so that psql would by default connect to supercontest. To ingest, restart bash by simply typing bash.
- sudo -u postgres createuser –username=supercontest –superuser –pwprompt # run the command as the postgres user to create the auth that the app uses
- sudo -u postgres createdb supercontest # create the new db. dropdb is opposite
- pgloader ./data/supercontest.db postgresql:///supercontest
- Helpful commands inside psql:
- c <> # connect to that database
- l # list all available databases
- q # exits this shell
- conninfo shows data
- show data_directory; # lists where the db is actually stored
- select * from <>;
-
- To turn your stock into gravy, just add flour (about as much as the fat layer on top), whisk until smooth, then bring to a boil, then turn off. Did this with the chicken stock from yesterday. Turned out delicious.
- Didn’t add any fat, there’s enough in the poultry remains.
- This is effectively just smoked carcass, water, and flour (+ any vegetables/spices you add to make the stock).
- The bones yield more marrow and flavor once cooked, plus you get some smokiness.
- Don’t wash raw chicken. The water splash can carry bacteria a few feet, all over surfaces and utensils and you!
- Taxes/crypto
- Coinbase account recovery completed, so I was able to get that transaction history.
- Started the account recovery process for Binance, because I still need those transactions.
- Created an account with cointracker.io. Linked Coinbase and Coinbase Pro (formerly Gdax). Once I get access to my Binance account again, I can link it to get the final numbers.
- Watched Wayne’s World for the first time. I don’t get it. The movie was terrible.
- Some of my favorite bands are all British: Beatles, Zeppelin, Queen, Pink Floyd, Rolling Stones, Elton John, Coldplay, David Bowie, Iron Maiden, The Who, Black Sabbath, Oasis!
- Reactivated amazon fresh.
- 8 organic vine tomatoes, 2 organic banana bunches, 8 heads of organic kale, 1lb greek yogurt, 1 jar peanut butter.
- $44 at Vons, $38 on Fresh.
- This is one week, so 4 orders per month. Fresh costs $15/month, so add $4 to each order. Still cheaper.
- And I don’t have to ride the motorcycle to the store. Will order next week!
-
- Medi-Cal can take up to 45 days to respond to the application (which they accept year-round). Check digital and regular mail. If accepted, they cover medical bills up to 3 months before the application was received, so even though I applied before April, if they don’t respond for another month, I can get retro coverage.
- Smoked chicken halves! Amazing.
- Also made chicken stock. Next time I want to try it with the smoked carcass in addition to the neck/backbone/giblets/wingtips.
- Remember, the full wing is drummette -> wingette -> wingtip. The wingette is the stereotypical chicken wing, like you’d receive at Buffalo Wild Wings.
- Aleksandr Karelin is the greatest wrestler of all time.
- Jeremy asked about backfilling previous seasons. I showed the script that does it autonomously. If Petty has old spreadsheets, and I add a “season” dropdown or year capability, this wouldn’t be too hard.
- Called Spectrum to cancel our plan (now out of promotion) so that we get new promotion for half the price (back down to ~$45 for 100MB). Of course you can’t do it online. The operator was nice. The service will cancel at the end of the cycle I already paid for, Apr 17th. Briley will pick up the next one.
-
- Paid rent. Next month it raises to 1100 (each).
- Taxes. Took about 3 hours. The usual W2, 1099-DIV/INT/MISC, VLF for motorcycle registration credits (3). No clothing donations this year. Had a 1099-B due to a merger that forced a sale of some shares (cap gains). Also crypto losses. Learned that you don’t have to pay taxes on ESPP shares until they’re sold.
- Did a ton of bbq research.
- Use the charcoal basket for better airflow. Load wood chunks into the bottom first, then charcoal, then light on top. Add pellets later for extra.
- Use a blower to get higher temps. This makes each charcoal load last a lot longer as well. Ordered one of these.
- Made the supercontest app public again.
- Looked up residential solar options. They’re a few thousand up front, but give you (annual) tax breaks and reduce utilities (obviously).
- Researched different home automation technologies.
- Bought birthday presents for Eric and Dad.
- $80 Urthbox (3mo + 1 box free) subscription.
- $80 Philips home hub + 1 multicolor bulb.
- Interestingly enough, because of California’s higher efficiency/green standards, lightbulbs are more expensive to buy on Amazon when shipping to a CA address.
- Messaged Kelsey/Jess/Derek on LinkedIn to hear their comparisons between SpaceX and Netflix.
- Remember, systemctl enable <service> means that the service will start on boot.
- If there are specific commands you want a specific user (e.g. you) to be able to run without having to type sudo every time, you can add that to the sudoers file or add yourself to that command’s group (if it’s configured that way).
- “Tweaks” is the name of the ubuntu package which extends settings. I disabled workspaces.
- Docker refreshers.
- By default, docker only shows currently-running info (container ls, etc). To check all (including history), use -a.
- Base images are like `ubuntu` or busybox. Literally just that. With my Dockerfile, I create a child image (from that) which runs additional commands and installations and stuff that customize the image for supercontest hosting.
- Different containers for database, app, etc. Docker compose pulls all these together in a multi-container app.
- Docker build is takes your Dockerfile and creates an image from it. Then you can run that local image.
- `docker container prune`
- Started working on #27 for the supercontest, dockerizing deployment.
- Just like at SpaceX, dns resolution was a pain with Docker. Ended up with the same solution, adding `nameserver 8.8.8.8` and 8.8.4.4 in /etc/resolv.conf.