Skip to content

Instantly share code, notes, and snippets.

@henrydjacob
Created January 12, 2011 10:56
Show Gist options
  • Save henrydjacob/776011 to your computer and use it in GitHub Desktop.
Save henrydjacob/776011 to your computer and use it in GitHub Desktop.
Rails 3 Deployment With Capistrano
uncomment gem 'capistrano' in Gemfile
bundle install
bundle exec capify .
set :application, "test"
set :scm, :subversion
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :svn_user, ENV['svn_user'] || "default_svn_user"
set :svn_password, Proc.new { Capistrano::CLI.password_prompt('SVN Password: ') }
set :repository,
Proc.new { "--username #{svn_user} " +
"--password #{svn_password} " +
"--no-auth-cache " +
"http://svn/project" }
set :user, "root"
set :deploy_to, "/var/www/#{application}"
role :web, "10.0.2.67" # Your HTTP server, Apache/etc
role :app, "10.0.2.67" # This may be the same as your `Web` server
role :db, "10.0.2.67", :primary => true # This is where Rails migrations will run
# If you are using Passenger mod_rails uncomment this:
# if you're still using the script/reapear helper you will need
# these http://github.com/rails/irs_process_scripts
after "deploy:update_code", "bundle:install"
namespace :bundle do
desc "Bundle install"
task :install, :roles => :app do
run "cd #{current_release} && #{sudo} bundle install"
end
end
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
bundle exec cap deploy:setup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment