Skip to content

Instantly share code, notes, and snippets.

@r38y
Created February 3, 2010 00:58
Show Gist options
  • Save r38y/293227 to your computer and use it in GitHub Desktop.
Save r38y/293227 to your computer and use it in GitHub Desktop.
require 'hoptoad_notifier/capistrano'
task :production do
set :rails_env, "production"
end
task :staging do
set :rails_env, "staging"
end
set :domain, "loseitorloseit.com"
role :web, domain
role :app, domain
role :db, domain, :primary => true
set :deploy_to, lambda{"/home/lioli/public_html/#{rails_env}"}
set :user, 'lioli'
set :group, 'users'
set :application, "lioli"
set :use_sudo, false
set :repository, "[email protected]:r38y/lioli.git"
set :scm, "git"
set :deploy_via, :remote_cache
set :repository_cache, "git_cache"
set :git_enable_submodules, true
task :after_update_code, :roles => :app do
run "cd #{release_path} && sudo geminstaller"
run "ln -s #{shared_path}/database.yml #{release_path}/config/database.yml"
run "ln -s #{shared_path}/assets #{release_path}/public/assets"
end
task :after_symlink, :roles => :web do
run "date > #{current_release}/DATE"
sudo "god restart dj-#{rails_env}"
sudo "god restart sm-#{rails_env}"
end
after "deploy", "deploy:cleanup"
after "deploy:migrations", "deploy:cleanup"
namespace :deploy do
desc "Restarting mod_rails 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 mod_rails"
task t, :roles => :app do ; end
end
end
namespace :god do
task :status, :roles => :app do
sudo "god status dj-#{rails_env}"
end
task :restart, :roles => :app do
sudo "god restart dj-#{rails_env}"
end
task :pending_jobs, :roles => :app do
run "cd #{current_path} && RAILS_ENV=#{rails_env} ./script/runner 'puts Delayed::Job.count'"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment