Skip to content

Instantly share code, notes, and snippets.

@mhayes
Created September 30, 2011 21:16
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mhayes/1254996 to your computer and use it in GitHub Desktop.
Save mhayes/1254996 to your computer and use it in GitHub Desktop.
Capistrano for Rails 3.1
require 'capistrano/ext/multistage'
require "bundler/capistrano"
#use local key for authentication
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
set :application, 'awesome'
set :repository, "git@github.com:zurb/awesome.git"
set :deploy_via, :remote_cache
set :scm, "git"
set :use_sudo, false
set :user, application
set :branch, 'master'
after "deploy:update_code", "db:symlink"
# if you're symlinking production database.yml do this
before "deploy:assets:precompile", "db:symlink"
namespace :db do
desc "Make symlink for database yaml"
task :symlink do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end
end
namespace :deploy do
desc "Restart Application"
task :restart, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
end
@mhayes
Copy link
Author

mhayes commented Sep 30, 2011

Pay attention to:
before "deploy:assets:precompile", "db:symlink"

Otherwise some capistrano deployments may fail.

@danbt79
Copy link

danbt79 commented Mar 11, 2013

before "deploy:assets:precompile", "db:symlink"

Thank You!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment