Skip to content

Latest commit

 

History

History
136 lines (107 loc) · 4.32 KB

README.textile

File metadata and controls

136 lines (107 loc) · 4.32 KB

Description

Want Capistrano to talk to God? Find San Juan

Requirements

Install


gem install jnewland-san_juan
OR
gem install jnewland-san_juan -s http://gems.github.com

Usage

In your Capistrano deploy recipie:


require 'san_juan'

role :app, 'foo.example.com'
role :web, 'bar.example.com'

san_juan.role :app, %w(mongrels memcached)
san_juan.role :web, %w(nginx)

Now, check out cap -T:


  ...
  cap god:all:quit                                   # Quit god, but not the proce...
  cap god:all:reload                                 # Reloading God Config
  cap god:all:start                                  # Start god
  cap god:all:start_interactive                      # Start god interactively
  cap god:all:status                                 # Describe the status of the ...
  cap god:all:terminate                              # Terminate god and all monit...
  cap god:app:mongrels:log                           # Log mongrels
  cap god:app:mongrels:remove                        # Remove mongrels
  cap god:app:mongrels:restart                       # Restart mongrels
  cap god:app:mongrels:start                         # Start mongrels
  cap god:app:mongrels:stop                          # Stop mongrels
  cap god:app:mongrels:unmonitor                     # Unmonitor mongrels
  cap god:app:memcached:log                          # Log memcached
  cap god:app:memcached:remove                       # Remove memcached
  cap god:app:memcached:restart                      # Restart memcached
  cap god:app:memcached:start                        # Start memcached
  cap god:app:memcached:stop                         # Stop memcached
  cap god:app:memcached:unmonitor                    # Unmonitor memcached
  cap god:app:quit                                   # Quit god, but not the proce...
  cap god:app:reload                                 # Reload the god config file
  cap god:app:start                                  # Start god
  cap god:app:start_interactive                      # Start god interactively
  cap god:app:terminate                              # Terminate god and all monit...
  cap god:web:nginx:log                              # Log nginx
  cap god:web:nginx:remove                           # Remove nginx
  cap god:web:nginx:restart                          # Restart nginx
  cap god:web:nginx:start                            # Start nginx
  cap god:web:nginx:stop                             # Stop nginx
  cap god:web:nginx:unmonitor                        # Unmonitor nginx
  cap god:web:quit                                   # Quit god, but not the proce...
  cap god:web:reload                                 # Reload the god config file
  cap god:web:start                                  # Start god
  cap god:web:start_interactive                      # Start god interactively
  cap god:web:terminate                              # Terminate god and all monit...
  ...

To make capistrano start, stop, and restart your app using God, override the
deploy:start, deploy:stop, and deploy:restart tasks:


namespace :deploy do
  desc "Use god to restart the app"
  task :restart do
    god.all.reload #ensures any changes to the god config are applied at deploy
    god.app.mongrels.restart
    # god.web.nginx.restart
    # ...
  end

  desc "Use god to start the app"
  task :start do
    god.all.start
  end

  desc "Use god to stop the app"
  task :stop do
    god.all.terminate
  end
end

Tweaks

A few of the tasks in the god:all namespace require the path to your god
configuration file. This defaults to:

"#{current_path}/config/god/#{role}.god"

This can be changed by setting the god_config_path capistrano variable:


require 'san_juan'

set :god_config_path, "/path/to/config"

role :app, 'foo.example.com'
role :web, 'bar.example.com'

san_juan.role :app, %w(mongrels memcached)
san_juan.role :web, %w(nginx)


Author

Jesse Newland

License

WTFPL