Useful Capistrano recipes including:
-
Create MySQL database and user on server (via prompts)
-
Create standalone copy of database.yml in shared path (via prompts)
-
Log rotation and tailing commands
-
Restart and profile Phusion Passenger application server
-
Restart and profile Nginx application server
-
Configure, start/stop/restart Unicorn application server
-
Send commands to God or Bluepill monitoring tools
-
Send commands to Thinking Sphinx
Note: Read code for details on each task/option
-
cap bluepill:create_var_run
-
cap bluepill:init
-
cap bluepill:quit
-
cap bluepill:restart
-
cap bluepill:setup_config
-
cap bluepill:setup_init
-
cap bluepill:start
-
cap bluepill:status
-
cap bluepill:stop
-
cap db:create_yaml
-
cap db:mysql:dump
-
cap db:mysql:fetch_dump
-
cap db:mysql:restore
-
cap db:mysql:setup
-
cap deploy:configure
-
cap deploy:restart
-
cap deploy:seppuku
-
cap god:bootstrap
-
cap god:implode
-
cap god:log
-
cap god:quit
-
cap god:reload
-
cap god:restart
-
cap god:restart:app
-
cap god:setup
-
cap god:start
-
cap god:status
-
cap god:stop
-
cap god:terminate
-
cap log:rotate
-
cap log:tail
-
cap nginx:auth_setup
-
cap nginx:disable
-
cap nginx:enable
-
cap nginx:parse
-
cap nginx:restart
-
cap nginx:setup
-
cap nginx:start
-
cap nginx:status
-
cap nginx:stop
-
cap passenger:bounce
-
cap passenger:memory
-
cap passenger:status
-
cap puma:restart
-
cap puma:setup
-
cap puma:start
-
cap puma:stop
-
cap resque:web:restart
-
cap resque:web:start
-
cap resque:web:status
-
cap resque:web:stop
-
cap resque:worker:list
-
cap resque:worker:restart
-
cap resque:worker:start
-
cap resque:worker:stop
-
cap sphinx:config
-
cap sphinx:index
-
cap sphinx:rebuild
-
cap sphinx:start
-
cap sphinx:stop
-
cap sphinx:symlinks
-
cap symlinks:make
-
cap unicorn:restart
-
cap unicorn:setup
-
cap unicorn:start
-
cap unicorn:stop
-
cap unicorn:tail
Clone and add LOAD_PATH and require to your deploy file. (Clone to /code/github/capistrano-recipes or other path)
$LOAD_PATH << '/code/github/capistrano-recipes/lib/' require 'capistrano_recipes'
Inside the newly created config/deploy.rb, add:
# This one should go at the end of your deploy.rb require 'capistrano_recipes'
RVM is enabled by default. You can disable it by setting :using_rvm to false, or leverage it by setting your rvm_ruby_string to appropriate ones (default is ree)
If using_rvm is true, the rvm recipe will load rvm’s own capistrano extensions so you don’t have to worry about it during deploy. Just make sure you have everything set up right, like .rvmrc on project root and system-wide install on the servers.
See (rvm.beginrescueend.com/rvm/install) for more info.
If you’re using nginx as your web server, set :web_server to :nginx and deploy:setup will generate the appropriate configuration file for it based on your other variables, such as :application_uses_ssl, etc.
If you’re running Phusion Passenger (www.modrails.com) be sure you add this line to config/deploy.rb:
set :app_server, :passenger
If you’re running Puma (puma.io/) be sure to add this line instead:
set :app_server, :puma
Note: I haven’t maintained the Unicorn
If you’re running Unicorn (unicorn.bogomips.org/) be sure to add this line instead:
set :app_server, :unicorn
Copyright © 2009-2011 Webficient LLC, Phil Misiowiec. See LICENSE for details.