Nicolas Bally 4308486af7 rack
2015-05-18 15:54:59 +02:00

82 lines
1.9 KiB
Ruby

set :application, 'accescible_app'
set :domain, 'www.accescible-solutions.com'
set :rvm_ruby_string, 'ruby-1.9.3-p0'
set :rvm_type, :user
set :user, 'web'
set :deploy_to, "/home/#{user}/#{application}/"
set :deploy_via, :remote_cache
set :normalize_asset_timestamps, false
set :rails_env, "production"
role :app, domain
role :web, domain
role :db, domain, :primary => true
set :scm, :git
set :repository, "git@git.nicolasbally.com:root/#{application}.git"
set :branch, "master"
default_run_options[:pty] = true
after "deploy", "deploy:bundle_gems"
after "deploy:bundle_gems", "deploy:make_simlinks"
after "deploy:make_simlinks", "deploy:restart"
before "deploy:restart", "deploy:init_d"
after "deploy:restart", "deploy:cleanup"
namespace :deploy do
task :init_d do
sudo "cp #{current_path}/config/unicorn_init_d /etc/init.d/#{application}"
sudo "chmod +x /etc/init.d/#{application}"
sudo "update-rc.d #{application} defaults "
end
task :reload_nginx do
sudo "rm -rf /etc/nginx/sites-enabled/#{application}"
sudo "ln -s #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application} "
sudo "service nginx reload"
end
task :bundle_gems do
run "cd #{deploy_to}current && bundle install"
end
task :make_simlinks do
run "rm -rf #{deploy_to}current/private_medias"
run "ln -s #{deploy_to}shared/storage/private #{deploy_to}current/private_medias"
run "rm -rf #{deploy_to}current/public/public_medias"
run "ln -s #{deploy_to}shared/storage/public #{deploy_to}current/public/public_medias"
end
task :start do
sudo "service #{application} start"
end
task :stop do
run "service #{application} stop"
end
task :restart, :roles => :app, :except => { :no_release => true } do
sudo "service #{application} restart"
end
task :migrate do
run "cd #{deploy_to}current && rake db:migrate RAILS_ENV=#{rails_env}"
end
end