What the preferred way is to deploy Scala applications on a remote Linux server.

This is a fairly simple, but limited, way of deploying a Scala app on a remote server (nice for quick testing of not-so-sensitive projects):

  1. From the remote server I pull my source from git
  2. Using the sbt-assembly plug-in I build a jar on the server
  3. I then run the Scala application using nohup, which allows you to exit the remote session without terminating the process:

    nohup java -jar myapp.jar > myapp.log 2> myapp.err < /dev/null &

Firstly, what is the best way to stop the process once it is running, considering it's using resources such as databases etc. Do I just lookup the java process id and nuke it?

Secondly, what is the best way to start a java application automatically on restart. I recall using init.d in the past, but remember getting some uphill since it was a java application.

Update:

I missed the elephant in the room here. I'm using the Spray library, which in turns uses Akka, so that provides a number of interesting options.

Edit
Report