Skip to content

Instantly share code, notes, and snippets.

Forked from josemarluedke/Capfile
Created June 19, 2013 18:47
What would you like to do?
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, ""
role :app, ""
role :db, "", :primary => true
# Repository informations
set :scm, :git
set :repository, ""
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
# 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')}"
# 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"
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