Skip to content

Instantly share code, notes, and snippets.

@jackfranklin
Created June 12, 2012 22:20
Show Gist options
  • Save jackfranklin/2920481 to your computer and use it in GitHub Desktop.
Save jackfranklin/2920481 to your computer and use it in GitHub Desktop.
Deploying with Capistrano
set :application, "tas"
set :repository, "" #your Github repo
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :deploy_to, "/home/jackfranklin/webapps/rails"
role :web, "web306.webfaction.com" # Your HTTP server, Apache/etc
role :app, "web306.webfaction.com" # This may be the same as your `Web` server
role :db, "web306.webfaction.com", :primary => true # This is where Rails migrations will run
set :user, "jackfranklin"
set :scm_username, "jackfranklin"
set :scm_password, "" #your github password
set :use_sudo, false
default_run_options[:pty] = true
after "deploy:update_code", "deploy:bundle_install"
after "deploy:update_code", "deploy:restart"
# after "deploy:update_code", "deploy:rake_migrate"
namespace :deploy do
desc "bundle install"
task :bundle_install, :roles => :app do
run "cd #{deploy_to}/current && bundle install"
end
desc "rake migrate"
task :rake_migrate, :roles => :app do
run "cd #{deploy_to}/current && rake db:migrate"
end
desc "restart nginx"
task :restart do
run "#{deploy_to}/bin/restart"
end
end
# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts
# If you are using Passenger mod_rails uncomment this:
# namespace :deploy do
# task :start do ; end
# task :stop do ; end
# task :restart, :roles => :app, :except => { :no_release => true } do
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
# end
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment