Dev Blog: Using Docker for Continuous Deployment
Hey there! It’s Antonio again.
When working on a hackathon you learn that things change, and when they do change, they change really really fast. Sometimes it’s hard to keep up with everything that needs to be handled and tweaked usually resulting in things getting lost in the fold.
It’s hard to make everyone happy when it comes time to release the next great thing, but we can do our best to make the experience as easy as possible. We open our doors to anyone that wants to contribute to our project, but we don’t want them to have to learn so much about things that they don’t have to deal with, especially when it comes to iterating through development environments or deploying code to production.
At MHacks we wanted to tackle this issue for the hacker generations to come. We wanted to make the experience of working on code in development to running that same code in production be as seamless as possible and not require a huge learning curve to get all of the right development tools to get started. For this, we settled on Docker.
Fast Deployment
Docker as described on the project’s website is an “open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud”, which is more or less exactly what we needed for the job. We wanted a stack that a developer could deploy in less than 10 steps on a new machine and didn’t require the installation of any local development tools (other than Docker of course). All you have to do is run one command, and you have everything you need to get started.
Continuous Deployment
For these same reasons, Docker was perfect for our production environments. We’re able to continuously develop and deploy code without ever having to login to the server. Using Docker Compose, we have automatic workflows built into our application that run any time a PR is merged into master to get the latest code out there for us to test. When we think that the code is stable enough to jump into production, we issue one slack command to finish the deployment. If something goes wrong, we can get damage reports (also through slack) and run self-healing operations to fix whatever broke.
Seamless Deployment
Docker has made it quick and easy to release code frequently in fresh environments. Using webpack also makes it sometimes a tedious process to wait for builds to complete before releasing code and before used to cause us problems with the site not being accessible during the build process. Now with the help of Docker and NGINX, we’re able to hot-swap containers when the build is complete and the server is ready, truly allowing for zero-downtime, seamless deployments.
As always, all of our code is open source and supported by the efforts of the amazing students behind MHacks. The new hackathon management software that we’ve been working on is currently bundled into our new MHacks website, but can easily be extracted from it. I’m more than happy to aid in that and support you in whatever your hackathon may need, we love to share! Feel free to drop me a line at me@antoniomika.me or at antoniomika on FreeNode IRC.
Cheers,
- Antonio
Want more MHacks goodness? Check out our last post: What We Learned: Hacker Office Hours
Questions? Comments? Concerns? Compliments (we like these!)? Shoot us an email (hackathon@umich.edu), message us on Facebook, DM us on Twitter, or tag us on Instagram!