We have been deploying Play/Scala application on our UNIX server by just running the executable, something like
java_opts="-Xms128M -Xmx512M" ./bin/myProject -Dconfig.file=/path/to/my/confFile.conf -Dhttp.port=9022 &
and it works fine. However, for my NodeJS applications I use pm2 and I really appreciate its ease of use as well as monitoring options and hence would like to use it for the other apps too.
This thread claims it is possible to run JARs. Any idea on how to adapt the conf (see below) for it to work with my Play/scala apps and if it is possible at all?
Running a Jar with pm2:
{
"apps": [{
"name": "JavaAgent",
"cwd": "/usr/bin",
"args": [
"-Xmx256m",
"-cp",
"/app/somedirectorywhereagentresides:/some/directory/where/your/classes/lives",
"your.main.class"
],
"env": {
"ANY_ENV_VARIABLE": "that you might need in your program"
},
"script": "java",
"node_args": [],
"log_date_format": "YYYY-MM-DD HH:mm Z",
"exec_interpreter": "none",
"exec_mode": "fork"
}
]
}