ryanb / private_pub

Handle pub/sub messaging through private channels in Rails using Faye.
MIT License
864 stars 228 forks source link

cap recipe #59

Open alec-c4 opened 11 years ago

alec-c4 commented 11 years ago

Hi, do you planning to add capistrano recipes like this (https://github.com/collectiveidea/delayed_job/blob/master/lib/delayed/recipes.rb) to add ability to control faye from capistrano?

drakmail commented 11 years ago

I has one:

namespace :private_pub do
  desc "Start private_pub server"
  task :start do
    run "cd #{current_path};RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production -D -P tmp/pids/private_pub.pid"
  end

  desc "Stop private_pub server"
  task :stop do
    run "cd #{current_path};if [ -f tmp/pids/private_pub.pid ] && [ -e /proc/$(cat tmp/pids/private_pub.pid) ]; then kill -9 `cat tmp/pids/private_pub.pid`; fi"
  end

  desc "Restart private_pub server"
  task :restart do
    stop
    start
  end
end

It is not ideal, but works for me.