Jesse Dearing changelog.com/posts

Centurion makes deploying Docker images easy

New Relic has Open Sourced their tool for managing Docker deployments across multiple environments.

Centurion is a DSL for defining environment variables, Docker hosts to deploy to, volumes, and ports. Centurion can be used to define these on a per environment basis, ensuring the same image is shipped with the correct configuration for the environment it is being deployed to.

Centurion can even handle rolling deploys by deploying to a host and checking a specific URL to become available before moving to the next host.

Here's an example of Centurion in action:

 namespace :environment do
  task :common do
    set :image, 'example.com/newrelic/radio-radio'
    host 'docker-server-1.example.com'
    host 'docker-server-2.example.com'
  end

  desc 'Staging environment'
  task :staging => :common do
    set_current_environment(:staging)
    env_vars YOUR_ENV: 'staging'
    env_vars MY_DB: 'radio-db.example.com'
    host_port 10234, container_port: 9292
    host_port 10235, container_port: 9293
    host_volume '/mnt/volume1', container_volume: '/mnt/volume2'
  end

  desc 'Production environment'
  task :production => :common do
    set_current_environment(:production)
    env_vars YOUR_ENV: 'production'
    env_vars MY_DB: 'radio-db-prod.example.com'
    host_port 22234, container_port: 9292
    host_port 23235, container_port: 9293
    command ['/bin/bash', '-c', '/path/to/server -e production']
  end
end

Docker was unveiled at DockerCon 2014 in the talk Docker Deployments: Powerful for Developers, Painless for Ops by Karl Matthais and Paul Showalter

Centurion is available as a Ruby gem and source is on Github.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00