No commit activity in last 3 years
No release in over 3 years
AWS OpsWorks deployment with capistrano
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

>= 0
 Project Readme

Capistrano::OpsWorks

A gem to help deploy rails applications to AWS OpsWorks, which hopefully works with capistrano 3

Installation

Add this line to your application's Gemfile:

gem 'capistrano-ops_works'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-ops_works

Usage

If you haven't installed Capistrano, do that and make sure you

$ bundle exec cap install

Require the gem in your Capfile (example taken from default generated Capfile)

###########
# Capfile #
###########

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'

require 'capistrano/ops_works'

# Includes tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
#   https://github.com/capistrano/rvm
#   https://github.com/capistrano/rbenv
#   https://github.com/capistrano/chruby
#   https://github.com/capistrano/bundler
#   https://github.com/capistrano/rails/tree/master/assets
#   https://github.com/capistrano/rails/tree/master/migrations
#
# require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
# require 'capistrano/bundler'
# require 'capistrano/rails/assets'
# require 'capistrano/rails/migrations'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

In the appropriate stage deploy file, add your OpsWorks details

#############################
# /config/deploy/staging.rb #
#############################

set :stage, :staging

set :access_key_id, '<aws_access_key_id>'
set :secret_access_key, '<aws_secret_access_key>'
set :stack_id, '<opsworks_stack_id>'
set :app_id, '<opsworks_app_id>'
set :opsworks_custom_json, '<opsworks_custom_json>'

Check the task list using

$ bundle exec cap -T

Check your app_id

$ bundle exec cap staging opsworks:check

Deploy your app (you'll get a deployment_id back if it worked)

$ bundle exec cap staging opsworks
$ bundle exec cap staging opsworks:migrate

Check the history of your app deployments

$ bundle exec cap staging opsworks:history

FAQ

  1. Why is the name so ugly?
  1. Why are the task names namespaced with opsworks instead of ops_works?
  • to make it less ugly, and easier to type

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