Let’s Build A Web App! Week 29 of my 30 week web dev journey
In which I deployed to prod and fixed a few issues with my deployment.
Previous posts in this series:
- Let’s Build a Web App! A blog series by someone starting their web dev journey
- Let’s Build a Web App! Week 2 out of 30
- Let’s Build a Web App! Week 3 out of 30
- Let’s Build a Web App! Lo-fi Edition / Week 4 out of 30
- Let’s Build a Web App! Week 5 out of 30
- Let’s Build a Web App! Week 6 out of 30
- Let’s Build a Web App! Week 7 out of 30
- Let’s Build a Web App! Week 8 out of 30
- Let’s Build a Web App! Week 9 out of 30
- Let’s Build a Web App! Week 10 out of 30
- Let’s Build a Web App! Week 11 out of 30
- Let’s Build a Web App! Week 12 out of 30
- Let’s Build a Web App! Week 13 out of 30
- Let’s Build a Web App! Week 14 out of 30
- Let’s Build a Web App! Week 15 out of 30
- Let’s Build a Web App! Week 16 out of 30
(Might have lost proper count here)
- Let’s Build a Web App! Week 18 out of 30
- Let’s Build A Web App! Week 19 out of 30
- Let’s Build A Web App! Week 20 out of 30
- Let’s Build A Web App! Week 21–23 out 30
- Let’s Build A Web App! Week 24 out of 30
- Let’s Build A Web App! Week 25 out of 30
- Let’s Build A Web App! Week 26 out of 30
- Let’s Build A Web App! Week 27 out of 30
- Let’s Build A Web App! Week 28 out of 30
Now let’s get back to update on what I’ve been up to in the 29th week of this journey.
What did I set out to do?
I can almost repeat what I said last week word for word 😅:
“I’ve been working on deploying my app for a long long time now — my goal for this week was (again) to finish with that and restart my work on the reader module of moshimoji.xyz.”
Last week I more or less completed my deploy to stage, so that left the deploy to prod this week before I could do any dev on the reader module. Also — looking into/fixing the retrieval of static assets for misago (deploy related), and the funky render of my login modal (coding error probably).
I postulated the following tasks to deploy to prod:
- updating a record to elastic load balancers for prod
- checking nginx logic
- adding prod endpoint-setting logic in reactql config => new frontend build, push and deploy
- updating prod config for backend=> new backend build, push and deploy
- adding prod manager to ansible hosts
- pushing files like compose and secrets to prod swarm
On the reader side, I wanted to do the minimum to get to an “MVP” for that module — getting my React components to query first, my GraphQL backend for the assets to pull for a chapter of a series, and then, my Amazon CDN for those assets.
What did I get done?
Here’s what I ended up doing for my prod deploy:
- run apache on task mapped to port 80
- check response
- add prod managers to hosts
- provision prod hosts
- sync compose file over to prod manager
- push secrets
- verify that the load balancer domain works
- open up ports if necessary [skipped, unnecessary]
- set up cname
- check nginx logic
- check and fix why compose push pushes stage compose file instead of prod compose
- create endpoint logic in reactql config => new frontend build, push and deploy
- fix a bug in the setting of some boolean values for my reactql app => new frontend build, push and deploy
- recreate rds instance, but this time on prod vpc instead of stage
- modify push secrets role to push different folders per destination env
- update prod version of Django config for backend => new backend build, push and deploy
- take down stack and redeploy (Docker secrets are immutable)
- update migrations playbook to work with prod setup in addition to stage; and run successfully
- open up traffic to/from prod vpc for rds security group
- update my Django app to handle a bug with the value of an environmental var (STAGE — I haven’t figured out how to set it as an int instead of a string via my compose file) => new backend build, push and deploy
- update data syncing playbook to work with prod setup in addition to stage; sync data from dev to prod
That took me about 3 days of solid work, or 4 days of average work. With the exception of the issue with the static assets for Misago, I’m happy to say that I think I’m finished with setting up deployments to my stage and prod. If you check stage.moshimoji.xyz (for now; I should gate access in the future) and www.moshimoji.xyz, you’ll be able to see my site with the most recent codebase (and you’ll be able to see that I have a lot of development to do in my last 2ish weeks for the project 😅😅😅 but yeah I’m happy to focus on developing again after 2–3 months).
Since then I’ve just started looking into the issue with the render of my login modal, and made my commits for recent changes.
What didn’t I get done?
- looking into/fixing the retrieval of static assets for misago (deploy related)
- looking into/fixing the funky render of my login modal (coding error probably).
- the minimum to get to an “MVP” for that module — getting my React components to query first, my GraphQL backend for the assets to pull for a chapter of a series, and then, my Amazon CDN for those assets.
What went well?
- Making good progress when I worked
- Eventually getting myself back to work at least for a few hours on a day where I got off track for a bit
What was difficult?
- I had several bugs this week to do with the values of my STAGE booleans for my frontend and backend apps, and some places where I forgot to update values to a variable so that the deploy behavior didn’t default to what should happen for stage. Small mistakes but they take a little bit of time to debug and then fix (1–2 hours each?). I think writing tests would take more time, but I can’t help but think that if these mistakes were easy to make now, they could be the source of a lot of errors in the future. So it would be nice to be able to implement safeguards against those mistakes (but I don’t have time to do that at this point, I think..)
- On a related note, dealing with how I’ve managed my time for my project: Now that I’ve ‘completed’ deployment, I only have two weeks left for my project, and I feel that I have to prioritize making more headway in development over other issues. Besides a list of changes to make to improve the quality of my code, I accumulated a backlog of crucial things for security (which maybe I won’t specify here for the sake of… security 😅) to implement. And I may not get to any of them, unfortunately.
- You can’t see standard out from Ansible tasks in real time (only after the task completes), which makes it difficult to figure out why a build is taking a long time when it does and respond to an issue with the build handily (is it because of the image size? because of the internet connection? because you’ve run a Docker prune too aggressively?)
What would I do differently next time?
The biggest thing from this week that I would have changed is again how much I worked. I made good progress when I did work, but I still feel that I could have worked more hours. This involves being mindful in some cases: Sometimes I do everything to set things up for a productive day (get to school early, make a plan, etc.), but then I just procrastinate and it’s difficult to get back on track after that. :/
In other cases, I get to school early, but my time gets consumed by some other tasks like my big organizational overhead. So this coming week I plan on waking up early enough to get that stuff done at home before I get to school. That way I should have a larger chunk of time to work on my project.
One cool thing I learned about
- So long as your host is listed in an Ansible group in your inventory which has variables applied to that group, those variables will apply to that host in all runs of Ansible — even if you’re invoking a play on that host with another group or label than the group for which the variables are listed.
Misc links for your browsing pleasure:
- My twitter: https://twitter.com/ronachng
- My Github repo for kusamochi: https://github.com/ronachong/kusamochi/commits/master
- My Github repo for moshi-moji:
https://github.com/ronachong/moshi-moji - My Paper doc for documenting some travails and clearups during development:
https://paper.dropbox.com/doc/travailsvictory-log-in-dev-stuff-urw9F3oeUadSzjULXWYiM - My Paper doc for brainstorming/planning my web projects:
https://paper.dropbox.com/doc/different-ideas-mnesHVM2GY2Fwb05iN2fW - My Paper doc for logging my Google queries (obsessive, I know):
https://paper.dropbox.com/doc/resource-log-rOGTRd8hygvwJ4NCGglpm