capistrano + chef-solo == deployment + server automation
Using chef’s JSON configuration format to drive capistrano and chef-solo so you can use both to not only deploy your application but also completely automate the configuration of your servers.
Add chef_cap to your Gemfile
gem 'chef_cap'
Then run:
$ bundle install
$ rails generate chef_cap:install
Edit your Rakefile and add:
require 'chef_cap/tasks'
Then run:
$ bundle exec rake chef_cap:install
Which will overwrite your Capfile and create a chef directory with sample files unless one already exists.
Remove all chef-cap files from /tmp
$ cap <environment> chef:cleanup
Run chef-solo on the server(s)
$ cap <environment> chef:deploy
Setup chef solo on the server(s)
$ cap <environment> chef:setup
Run chef without deploy
$ cap <environment> cook
Deploy a particular Git branch, tag, or revision (overriding the default)
$ cap <environment> deploy BRANCH=my_branch $ cap <environment> deploy TAG=my_tag $ cap <environment> deploy REVISION=abc1234
The following JSON keys are required in your node.json file:
{ "application": { "name": NAME } } { "application": { "repository": REPOSITORY } } { "environments": { ENVIRONMENT: { "rails_env": RAILS_ENV } } } { "roles": { ROLE: { "run_list": [] } } } { "run_list": [] }
Optional JSON keys:
{ "environments": { ENVIRONMENT: { "role_order": { FIRST_ROLE: [OTHER_ROLES] } } } } { "environments": { ENVIRONMENT: { "environment_settings": ENV_HASH } } } { "rollback_run_list": [] } { "deploy_recipe": "[some_cookbook]::[some_recipe]" }
You can set which ruby version switcher to use. RVM is the default. ruby_version can be set as well.
{ "environments": { ENVIRONMENT: { "ruby_version_switcher": "rvm", "ruby_version": "1.9.3-p125" } } }
-
Capistrano 2.x
MIT
Chef and chef-solo are © 2010 Opscode (www.opscode.com/)