This past weekend, I took part in the DockerCon Hackathon with teammates Sid & Nikhil . It was an incredibly rewarding experience and worthy of my first post to the EC blog.
How it works
There were 17 teams of 1-3 people. We had 24 hours to create something showcasing Docker after which we would present our projects. Entries were judged based on novelty, fit, efficiency, integration, transparency, presentation, and utility. The top 3 teams received free passes to DockerCon and the opportunity to present their work at the conference. Spoiler alert: Team CloudBees snagged one of the winning spots!
What we built
Orchestration is important to Docker as they strive to become an essential piece of the continuous delivery puzzle. So, using our enterprise-class orchestration engine ElectricCommander was a no-brainer. We decided to go for an end-to-end story taking a sample web application from commit to production. We tied together the popular developer tools GitHub, Jenkins, and ReviewBoard. And of course we took advantage of the speed and portability of Docker. The solution consisted of two pipelines: one pre-commit and one post-commit.
A developer launches a "preflight" pipeline to test their changes in isolation. Their modifications are uploaded to the EC server which then overlays them on top of a clean source tree to simulate their commit. After that, the application is built & unit tested via Jenkins, deployed to a new Docker container in the DEV environment, and a code review request is created in ReviewBoard. The reviewer has a chance to view the running application along with the code changes. If the request is approved, the developer's changes are automatically committed.
Via its continuous integration engine, EC detects a new commit to the GitHub repo and launches a "production" pipeline. This pipeline builds the latest code, deploys it to the QA environment, and waits for manual testing. If the QA team accepts the build, it is automatically pushed to PROD.
Pushing to PROD with zero-downtime was a fun challenge. Two Docker containers sit behind a reverse proxy setup to enable a blue-green production environment. If the blue container is active, EC starts a new container to serve as the green container, and vice versa. A third container runs etcd which knows about the active container, confd monitors etcd for changes and notifies nginx if there is a change, and nginx reloads and points to the new container without dropping connections. This post was a fantastic reference for the reverse proxy setup.
Presentation and judging
Each team had 3 minutes to present and everyone used Docker in a unique but innovative way. We scored well in the "fit" and "transparency" categories and topped the field for "integration", ending up with the 3rd-highest score and opportunity to present at DockerCon! The various pieces of our project are published at https://github.com/electriccommunity/dockercon .
Hackathons are fun!
I'd never participated in a hackathon before and I haven't coded full-time in a couple of years. But I was lucky to be working with Nikhil & Sid who had in fact won their last two. The Docker team put on a great event -- several employees were around to answer our questions, and they kept us well fed and caffeinated :)
Stay up to date
We'll never share your email address and you can opt out at any time, we promise.