migration

This commit is contained in:
Nicolas Bally 2018-03-14 01:39:58 +01:00
parent 2c76a34127
commit e45e4894d8
4 changed files with 30 additions and 17 deletions

View File

@ -7,7 +7,7 @@ set :application, application
set :stages, ["production"]
scm_user = "git"
scm_host = "git.nicolasbally.com"
scm_host = "quartz.snlab.fr"
set :scm_user, scm_user
set :scm_host, scm_host
@ -17,15 +17,15 @@ set :pty, true
set :rvm_ruby_version, 'ruby-2.1.2'
#set :rvm_autolibs_flag, "read-only"
#set :bundle_cmd, "/home/web/.rvm/gems/#{rvm_ruby_string}@global/bin/bundle"
#set :bundle_dir, "/home/web/.rvm/gems/#{rvm_ruby_string}"
#set :bundle_cmd, "/srv/www/web/.rvm/gems/#{rvm_ruby_string}@global/bin/bundle"
#set :bundle_dir, "/srv/www/web/.rvm/gems/#{rvm_ruby_string}"
#set :use_sudo, false
set :deploy_to, "/home/web/#{application}/"
set :deploy_to, "/srv/www/web/#{application}/"
set :deploy_via, :remote_cache
@ -36,7 +36,7 @@ set :rails_env, "production"
set :scm, :git
set :repo_url, "#{scm_user}@#{scm_host}:root/#{application}.git"
set :repo_url, "#{scm_user}@#{scm_host}:nicolas/#{application}.git"
set :branch, "master"
@ -61,12 +61,17 @@ namespace :deploy do
execute :ln, "-s #{shared_path}/storage/private #{current_path}/private_medias"
execute :ln, "-s #{shared_path}/storage/public #{current_path}/public/public_medias"
execute :ln, "-s #{shared_path}/production.sqlite3 #{current_path}/db/production.sqlite3"
execute :ln, "-s #{shared_path}/env_init #{current_path}/config/env_init"
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 "
sudo "sudo systemctl enable quartz_app@#{application}"
end
@ -78,7 +83,8 @@ namespace :deploy do
task :restart do
on roles(:app) do
sudo "/etc/init.d/#{application} restart"
sudo "systemctl stop quartz_app@#{application}"
sudo "systemctl start quartz_app@#{application}"

7
config/env_init Normal file
View File

@ -0,0 +1,7 @@
APP_RUBY=2.1.2
ENV=production
APP_ROOT=/srv/www/web/blog_perso_app/current/
GEM_HOME=/srv/www/web/.rvm/gems/ruby-$APP_RUBY
UNICORN_OPTS="-D -E ${ENV} -c ${APP_ROOT}/config/unicorn.rb"

View File

@ -3,7 +3,7 @@ upstream blog_perso_app_unicorn {
}
server {
listen 80;
listen [::]:80;
server_name blog.nicolasbally.com;
root /home/web/blog_perso_app/current/public;
try_files $uri/index.html $uri @unicorn;
@ -21,7 +21,7 @@ server {
}
server {
listen 80;
server_name www.blog.nicolasbally.com;
rewrite ^(.*) http://blog.nicolasbally.com$1 permanent;
listen [::]:80;
server_name www.blog.nicolasbally.com;
rewrite ^(.*) http://blog.nicolasbally.com$1 permanent;
}

View File

@ -1,10 +1,10 @@
@rails_app = "blog_perso_app"
working_directory "/home/web/#{@rails_app}/current"
pid "/home/web/#{@rails_app}/shared/unicorn.pid"
stderr_path "/home/web/#{@rails_app}/shared/log/unicorn.log"
stdout_path "/home/web/#{@rails_app}/shared/log/unicorn.log"
working_directory "/srv/www/web/#{@rails_app}/current"
pid "/srv/www/web/#{@rails_app}/shared/unicorn.pid"
stderr_path "/srv/www/web/#{@rails_app}/shared/log/unicorn.log"
stdout_path "/srv/www/web/#{@rails_app}/shared/log/unicorn.log"
listen "/home/web/#{@rails_app}/shared/unicorn.sock"
listen "/srv/www/web/#{@rails_app}/shared/unicorn.sock"
worker_processes 2
timeout 30