Play framework 2.2 using Upstart 1.5 (Ubuntu 12.04)

Posted by Leon Radley on Server Fault See other posts from Server Fault or by Leon Radley
Published on 2013-11-08T14:58:27Z Indexed on 2013/11/08 15:58 UTC
Read the original article Hit count: 259

Filed under:
|
|

I'm trying to get Play 2.2 working with upstart. I've been running Play 2.x with upstart since it's release and it's never been a problem. But since the release of 2.2 and the change to http://www.scala-sbt.org/sbt-native-packager/ play doesn't want to start any more.

Here's the config I'm using

description "PlayFramework 2.2"
version "2.2"

env APP=myapp
env USER=myuser
env GROUP=www-data
env HOME=/home/myuser/app
env PORT=9000
env ADDRESS=127.0.0.1
env CONFIG=production.conf
env JAVAOPTS="-J-Xms128M -J-Xmx512m -J-server"

start on runlevel [2345]
stop on runlevel [06]

respawn
respawn limit 10 5
expect daemon

# If you want the upstart script to build play with sbt
pre-start script
    chdir $HOME
    sbt clean compile stage -mem $SBTMEM
end script

exec start-stop-daemon --pidfile ${HOME}/RUNNING_PID --chuid $USER:$GROUP --exec ${HOME}/bin/${APP} --background --start -- -Dconfig.resource=$CONFIG -Dhttp.address=$ADDRESS -Dhttp.port=$PORT $JAVAOPTS

I've changed the JAVAOPTS to include the -J- and I've also changed the path to use the new startscript located in the /bin/ dir.

I've read that upstart > 1.4 has setuid and setguid. I've tried removing the start-stop-daemon but I haven't got that working either.

Any suggestions would be appreciated.

© Server Fault or respective owner

Related posts about ubuntu

Related posts about ubuntu-12.04