I have a play 1.2.5 app running on heroku and I want to swap out all jobs into a worker dyno, so they don't scale with the web dynos.
To do that, I need to differentiate, if the application is running on a web or a worker dyno.
Is there any way to accomplish that by passing a command line argument using the procfile?
Currently I see, that by passing custom CLI arguments the JVM fails to be created...
Thanks you in advance!
Okay, I found it myself:
By adding a -D parameter to the procfile, I can determine the environment play is running in.
So my procfile's going to look like:
web: play run --http.port=$PORT $PLAY_OPTS
worker: play run --http.port=$PORT $PLAY_OPTS -Dprocesstype=worker
By using
System.getProperty("processtype");
I can ensure, that i am on a worker dyno and process my jobs only then.