ruby on rails - Using Sidekiq with Unicorn on non-managed server -
i have setup custom environment rails application on linux vm server, using nginx, unicorn, , capistrano. have stage based customized capistrano scripts installing unicorn service , reloading on each deployment.
now, using sidekiq background jobs. i'm using capistrano-sidekiq gem automatic worker restarting. problem is; doesn't work (i.e. not starts automatically unicorn) if server/vm restarted. i'm considering make service did unicorn, check running worker , re-spawn new one. complex if want spawn multiple worker processes because i'll have track pids of them (capistrano-sidekiq takes care of this).
so, need guidance how accomplish smartest solution, , if there other way or gem that. googling results many results mentioning solutions heroku , other managed rails servers. i'm amazed why less people using sidekiq on custom servers.
usually monitoring tool used purpose. 1 such tool god.
the basic idea run god
system service, , configure sidekiq
watched god. when server restarts, god runs service , start sidekiq
workers.
you have more benefits using god, name few:
- notifications: can configure send notifications when sidekiq worker dies , gets restarted.
- resource monitoring: can configure take actions based on predefined rules. example, restart job when consumes memory.
update: read article morning might helpful: create, run , manage ruby background processes upstart.
Comments
Post a Comment