Created
June 7, 2012 14:59
-
-
Save Sen/2889246 to your computer and use it in GitHub Desktop.
my wizzey cap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/capistrano' | |
set :application, "wizzey" | |
default_run_options[:pty] = true # Must be set for the password prompt from git to work | |
set :repository, "git@github.com:mehdi/Wizzey.git" # Your clone URL | |
set :branch, "master" | |
set :scm, "git" | |
set :user, "app" # The server's user for deploys | |
set :deploy_to, "/opt/webapps/#{application}" | |
set :deploy_via, :remote_cache | |
set :use_sudo, false | |
set :keep_releases, 5 | |
ssh_options[:forward_agent] = true | |
set :git_shallow_clone, 1 | |
set :git_enable_submodules, 1 | |
role :web, "178.33.226.12" # Your HTTP server, Apache/etc | |
role :app, "178.33.226.12" # This may be the same as your `Web` server | |
role :db, "178.33.226.12", :primary => true # This is where Rails migrations will run | |
set :bundle_flags, "--deployment --quiet --binstubs" | |
set :default_environment, { | |
'PATH' => "/home/#{user}/.rbenv/shims:/home/#{user}/.rbenv/bin:$PATH" | |
} | |
#set(:bundle_cmd) { "#{release_path}/bin/bundle" } | |
after 'deploy:update_code', 'bundle:install' | |
#namespace :bundle do | |
# task :install do | |
# run "bundle install --gemfile #{release_path}/Gemfile --path #{shared_path}/bundle --deployment" | |
# end | |
#end | |
# tasks | |
namespace :deploy do | |
task 'restart', :roles => :app do | |
run "cd #{current_path} && touch ./tmp/restart.txt" | |
end | |
desc "Symlink shared resources on each release" | |
task :symlink_shared, :roles => :app do | |
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" | |
run "ln -fs #{shared_path}/sockets #{release_path}/tmp/sockets" | |
run "ln -nfs #{shared_path}/geodb/worldcitiespop.txt #{release_path}/geodb/worldcitiespop.txt" | |
run "ln -nfs #{shared_path}/uploads #{release_path}/public/uploads" | |
end | |
end | |
after 'deploy:update_code', 'deploy:symlink_shared' | |
namespace :db do | |
desc "migrate db" | |
task :migrate, :roles => :app do | |
run "cd #{release_path} && RAILS_ENV=production bundle exec rake db:migrate" | |
end | |
task :load_schema, :roles => :app do | |
run "cd #{current_path} && RAILS_ENV=production bundle exec rake db:schema:load" | |
end | |
end | |
after 'deploy:update_code', 'db:migrate' | |
namespace :resque do | |
task :restart, :roles => :app do | |
run "cd #{current_path} && RAILS_ENV=production rake queue:restart_workers" | |
end | |
end | |
after 'deploy:update_code', 'resque:restart' | |
namespace :status_roster do | |
task :restart, :roles => :app do | |
run "cd #{current_path}/script && RAILS_ENV=production ruby status_roster_control.rb restart" | |
end | |
task :start, :roles => :app do | |
run "cd #{current_path}/script && RAILS_ENV=production ruby status_roster_control.rb start" | |
end | |
task :stop, :roles => :app do | |
run "cd #{current_path}/script && RAILS_ENV=production ruby status_roster_control.rb stop" | |
end | |
end | |
after 'deploy:update_code', 'status_roster:restart' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment