I have play application, to make it easy to deploy on Debian, What are the ways to
Create a daemon out of the code, with a standard init.d script, the main problem here how to gracefully stop the application?
How can I compile the code as a fat jar, easy to maintain 1 single file compared to multiple files and directories (the standard way of deploying a Play app).
/etc/init.d/play.myplayapp
#! /bin/sh
### BEGIN INIT INFO
# Provides: play
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description:
# Description:
### END INIT INFO
APP="myplayapp"
APP_PATH="/opt/play/$APP"
start() {
$APP_PATH/start &
}
stop() {
kill `cat $APP_PATH/RUNNING_PID`
}
case "$1" in
start)
echo "Starting $APP"
start
echo "$APP started."
;;
stop)
echo "Stopping $APP"
stop
echo "$APP stopped."
;;
restart)
echo "Restarting $APP."
stop
sleep 2
start
echo "$APP restarted."
;;
*)
N=/etc/init.d/play.$APP
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
2. They don't really have a single file distribution of projects. The best you can do is running "play dist" to generate a distributable package. Even if it was distributed as a single file, it would probably be extracted to the file system at runtime just for efficiency (just how war files are handled).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With