Heroku Deployment
fdietz opened this issue · 2 comments
First of all, thank you for this awesome library!
I'm currently running my Phoenix app on Heroku and looking into using rihanna. I'd love to get some feedback on your experience/insights in running on Heroku.
For example: What happens when scaling to multiple dynos? And can the task processing be moved to a "worker" instead of a "web" dyno?
Thank you so much in advance!
Hi @fdietz thank you for opening an issue!
I have not run Rihanna on Heroku, but it is designed to be simple enough to do so without installing any additional services.
Rihanna will run jobs wherever a dispatcher is started. So if you start a Rihanna.JobDispatcher
in your main app supervision tree, it will consume and execute jobs wherever that app is run.
You could easily separate "worker" and "web" dynos by adding the Rihanna.JobDispatcher
to the supervision tree only in your "worker". The "web" dyno will still be able to enqueue jobs as long as it starts the Rihanna Postgres connection, which you can do with by adding the following to the supervision tree of your "web" worker:
# lib/my_app.ex
db_config = Your.Repo.config()
|> Keyword.put(:name, Rihanna.Job.Postgrex)
children = [
# ... other children
%{
id: Rihanna.Job.Postgrex,
start: {Postgrex, :start_link, [db_config]}
}
]
Thank you for the quick responsive! I'll give this approach a try and report back on my findings!