Skip to content

Instantly share code, notes, and snippets.

@jschoolcraft
Created August 4, 2009 13:04
Show Gist options
  • Select an option

  • Save jschoolcraft/161214 to your computer and use it in GitHub Desktop.

Select an option

Save jschoolcraft/161214 to your computer and use it in GitHub Desktop.
set :stages, %w(staging production)
require 'capistrano/ext/multistage'
#default_run_options[:pty] = true
set :application, "urlagg"
set :repository, "[email protected]:urlagg.git"
set :urlagg, "urlagg.com"
role :app, "#{urlagg}"
role :web, "#{urlagg}"
role :db, "#{urlagg}", :primary => true
set :deploy_to, "/var/www/apps/#{application}"
set :scm, :git
set :branch, "master"
set :user, 'jeff'
set :use_sudo, true
set :ssh_options, { :forward_agent => true }
set :rails_env, "production"
set :god_task, 'link_updater'
namespace :deploy do
desc "Restarting passenger with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{current_path}/tmp/restart.txt"
end
[:start, :stop].each do |t|
desc "#{t} task is a no-op with passenger"
task t, :roles => :app do ; end
end
desc "Stop god"
task :before_deploy do
run "god stop #{god_task} && sleep 10"
end
desc "Restarting god"
task :before_restart do
run "god load #{current_path}/config/link_updater.god"
run "god start #{god_task}"
end
end
desc "Move shared files over to release directory"
task :moved_shared_files_to_release_path do
%W{ database.yml }.each do |config|
run "ln -nfs #{shared_path}/system/config/#{config} #{release_path}/config/#{config}"
end
end
namespace :sass do
desc 'Updates the stylesheets generated by Sass'
task :update, :roles => :app do
invoke_command "cd #{latest_release}; RAILS_ENV=#{rails_env} rake sass:update"
end
# Generate all the stylesheets manually (from their Sass templates) before each restart.
before 'deploy:restart', 'sass:update'
end
after "deploy:update_code", :moved_shared_files_to_release_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment