Skip to content

Instantly share code, notes, and snippets.

@Kroid
Forked from trushkevich/deploy.rb
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kroid/2dcffa90759d56e3ad87 to your computer and use it in GitHub Desktop.
Save Kroid/2dcffa90759d56e3ad87 to your computer and use it in GitHub Desktop.
set :private_pub_pid, -> { "#{current_path}/tmp/pids/private_pub.pid" }
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 -C config/private_pub/thin_#{fetch(:stage)}.yml -d -P #{fetch(:private_pub_pid)} 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