prod
This commit is contained in:
parent
772e87ffb7
commit
55595b1c1f
126
config/deploy.rb
126
config/deploy.rb
@ -1,73 +1,65 @@
|
|||||||
|
|
||||||
# ajouter shared_path, modifier liens symboliques & mkdir
|
|
||||||
# changer unicorn_init_d
|
|
||||||
# changer unicorn.rb
|
|
||||||
# changer nginx.conf
|
|
||||||
set :application, 'negos_app'
|
set :application, 'negos_app'
|
||||||
set :domain, 'sideplace.bally.me'
|
set :domain, 'negos-pro.fr'
|
||||||
|
|
||||||
set :user, 'web'
|
|
||||||
|
|
||||||
set :scm_user, "git"
|
|
||||||
set :scm_host, "git.nicolasbally.com"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set :rvm_ruby_string, 'ruby-2.1.2'
|
set :user, 'web'
|
||||||
set :rvm_autolibs_flag, "read-only"
|
set :scm_user, "git"
|
||||||
|
set :scm_host, "git.nicolasbally.com"
|
||||||
|
|
||||||
set :bundle_cmd, "/home/#{user}/.rvm/gems/#{rvm_ruby_string}@global/bin/bundle"
|
|
||||||
set :bundle_dir, "/home/#{user}/.rvm/gems/#{rvm_ruby_string}"
|
|
||||||
set :use_sudo, false
|
set :rvm_ruby_string, 'ruby-2.1.2'
|
||||||
|
set :rvm_autolibs_flag, "read-only"
|
||||||
|
|
||||||
|
set :bundle_cmd, "/home/#{user}/.rvm/gems/#{rvm_ruby_string}@global/bin/bundle"
|
||||||
|
set :bundle_dir, "/home/#{user}/.rvm/gems/#{rvm_ruby_string}"
|
||||||
|
set :use_sudo, false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set :deploy_to, "/home/#{user}/#{application}/"
|
set :deploy_to, "/home/#{user}/#{application}/"
|
||||||
|
set :deploy_via, :remote_cache
|
||||||
|
|
||||||
set :deploy_via, :remote_cache
|
set :normalize_asset_timestamps, false
|
||||||
|
|
||||||
set :normalize_asset_timestamps, false
|
set :rails_env, "production"
|
||||||
|
|
||||||
set :rails_env, "production"
|
role :app, domain
|
||||||
|
role :web, domain
|
||||||
|
role :db, domain, :primary => true
|
||||||
|
|
||||||
role :app, domain
|
set :scm, :git
|
||||||
role :web, domain
|
|
||||||
role :db, domain, :primary => true
|
|
||||||
|
|
||||||
set :scm, :git
|
set :repository, "#{scm_user}@#{scm_host}:root/#{application}.git"
|
||||||
|
|
||||||
set :repository, "#{scm_user}@#{scm_host}:root/#{application}.git"
|
set :branch, "master"
|
||||||
|
|
||||||
set :branch, "master"
|
default_run_options[:pty] = true
|
||||||
|
|
||||||
|
|
||||||
set :shared_path, "/media/bigone/shareds/#{application}"
|
require "rvm/capistrano"
|
||||||
|
require 'bundler/capistrano'
|
||||||
default_run_options[:pty] = true
|
|
||||||
|
|
||||||
|
|
||||||
require "rvm/capistrano"
|
|
||||||
require 'bundler/capistrano'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
load 'deploy/assets'
|
load 'deploy/assets'
|
||||||
|
|
||||||
namespace :deploy do
|
namespace :deploy do
|
||||||
|
|
||||||
# namespace :assets do
|
# namespace :assets do
|
||||||
# task :precompile, :roles => :web, :except => { :no_release => true } do
|
# task :precompile, :roles => :web, :except => { :no_release => true } do
|
||||||
# from = source.next_revision(current_revision)
|
# from = source.next_revision(current_revision)
|
||||||
# if releases.length <= 1 || capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
|
# if releases.length <= 1 || capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
|
||||||
# run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
|
# run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
|
||||||
# else
|
# else
|
||||||
# logger.info "Skipping asset pre-compilation because there were no asset changes"
|
# logger.info "Skipping asset pre-compilation because there were no asset changes"
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -75,17 +67,17 @@ namespace :deploy do
|
|||||||
task :symlink_config_files do
|
task :symlink_config_files do
|
||||||
|
|
||||||
|
|
||||||
run "ln -s #{shared_path}/private #{current_path}/private_medias"
|
run "ln -s #{deploy_to}shared/storage/private #{current_path}/private_medias"
|
||||||
run "ln -s #{shared_path}/public #{current_path}/public/public_medias"
|
|
||||||
run "ln -s #{shared_path}/production.sqlite3 #{current_path}/db/production.sqlite3"
|
run "ln -s #{deploy_to}shared/storage/public #{current_path}/public/public_medias"
|
||||||
|
|
||||||
|
|
||||||
|
run "ln -s #{deploy_to}shared/production.sqlite3 #{current_path}/db/production.sqlite3"
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
@ -110,47 +102,39 @@ namespace :deploy do
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
task :db_create do
|
|
||||||
run "cd #{deploy_to}current && bundle exec rake db:create RAILS_ENV=#{rails_env}"
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
task :seeds do
|
task :seeds do
|
||||||
run "cd #{deploy_to}current && bundle exec rake db:seed RAILS_ENV=#{rails_env}"
|
run "cd #{deploy_to}current && rake db:seed RAILS_ENV=#{rails_env}"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
task :create_files_folders do
|
task :create_files_folders do
|
||||||
|
|
||||||
# run "mkdir #{deploy_to}shared/storage"
|
run "mkdir #{deploy_to}shared/storage"
|
||||||
# run "mkdir #{deploy_to}shared/storage/private"
|
run "mkdir #{deploy_to}shared/storage/private"
|
||||||
# run "mkdir #{deploy_to}shared/storage/public"
|
run "mkdir #{deploy_to}shared/storage/public"
|
||||||
|
|
||||||
run "mkdir #{shared_path}/private"
|
|
||||||
run "mkdir #{shared_path}/public"
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#before 'deploy:setup', 'rvm:install_rvm' # install RVM
|
#before 'deploy:setup', 'rvm:install_rvm' # install RVM
|
||||||
#before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, OR:
|
#before 'deploy:setup', 'rvm:install_ruby' # install Ruby and create gemset, OR:
|
||||||
#before 'deploy:setup', 'rvm:create_gemset' # only create gemset
|
#before 'deploy:setup', 'rvm:create_gemset' # only create gemset
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
after "deploy:setup", "deploy:create_files_folders"
|
after "deploy:setup", "deploy:create_files_folders"
|
||||||
|
|
||||||
#after "deploy:restart", "deploy:cleanup"
|
#after "deploy:restart", "deploy:cleanup"
|
||||||
|
|
||||||
|
|
||||||
before "deploy:restart", "deploy:symlink_config_files"
|
before "deploy:restart", "deploy:symlink_config_files"
|
||||||
|
|
||||||
|
after "deploy", "deploy:cleanup"
|
||||||
|
|
||||||
after "deploy", "deploy:cleanup"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
upstream negos_app_unicorn {
|
upstream negos_app_unicorn {
|
||||||
server unix:/home/web/negos_app/unicorn.sock fail_timeout=0;
|
server unix:/home/web/negos_app/shared/unicorn.sock fail_timeout=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
@ -13,7 +13,6 @@ server {
|
|||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
proxy_pass http://negos_app_unicorn;
|
proxy_pass http://negos_app_unicorn;
|
||||||
proxy_read_timeout 20000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
error_page 500 502 503 504 /500.html;
|
error_page 500 502 503 504 /500.html;
|
||||||
@ -23,7 +22,6 @@ server {
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name www.negos-pro.fr ;
|
server_name www.negos-pro.fr;
|
||||||
rewrite ^(.*) https://negos-pro.fr$1 permanent;
|
rewrite ^(.*) http://negos-pro.fr$1 permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ set -e
|
|||||||
APP_NAME=negos_app
|
APP_NAME=negos_app
|
||||||
APP_RUBY=2.1.2
|
APP_RUBY=2.1.2
|
||||||
APP_ROOT="/home/web/negos_app/current"
|
APP_ROOT="/home/web/negos_app/current"
|
||||||
PID="/home/web/negos_app/unicorn.pid"
|
PID="/home/web/negos_app/shared/unicorn.pid"
|
||||||
ENV=production
|
ENV=production
|
||||||
|
|
||||||
GEM_HOME="/home/web/.rvm/gems/ruby-$APP_RUBY"
|
GEM_HOME="/home/web/.rvm/gems/ruby-$APP_RUBY"
|
||||||
@ -16,7 +16,7 @@ GEM_HOME="/home/web/.rvm/gems/ruby-$APP_RUBY"
|
|||||||
UNICORN_OPTS="-D -E $ENV -c $APP_ROOT/config/unicorn.rb"
|
UNICORN_OPTS="-D -E $ENV -c $APP_ROOT/config/unicorn.rb"
|
||||||
|
|
||||||
SET_PATH="cd $APP_ROOT; rvm $APP_RUBY"
|
SET_PATH="cd $APP_ROOT; rvm $APP_RUBY"
|
||||||
CMD="$SET_PATH; bundle exec unicorn $UNICORN_OPTS"
|
CMD="$SET_PATH; unicorn $UNICORN_OPTS"
|
||||||
|
|
||||||
old_pid="$PID.oldbin"
|
old_pid="$PID.oldbin"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user