Created
March 26, 2012 12:27
-
-
Save leon/2204773 to your computer and use it in GitHub Desktop.
Upstart script for Play Framework 2.0
This file contains 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
# Upstart script for a play application that binds to an unprivileged user. | |
# put this into a file like /etc/init/play.conf | |
# | |
# This could be the foundation for pushing play apps to the server using something like git-deploy | |
# By calling service play stop in the restart command and play-start in the restart command. | |
# | |
# Usage: | |
# start play | |
# stop play | |
# restart play | |
# | |
# WARNING: This is still beta, I have not tested the respawning functionality, but it should work. | |
# | |
# http://leon.radley.se | |
description "PlayFramework 2" | |
author "Leon Radley <[email protected]>" | |
version "1.0" | |
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 SBTMEM=256 | |
env EXTRA="-Xms128M -Xmx512m -server" | |
start on runlevel [2345] | |
stop on runlevel [06] | |
respawn | |
respawn limit 10 5 | |
umask 022 | |
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}/target/start --background --start -- -Dconfig.resource=$CONFIG -Dhttp.port=$PORT -Dhttp.address=$ADDRESS $EXTRA |
I tried to adapt this script for play 2.2.1, and I'll I'm getting is a hang,
i.e. "service play start " and "service play stop" both hang ... on ubuntu 12.04 ...
`env HOME=/play
env PORT=9000
env ADDRESS=127.0.0.1
env CONFIG=/play/application.conf
start on runlevel [2345]
stop on runlevel [06]
respawn
respawn limit 10 5
umask 022
expect daemon
expect fork
exec start-stop-daemon --pidfile ${HOME}/cogo-1.0/RUNNING_PID --exec ${HOME}/corgol-1.0/bin/corgol -- -mem 256 -Dconfig.file=$CONFIG -Dhttp.port=$PORT
`
I got it working for Play 2.2.1
https://gist.github.com/droidlabour/0d33e7d516013379ab42
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Love it, this script it awesome. Thank you.