1
0
Fork 0

Restart Rails server during deploy

This commit is contained in:
Alex Kotov 2018-12-07 05:57:42 +05:00
parent 655c9fd36f
commit 5bf82a5e95
No known key found for this signature in database
GPG Key ID: 4E831250F47DE154
3 changed files with 21 additions and 1 deletions

View File

@ -50,3 +50,5 @@ append :linked_dirs,
# Uncomment the following to require manually verifying the host key
# before first deploy.
# set :ssh_options, verify_host_key: :secure
after 'deploy:published', 'rails:restart'

View File

@ -32,4 +32,4 @@ threads threads_count, threads_count
bind "unix://#{Rails.root.join('tmp', 'sockets', 'puma.sock')}"
# Allow puma to be restarted by `rails restart` command.
# plugin :tmp_restart
plugin :tmp_restart

View File

@ -0,0 +1,18 @@
# frozen_string_literal: true
namespace :load do
task :defaults do
set :rails_restart_roles, %i[web]
end
end
namespace :rails do
desc 'Restart app by touching tmp/restart.txt'
task :restart do
on roles(fetch(:rails_restart_roles)) do |_host|
within release_path do
execute :bundle, :exec, :rails, :restart
end
end
end
end