Search code examples
ruby-on-railssidekiq

Rails: managing multiple sidekiqs without upstart script


Once upon a time, I had one app - Cashyy. It used sidekiq. I deployed it and used this upstart script to manage sidekiq (start/restart).

I decide to deploy another app to the same server. The app (let's call it Giimee) also uses sidekiq.

And here is the issue. Sometimes I need to restart sidekiq for Cashyy, but not for Giimee. Now, as I understand I will need to hack something using index thing (in upstart script and managing sidekiqs: sudo restart sidekiq index=1) (if I understood it correctly).

BUT!

I have zero desire to dabble with these indexes (nightmare to support? Like you need to know how many apps are using sidekiq and be sure to assign unique index to each sidekiq. And to know assigned index if you want to restart specific sidekiq).

So here is the question: how can I isolate each sidekiq (so I would not need to maintain the index) and still get the stability and usability of upstart (starting the process, restarting, etc.)?

Or maybe I don't understand something and the thing with index is state of art?


Solution

  • You create two services:

    cp sidekiq.conf /etc/init/cashyy.conf
    cp sidekiq.conf /etc/init/glimee.conf
    

    Edit each as necessary. sudo start cashyy, sudo stop glimee, etc. Now you'll have two completely separate Sidekiq processes running.