RejectedSoftware Forums

Sign up

Restarting a vibe.d app

If a have a vibe.d app behind an nginx reverse proxy on a linux server,
and want to restart the vibe.d app, what's the standard recommended way
to do that?

Also, (I suppose this is getting more nginx/linux though, but related)
am I correct in my understanding that the nginx reverse proxy will
not act as a watchdog and restart the vibe.d app if it exits or
crashes or otherwise just simply isn't running? If it indeed doesn't,
then what would be a good way to set such a thing up?

Or...should I just simply be looking up "how to setup an app as
a linux(debian) service"? Would that be the right way to go?

Re: Restarting a vibe.d app

On Tuesday, 28 August 2012 at 23:39:26 UTC, Nick Sabalausky wrote:

If a have a vibe.d app behind an nginx reverse proxy on a linux
server,
and want to restart the vibe.d app, what's the standard
recommended way
to do that?

Also, (I suppose this is getting more nginx/linux though, but
related)
am I correct in my understanding that the nginx reverse proxy
will
not act as a watchdog and restart the vibe.d app if it exits
or
crashes or otherwise just simply isn't running? If it indeed
doesn't,
then what would be a good way to set such a thing up?

Or...should I just simply be looking up "how to setup an app as
a linux(debian) service"? Would that be the right way to go?

I am no specialist here by any means, but as there are not really
a lot of people here, probably small hints will do some good.
But, please, don't trust me :)

nginx itself won't do anything, it has no idea of what backend is
other than URL to communicate. If it has crashed, appropriate
HTTP error from nginx will happen in most default cases.

Watchdog implementation itself is up to you. I have not seen
anything related to it in vibe sources so far ( in release at
least ). It can be separate small daemon monitor application or
embedded into main application itself via some forking/signal
processing magic - those are two main approaches I have met so
far. Linux services are called daemons and, afaik, are not
restarted automagically on crash unless you implement it yourself.

Re: Restarting a vibe.d app

On Wednesday, 29 August 2012 at 07:57:32 UTC, mist wrote:
(...)

Watchdog implementation itself is up to you. I have not seen
anything related to it in vibe sources so far ( in release at
least ).

(...)

It might be planned, but as a side note: Vibe even catches assert
errors, so your application mostly crashes on segfaults, so
hopefully it shouldn't be too often :)

Re: Restarting a vibe.d app

Am 29.08.2012 01:39, schrieb Nick Sabalausky:

If a have a vibe.d app behind an nginx reverse proxy on a linux server,
and want to restart the vibe.d app, what's the standard recommended way
to do that?

Also, (I suppose this is getting more nginx/linux though, but related)
am I correct in my understanding that the nginx reverse proxy will
not act as a watchdog and restart the vibe.d app if it exits or
crashes or otherwise just simply isn't running? If it indeed doesn't,
then what would be a good way to set such a thing up?

Or...should I just simply be looking up "how to setup an app as
a linux(debian) service"? Would that be the right way to go?

I'm taking a very ad-hoc approach right now, which is a background bash
script that uses 'netstat -lnp | grep $PORT' to check periodically if
the applicatin is still running and restarts it if necessary (*). Of
course, for a single server it would also be sufficient to just make an
endless loop that just starts the server.

My plan is to use vibedist for this eventually, which would then run as
a normal deamon and watches the server(s). But it still needs some work
and my priority list of things to do is currently well filled.

(*) The latest master version seems to run very stable though and as
already mentioned for everything except segfaults it is attempted to
keep the server running. Maybe segfaults could also be handled in the
future (it should be possible to just terminate the active fiber after
all).