DEV Community

Ryan Wang
Ryan Wang

Posted on

Lessons Learned @ MLH Fellowship - Production Engineering Track

Background

As a University student with only a barebones understanding of fullstack development, I've always relied on managed platforms like vercel or netlify to help deploy my projects. And while I've always been curious as to how CI/CD works, the opportunity to learn never really presented itself. At least, not until recently. 7 weeks ago, I started my journey in this summer's cohort in the Production Engineering track @ MLH and I've learned so much since then.

Big thanks to DigitalOcean and MLH for the VPS!

Manual Deployment

For the first time ever, I got to deploy a web application on my own server! MLH provided all of us in the program with a VPS to deploy a web application (built using flask), which I helped build in the first week of the program.
In order to do so I was tasked with:

  • Run and detach the web server through tmux.
  • Register the VPS IP @ duckdns

But deploying our site this way had some clear issues. If the flask app crashed, there was no fallback to restart the service. If the VPS rebooted, there would be no way to get the service up and running automatically.

Apparently Systemd is a redhat product

Bash Scripting and Systemd

To solve this issue, I got to learn about using bash scripting and systemd to automate the deployment of the site. While I find bash syntax absolutely abhorrent, its made redeploying the site after making changes/outages incredibly easy. Learning how to write and deploy systemd unit files gave the ability to integrate site deployment directly into systemd giving the ability to automatically restart deployment on server reboots.

Really like the whale iconography

Dockerize everything

But directly running things on bare metal isn't super scalable or reproduce-able. So of course the next logical step was to learn and use docker. Around this time a database was added for the website and NGINX added as a reverse proxy. Dockerizing all these services allows for each program to work in isolation making it easy to look at logs and create a reproduce-able environment. NGINX is also especially fascinating, easily allowing for things like API rate limiting (which I've never managed to implement before).

Final Thoughts

My time so far in the MLH Fellowship program has been amazing so far, learning things about the cool open source technology that drives the infrastructure around us. It's really changed the way I think about deploying applications and I'm definitely going to use what I've learned so far on future projects.

Top comments (0)