Let’s Build A Web App! Week 29 of my 30 week web dev journey

Rona Chong
6 min readFeb 19, 2018

--

In which I deployed to prod and fixed a few issues with my deployment.

Previous posts in this series:

(Might have lost proper count here)

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:

  1. updating a record to elastic load balancers for prod
  2. checking nginx logic
  3. adding prod endpoint-setting logic in reactql config => new frontend build, push and deploy
  4. updating prod config for backend=> new backend build, push and deploy
  5. adding prod manager to ansible hosts
  6. 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:

  1. run apache on task mapped to port 80
  2. check response
  3. add prod managers to hosts
  4. provision prod hosts
  5. sync compose file over to prod manager
  6. push secrets
  7. verify that the load balancer domain works
  8. open up ports if necessary [skipped, unnecessary]
  9. set up cname
  10. check nginx logic
  11. check and fix why compose push pushes stage compose file instead of prod compose
  12. create endpoint logic in reactql config => new frontend build, push and deploy
  13. fix a bug in the setting of some boolean values for my reactql app => new frontend build, push and deploy
  14. recreate rds instance, but this time on prod vpc instead of stage
  15. modify push secrets role to push different folders per destination env
  16. update prod version of Django config for backend => new backend build, push and deploy
  17. take down stack and redeploy (Docker secrets are immutable)
  18. update migrations playbook to work with prod setup in addition to stage; and run successfully
  19. open up traffic to/from prod vpc for rds security group
  20. 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
  21. 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:

--

--