/ DevOps

My Private Continuous Integration Platform

2/9/17 Edit: Drone has deprecated their hosted version and is still available on GitHub and DigitalOcean.

DevOps is changing at an impressive speed, and the movement is now being influenced by a sea of vendors and conferences all designed to champion DevOps. For many companies embracing DevOps practices, 2015 was a year that extended DevOps to areas of the software delivery lifecycle previously untouched by the DevOps movement.

Automating the deployment of often stateless web applications on either containers or virtual machines is now something that organizations embracing DevOps take for granted, yet there is still a large component of the market that has yet to fully embrace automation and cloud based infrastructure.

Companies new to DevOps are facing interesting questions only made possible by the popularity of the DevOps movement. Questions such as “Which cloud provider to use?” or “Which private cloud technology to adopt?” are answered alongside questions about development platforms, operating systems, and (with containers) the definition of a deployable application.

Containerization plays an important role in DevOps as it moves responsibility for deployment and configuration management toward application developers. Using Docker or Quay coupled with continuous integration and delivery servers has provided a level of automation that can take all of the frustrations out of frequent code deployments.

Enter 2016, and I've just completed a project that combines continuous integration and delivery with a platform that builds applications on a fresh Docker container, caches dependencies (just like Heroku) and outputs the source code to app-name.stackriot.com.

I've spent a lot of time working with virtualization, Docker and automation recently. One of the biggest challenges has been to get a good testing environment internally, without having to pay exorbitant amounts of money to use services like Heroku. I knew there had to be a better, more affordable alternative, and I was determined to find it.

I've used just about all of the CI services available, including Jenkins, Circle CI, Codeship and Travis. I learned that each of these services has their own quirks. For example: hard to install dependencies, Selenium tests, required infrastructure services, build limits, etc. This is why I have grown to love Drone. I can run my test suite in a clean docker image every time, cache dependencies (just like Heroku does), and run a deploy action if the test build succeeds.

I am using Drone for the continuous integration, and Dokku for the PaaS. Drone is built using Go and utilizes Docker. It can be run inside a container itself with very little configuration.

Drone is a Continuous Integration platform built on container technology. Every build is executed inside an ephemeral Docker container, giving me complete control over my build environment with guaranteed isolation.

Drone's integration with Docker means it can support a huge number of languages including PHP, Node, Ruby, Go, and Python, to name a few. Each test will spawn a new container based off of specified images from the Docker Public Registry. You can even make your own to fit your specific application if needed.

Drone also supports various notification mechanisms, including Email, IMs, Gitter and Slack. It also has support for a host of linked services including PostgreSQL, MySQL, MongoDB and Redis. Drone is written in Go, so writing your own service is super easy if necessary.

To make this project even sweeter, I've coupled Drone with Dokku, a simple Heroku like PaaS built on top of Docker. Using the Github flow with this setup allows automatic staging of all feature branches that pass their tests.

With one simple command:
git push dokku master(assuming I'm pushing changes to the master branch), as long as my build passes in Drone, the code is deployed in a fresh Docker container. Dokku builds the app on a subdomain of the Dokku host, and it's automatically available at app-name.stackriot.com.

Dokku is a mini-Heroku powered by Docker written in less than 100 lines of Bash. Once it's set up on a host, you can push Heroku-compatible applications to it via Git. They'll build using Heroku buildpacks and then run in isolated containers. The end result is a privately hosted continuous integration platform. It's got all of Heroku's awesome features, and I don't have to pay a premium to use their service.


You can out some of my projects by clicking here.

Seth Bergman

Seth Bergman

I'm a Software Engineer focused on helping companies scale. I love learning about software architecture, containers, open source programming and automation.

Read More