-
-
Save sigra/7ebd7e5dc077887cded2 to your computer and use it in GitHub Desktop.
private_pub Capistrano 3 with Thin on Unix socket
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
set :private_pub_pid, -> { "#{current_path}/tmp/pids/private_pub.pid" } | |
set :private_pub_socket, -> { "#{current_path}/tmp/sockets/private_pub.sock" } | |
set :private_pub_rackup, -> { "#{current_path}/private_pub.ru" } | |
namespace :private_pub do | |
desc "Start private_pub server" | |
task :start do | |
on roles(:app) do | |
within release_path do | |
with rails_env: fetch(:stage) do | |
execute :bundle, "exec thin -e production -d -P #{fetch(:private_pub_pid)} -S #{fetch(:private_pub_socket)} -R #{fetch(:private_pub_rackup)} start" | |
end | |
end | |
end | |
end | |
desc "Stop private_pub server" | |
task :stop do | |
on roles(:app) do | |
within release_path do | |
execute "if [ -f #{fetch(:private_pub_pid)} ] && [ -e /proc/$(cat #{fetch(:private_pub_pid)}) ]; then kill -9 `cat #{fetch(:private_pub_pid)}`; fi" | |
end | |
end | |
end | |
desc "Restart private_pub server" | |
task :restart do | |
on roles(:app) do | |
invoke 'private_pub:stop' | |
invoke 'private_pub:start' | |
end | |
end | |
end | |
after 'deploy:restart', 'private_pub:restart' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nginx + websocket + thin : https://gist.github.com/sigra/8e8fa71cb43ffa8552a7