/dir/to/myapp
Before going further run
play clean compile stage
to build the app production jar, then configure supervisord and monit like so
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:myplayapp] | |
; remove -Dconfig.file if necessary (play will use the default application.conf) | |
; change address and port if necessary or remove them to use the default values | |
command=java -Xms128M -Xmx512m -cp .:./lib/*:./target/staged/* -Dhttp.address=127.0.0.1 -Dhttp.port=9000 -Dconfig.file=./conf/application.prod.conf play.core.server.NettyServer . | |
: directory to the play framework app, where "myapp/" is the root | |
directory=/dir/to/myapp | |
process_name=myplayapp | |
autorestart=true | |
startsecs=10 | |
stopwaitsecs=10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check process myapp | |
with pidfile /dir/to/myapp/RUNNING_PID | |
start program = "/usr/bin/supervisorctl start myplayapp" | |
stop program = "/usr/bin/supervisorctl stop myplayapp" | |
if 10 restarts within 20 cycles | |
then timeout | |
if TOTALMEMORY > 2 GB for 4 cycles then restart |
NB: Out of the box Play! will create a RUNNING_PID file into myapp/ but of course you can change its location with -Dpidfile.path.