Skip to content

Instantly share code, notes, and snippets.

@gabetax
Created January 5, 2012 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gabetax/1567078 to your computer and use it in GitHub Desktop.
Save gabetax/1567078 to your computer and use it in GitHub Desktop.
Capistrano deploy.rb for Rails 3.2 apps
# http://gembundler.com/deploying.html
require 'bundler/capistrano'
# http://guides.rubyonrails.org/asset_pipeline.html
load 'deploy/assets'
# http://beginrescueend.com/integration/capistrano/
# Also add rvm-capistrano to your Gemfile
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :rvm_type, :system # Copy the exact line. I really mean :system here
# If using airbrake / hop toad
# require 'airbrake/capistrano'
set :application, "project_name"
set :repository, "ssh://git@git.mudbugmedia.com/client/project.git"
set :scm, :git
set :deploy_via, :remote_cache
set :use_sudo, false
set :group_writable, false # Setting HOME to g+w during deploy:setup will break ssh key authentication
# Create additional tasks for each environment, so you may run `cap staging deploy`
task :staging do
server 'THE-SERVER.mudbugmedia.com', :web, :app, :db, :primary => true
set :deploy_to, '/www/THE-HOSTNAME'
set :user, 'THE-HOSTNAME'
set :rails_env, 'staging'
set :branch, 'master'
end
after 'deploy:setup', :create_configs
desc 'Create the shared/config dir for various config files'
task :create_configs do
run "mkdir -p #{shared_path}/config"
run "touch #{shared_path}/config/database.yml"
end
after 'deploy:finalize_update', :update_configs
desc 'Copy the shared config files to the release config dir'
task :update_configs do
run "cp -Rf #{shared_path}/config/* #{release_path}/config"
end
# 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