I have two separate applications running on heroku and pointing to same database, first one responsible for user interface
and second one for admin interface
, I am using sidekiq
with redis
for background job processing, I have added one worker and I am able to share 'redis-server' by setting environment variable pointing to same Redis providing Addon, Now i wish to share worker too, because adding the extra worker will cost double.
Please suggest, whether this is even possible or not?
When you set an app to public, you make that App accessible to your company users to launch using their Heroku credentials. The Deploy Public Site link on top of the dashboard allows you to deploy a public site.
That is, log into heroku, go to your app's Resources page, and drag the "Worker Dynos" slider to zero, then save the changes via the "Save and Apply" button on the top-right.
If both apps are using the same Redis URL and same namespace, you can spin up one worker with that same Redis config and it will be shared by both.
Note that your Sidekiq process will boot one app or the other. The code for your Workers must be in that app. The other app won't be able to reference the code but can push jobs using:
Sidekiq::Client.push('class' => 'SomeWorker', 'args' => [1,2,3])
Note that 'class' is a String so SomeWorker can actually be defined in the other app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With