How to run Play! background jobs on Heroku

2020-03-27 03:36发布

问题:

I'm hardly using heroku for my Play! applications nowadays and I am new. I can deploy my web application but background jobs don't run. I tried to add worker but I got this error :

$ heroku scale worker=1
Scaling worker processes...  !   No such type as worker

I created a Procfile includes just

web: play run --http.port=$PORT $PLAY_OPTS

It's just for web, I couldn't find expressions to run workers. How can I run my background jobs on Heroku?

回答1:

You have to define the worker instead of web:

worker: play run --http.port=$PORT $PLAY_OPTS