service scripts

1,795 views
Skip to first unread message

Dick Davies

unread,
May 31, 2012, 4:47:33 AM5/31/12
to dropwiz...@googlegroups.com
Hi all

having a blast with Dropwizard so far - just wondered what
people could recommend to run dropwizard jars as services?

I know of Tanuki which I have working, but there's quite a lot
of boilerplate in there to essentially run 'java -jar foo.jar server conf.yaml'.

Ted Nyman

unread,
May 31, 2012, 4:55:09 AM5/31/12
to dropwiz...@googlegroups.com, dropwiz...@googlegroups.com
Either upstart, or just a good old fashioned init script (with start-stop-daemon, or the like). Used both mechanisms quite profitably with dropwizard for at least a year.

Christophe Furmaniak

unread,
Jun 30, 2012, 8:56:20 AM6/30/12
to dropwiz...@googlegroups.com
Hi,

how do you manage to shutdown the server in a clean way when it has been launched with an init script? I mean, is there a way to stop the server without Ctrl-C in a console or without killing the process?

Christophe

Christophe Furmaniak

unread,
Jun 30, 2012, 9:42:42 AM6/30/12
to dropwiz...@googlegroups.com
hm, kill -2 seems a good option

Andrew Ellerton

unread,
Jun 30, 2012, 5:40:56 PM6/30/12
to dropwiz...@googlegroups.com
We use daemontools (http://cr.yp.to/daemontools/svc.html) in production and QA environments.

That will run either a bash or ruby script (newer stuff on ruby) to set up the environment (classpath, logging, etc) and exec the JVM.

The standard UNIX way to shut down the service cleanly is plain old kill. It works nicely.

Christophe Furmaniak

unread,
Jul 1, 2012, 4:50:57 AM7/1/12
to dropwiz...@googlegroups.com
My concerns are not about which tool to use to manage dropwizard but more how to stop a dropwizard programmaticaly (but may be kill -2 is sufficient). This may be related to this thread : https://groups.google.com/d/topic/dropwizard-user/77GbHrgfLpk/discussion.

Coda Hale

unread,
Jul 2, 2012, 3:05:07 PM7/2/12
to dropwiz...@googlegroups.com
On UNIX, I'd suggest kill −2.

Dropwizard leaves process management up to the operating system. It doesn't have its own notion of signals.

Nick Telford

unread,
Jul 3, 2012, 5:45:54 AM7/3/12
to dropwiz...@googlegroups.com
Since posting that initial discussion, I've changed my mind on the matter.

Many organisations have different strategies for managing application lifecycles. Init scripts are one approach; Upstart, daemontools, Commons Daemon are others. We use God (https://github.com/mojombo/god/) a lot these days.

By not siding with any particular strategy, Dropwizard ensures it can integrate with just about any existing infrastructure.

--
Nick Telford


On Sunday, 1 July 2012 09:50:57 UTC+1, Christophe Furmaniak wrote:
My concerns are not about which tool to use to manage dropwizard but more how to stop a dropwizard programmaticaly (but may be kill -2 is sufficient). This may be related to this thread : https://groups.google.com/d/topic/dropwizard-user/77GbHrgfLpk/discussion.



Le samedi 30 juin 2012 23:40:56 UTC+2, Andrew a écrit :
We use daemontools (http://cr.yp.to/daemontools/svc.html) in production and QA environments.

That will run either a bash or ruby script (newer stuff on ruby) to set up the environment (classpath, logging, etc) and exec the JVM.

The standard UNIX way to shut down the service cleanly is plain old kill. It works nicely.

snoopy woodstock

unread,
Nov 24, 2012, 1:01:35 AM11/24/12
to dropwiz...@googlegroups.com
Nick, I don't disagree, but felt that it should still be an option for those that need it to easily choose it:

https://github.com/codahale/dropwizard/pull/220

Hopefully, the pull request is accepted.


On Tuesday, July 3, 2012 3:45:54 AM UTC-6, Nick Telford wrote:
Since posting that initial discussion, I've changed my mind on the matter.

Many organisations have different strategies for managing application lifecycles. Init scripts are one approach; Upstart, daemontools, Commons Daemon are others. We use God (https://github.com/mojombo/god/) a lot these days.

By not siding with any particular strategy, Dropwizard ensures it can integrate with just about any existing infrastructure.

--
Nick Telford

On Sunday, 1 July 2012 09:50:57 UTC+1, Christophe Furmaniak wrote:
My concerns are not about which tool to use to manage dropwizard but more how to stop a dropwizard programmaticaly (but may be kill -2 is sufficient). This may be related to this thread : https://groups.google.com/d/topic/dropwizard-user/77GbHrgfLpk/discussion.



Le samedi 30 juin 2012 23:40:56 UTC+2, Andrew a écrit :
We use daemontools (http://cr.yp.to/daemontools/svc.html) in production and QA environments.

That will run either a bash or ruby script (newer stuff on ruby) to set up the environment (classpath, logging, etc) and exec the JVM.

The standard UNIX way to shut down the service cleanly is plain old kill. It works nicely.

Coda Hale

unread,
Nov 25, 2012, 12:34:19 AM11/25/12
to dropwiz...@googlegroups.com
No, I'm still sticking with SIGTERM. It's a portable POSIX-compliant method with an existing, defined, known security model and operational affordances.

If you'd like something else, ServerLifecycleListener in 0.6.0-SNAPSHOT should allow you to build that without requiring changes in dropwizard-core.


---
Coda Hale
http://codahale.com



Reply all
Reply to author
Forward
Message has been deleted
0 new messages