Here are steps to deploy Play Framework to Ubuntu as services :
1. Stage
1 | activator stage |
2. Setup services in /etc/init.d/your-play
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/bin/sh ### BEGIN INIT INFO # Provides: mdm # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop mdm ### END INIT INFO # #source some script files in order to set and export environmental variables #as well as add the appropriate executables to $PATH PLAYFRAMEWORK_HOME=’PATH-TO-STAGE-FOLDER’ export PIDFILE=’PATH-TO-PID’ USER=root GROUP=nogroup case "$1" in start) echo "Starting mdm" START_CMD="${PLAYFRAMEWORK_HOME}/bin/playstartapp -Dparam1=value1" start-stop-daemon –start -p "${PIDFILE}" –quiet –background –chuid ${USER}:${GROUP} –exec /bin/bash — ${START_CMD} ;; stop) echo "Stopping mdm" start-stop-daemon -K -p "${PIDFILE}" -u "${USER}" -R 30 ;; *) echo "Usage: /etc/init.d/mdm {start|stop}" exit 1 ;; esac exit 0 |
Just replace PATH-TO-FOLDER and PATH-TO-PID, to your project path