diff --git a/config/deploy.rb b/config/deploy.rb index d2a9ab9..068ed44 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -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}" diff --git a/config/env_init b/config/env_init new file mode 100644 index 0000000..0064d3d --- /dev/null +++ b/config/env_init @@ -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" + diff --git a/config/nginx.conf b/config/nginx.conf index 19c9b95..cbcbe87 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -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; } diff --git a/config/unicorn.rb b/config/unicorn.rb index 560350e..a4890be 100644 --- a/config/unicorn.rb +++ b/config/unicorn.rb @@ -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 \ No newline at end of file