Skip to content

Instantly share code, notes, and snippets.

@jeanfbrito
Forked from josemarluedke/Capfile
Created June 19, 2013 18:47
Show Gist options
  • Save jeanfbrito/5816844 to your computer and use it in GitHub Desktop.
Save jeanfbrito/5816844 to your computer and use it in GitHub Desktop.
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, "[email protected]: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