This commit is contained in:
Nicolas Bally 2015-05-18 15:54:59 +02:00
parent 02a8e16174
commit 4308486af7
3 changed files with 58 additions and 104 deletions

View File

@ -85,7 +85,7 @@ GEM
net-ssh (>= 1.99.1) net-ssh (>= 1.99.1)
orm_adapter (0.0.5) orm_adapter (0.0.5)
polyglot (0.3.1) polyglot (0.3.1)
rack (1.2.2) rack (1.4.1)
rack-mount (0.6.14) rack-mount (0.6.14)
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (0.5.7) rack-test (0.5.7)

View File

@ -2,7 +2,7 @@
require File.expand_path('../boot', __FILE__) require File.expand_path('../boot', __FILE__)
require 'rails/all' require 'rails/all'
require 'sprockets/railtie'
# If you have a Gemfile, require the gems listed there, including any gems # If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production. # you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler) Bundler.require(:default, Rails.env) if defined?(Bundler)

View File

@ -1,13 +1,9 @@
set :application, 'accescible_app' set :application, 'accescible_app'
set :domain, 'auclair-laverie.com' set :domain, 'www.accescible-solutions.com'
require "rvm/capistrano"
set :rvm_ruby_string, 'ruby-1.9.3-p0' set :rvm_ruby_string, 'ruby-1.9.3-p0'
set :rvm_type, :user set :rvm_type, :user
@ -30,70 +26,44 @@ set :application, 'accescible_app'
role :db, domain, :primary => true role :db, domain, :primary => true
set :scm, :git set :scm, :git
set :repository, "git@git.nicolasbally.com:root/accescible_app.git" set :repository, "git@git.nicolasbally.com:root/#{application}.git"
set :branch, "master" set :branch, "master"
default_run_options[:pty] = true default_run_options[:pty] = true
after "deploy", "deploy:bundle_gems"
before "deploy:symlink", "deploy:bundle_gems"
after "deploy:bundle_gems", "deploy:make_simlinks" after "deploy:bundle_gems", "deploy:make_simlinks"
after "deploy:make_simlinks", "assets:precompile" after "deploy:make_simlinks", "deploy:restart"
before "deploy:restart", "deploy:init_d" before "deploy:restart", "deploy:init_d"
# after "deploy", "deploy:restart"
after "deploy:restart", "deploy:cleanup" after "deploy:restart", "deploy:cleanup"
#after "deploy", "deploy:bundle_gems"
#after "deploy:bundle_gems", "deploy:make_simlinks"
#after "deploy:make_simlinks", "assets:precompile"
#after "assets:precompile", "deploy:restart"
#after "deploy:restart", "deploy:cleanup"
namespace :assets do
task :precompile, :roles => :web do
run "rm -rf #{release_path}/public/assets"
run "ln -s #{deploy_to}shared/assets #{release_path}/public/assets"
run "cd #{release_path} && bundle exec rake assets:precompile --trace"
end
task :cleanup, :roles => :web do
run "cd #{current_path} && RAILS_ENV=production bundle exec rake assets:clean"
end
end
namespace :deploy do namespace :deploy do
task :bundle_gems do
run "cd #{release_path} && bundle install"
end
task :init_d do task :init_d do
sudo "cp #{current_path}/config/unicorn_init_d /etc/init.d/#{application}" sudo "cp #{current_path}/config/unicorn_init_d /etc/init.d/#{application}"
sudo "chmod +x /etc/init.d/#{application}" sudo "chmod +x /etc/init.d/#{application}"
sudo "update-rc.d #{application} defaults " sudo "update-rc.d #{application} defaults "
end 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 task :make_simlinks do
run "rm -rf #{release_path}/private_medias" run "rm -rf #{deploy_to}current/private_medias"
run "ln -s #{deploy_to}shared/storage/private #{release_path}/private_medias" run "ln -s #{deploy_to}shared/storage/private #{deploy_to}current/private_medias"
run "rm -rf #{release_path}/public/public_medias" run "rm -rf #{deploy_to}current/public/public_medias"
run "ln -s #{deploy_to}shared/storage/public #{release_path}/public/public_medias" run "ln -s #{deploy_to}shared/storage/public #{deploy_to}current/public/public_medias"
run "rm -rf #{release_path}/db/production.sqlite3"
run "ln -s #{deploy_to}shared/production.sqlite3 #{release_path}/db/production.sqlite3"
end end
task :start do task :start do
@ -105,24 +75,8 @@ set :application, 'accescible_app'
task :restart, :roles => :app, :except => { :no_release => true } do task :restart, :roles => :app, :except => { :no_release => true } do
sudo "service #{application} restart" sudo "service #{application} restart"
end 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 :migrate do task :migrate do
run "cd #{deploy_to}current && rake db:migrate RAILS_ENV=#{rails_env}" run "cd #{deploy_to}current && rake db:migrate RAILS_ENV=#{rails_env}"
end end
task :seeds do
run "cd #{deploy_to}current && rake db:seeds RAILS_ENV=#{rails_env}"
end end
end