Capistrano::DockerCloud

Docker cloud specific tasks for Capistrano v3:

  • cap docker_cloud:deploy

TODO

  • [ ] Add a docker_cloud:rollback task #1
  • [ ] Add a task for A/B testing #2
  • [ ] Add a task to delete old Docker image tags #3
  • [ ] Add more options to be configured on the Capistrano deploy.rb file

Installation

Add this line to your application's Gemfile:

group :development do
  gem 'capistrano', '~> 3.1'
  gem 'capistrano-docker-cloud'
end

Run the following command to install the gems:

bundle install

Then run the generator to create a basic set of configuration files:

bundle exec cap install

Usage

# Capfile
require 'capistrano/docker-cloud'

Please note that any requires should be placed in Capfile, not in config/deploy.rb.

You can tweak some Docker Cloud's specific options in config/deploy.rb:

# Docker image name to deploy
set :docker_image, 'me/my-image'

# Docker Cloud credentials
set :docker_cloud_credentials, {
    username: 'username',
    api_key: 'my-api-key'
  }

Debugging

RestClient

Under the hood, this Capistrano gem is using Docker cloud which is using the RestClient gem.

You can see all the RestClient requests setting the RESTCLIENT_LOG environment variable like the following:

$ cap staging docker_cloud:deploy RESTCLIENT_LOG=stdout

Capistrano tasks

Of course you can also pass --trace in order to reveal the backtrace in case of an error:

$ cap staging docker_cloud:deploy --trace

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request