From f7a84fedcb9f17b5fbf13f4190fa7e3283b30990 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 26 Feb 2020 12:28:48 -0300 Subject: [PATCH] deploy --- config/deploy.rb | 4 ++-- config/puma.rb | 2 +- lib/capistrano/tasks/{puma.rake => pumx.rake} | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) rename lib/capistrano/tasks/{puma.rake => pumx.rake} (69%) diff --git a/config/deploy.rb b/config/deploy.rb index e2d4c63..5a66322 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -18,5 +18,5 @@ set :default_env, { web_concurrency: '1' } -after 'deploy:published', 'puma:stop' -after 'puma:stop', 'puma:start' +after 'deploy:published', 'pumx:stop' +after 'pumx:stop', 'pumx:start' diff --git a/config/puma.rb b/config/puma.rb index 9e7efa9..1934c5e 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -35,4 +35,4 @@ preload_app! # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart -pidfile 'tmp/puma.pid' +pidfile 'tmp/pids/puma.pid' diff --git a/lib/capistrano/tasks/puma.rake b/lib/capistrano/tasks/pumx.rake similarity index 69% rename from lib/capistrano/tasks/puma.rake rename to lib/capistrano/tasks/pumx.rake index 4270662..7fce80d 100644 --- a/lib/capistrano/tasks/puma.rake +++ b/lib/capistrano/tasks/pumx.rake @@ -1,6 +1,6 @@ # frozen_string_literal: true -namespace :pumo do +namespace :pumx do desc 'Start puma' task :start do on roles(:web) do @@ -14,7 +14,8 @@ namespace :pumo do task :stop do on roles(:web) do within current_path do - execute "cat #{current_path}/tmp/puma.pid | xargs kill" + pid = "#{current_path}/tmp/pids/puma.pid" + execute "test -f '#{pid}' && cat '#{pid}' | xargs kill" end end end