Created
August 13, 2018 14:50
-
-
Save erpe/5e9ff5f976b9c1a9b0a73c88c40c4c65 to your computer and use it in GitHub Desktop.
Simple 'start-stop-daemon'-based script to start/stop/restart kemal after deployment with capistrano
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :deploy do | |
desc 'show kemal status' | |
task :kemal_status do | |
on roles(:app) do | |
within "#{release_path}" do | |
execute "start-stop-daemon", | |
"-v", | |
"--status", | |
"--pid", | |
"`cat #{shared_path}/tmp/pids/kemal.pid`" | |
end | |
end | |
end | |
desc 'stop kemal' | |
task :kemal_stop do | |
on roles(:app) do | |
within "#{release_path}" do | |
execute "start-stop-daemon", | |
"-v", | |
"--stop", | |
"--pid", | |
"`cat #{shared_path}/tmp/pids/kemal.pid`" | |
end | |
end | |
end | |
desc 'start_kemal' | |
task :kemal_start do | |
on roles(:app) do | |
within "#{release_path}" do | |
execute "start-stop-daemon", | |
"-v", | |
"--start", | |
"--make-pidfile", | |
"--background", | |
"--pidfile", | |
"#{shared_path}/tmp/pids/kemal.pid", | |
"--exec", | |
"#{current_path}/app", | |
"--", | |
"-p3030" | |
end | |
end | |
end | |
desc 'restart_kemal' | |
task :kemal_restart do | |
invoke 'deploy:kemal_stop' | |
invoke 'deploy:kemal_start' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment