spray-can fat jar as linux daemon/service

308 views
Skip to first unread message

Cristian Vrabie

unread,
Oct 19, 2013, 6:29:27 AM10/19/13
to spray...@googlegroups.com
Hi everybody,
I was wondering what is the preferred way of making fat spray-can/akka apps run as a service/daemon on a Linux server (Ubuntu in particular)? 
Do Scala/Spray apps play nice with jsvc? I couldn't find any discussion on the topic?
Thanks!
Cristian

@fedesilva

unread,
Oct 19, 2013, 8:25:12 PM10/19/13
to spray...@googlegroups.com

Njål Karevoll

unread,
Oct 29, 2013, 4:59:01 PM10/29/13
to spray...@googlegroups.com
I might be a little bit late with this reply, but yes, there's no special issues to take care of when using jsvc / commons-daemon with spray. Personally I've used sbt-assembly to put together an easily runnable jar and it has worked without any problems.

-Njal

Cristian Vrabie

unread,
Oct 29, 2013, 5:27:24 PM10/29/13
to spray...@googlegroups.com
Thanks Njal,

That is exactly what I used and so far it seems to be working great. Jsvc has a few nice advantages. One of them is that it monitors your service and it restarts it in case it crashes. Another one is that it hooks into your code and allows you to gracefully shut down the server on service stop. 

The only thing to keep in mind is that on some Linux systems allow only root to bind to ports 1-1024. Because jsvc downgrades your user from root before it gets the chance to bind to the desired port you might need to use something like authbind to launch your app if using a port in this range.

Cristian
--
You received this message because you are subscribed to a topic in the Google Groups "spray-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spray-user/o7GBoAgQvMo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spray-user+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages