Skip to content

Instantly share code, notes, and snippets.

@josemarluedke
Created October 10, 2012 20:17
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 josemarluedke/3868139 to your computer and use it in GitHub Desktop.
Save josemarluedke/3868139 to your computer and use it in GitHub Desktop.
Capistrano configurations for Rails Application
load 'deploy'
load 'deploy/assets' # Assets pipeline for Rails application
load 'config/deploy'
require "bundler/capistrano"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true # Allows deploy use my ssh keys
# Application
set :application, "events4me" # Application name
# The addresses of servers involved in the deployment
role :web, "linode.josemarluedke.com"
role :app, "linode.josemarluedke.com"
role :db, "linode.josemarluedke.com", :primary => true
# Repository informations
set :scm, :git
set :repository, "git@github.com:josemarluedke/events4me.git"
set :branch, 'master'
set :user, "deploy" # The deploy user
set :deploy_to, "/home/deploy/www/#{application}" # Makes deploy in this path
# Makes deploy be faster using a repository cache (in server)
set :deploy_via, :remote_cache
# For safety. Is not need to use sudo because :deploy_to can be written by :user
set :use_sudo, false
# Other options
set :git_enable_submodules, 1
set :scm_verbose, true
# 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
# Restart the application
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{File.join(current_path,'tmp','restart.txt')}"
end
# Copy the /home/deploy/database.yml to application path
task :db_config, :roles => :app, :except => { :no_release => true } do
run "cp -f ~/database.yml #{release_path}/config/database.yml"
end
end
after "deploy:finalize_update", "deploy:db_config"
after "deploy", "deploy:migrate"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment