flapjack / flapjack

Monitoring notification routing + event processing system. For issues with the Flapjack packages, please see https://github.com/flapjack/omnibus-flapjack/
http://flapjack.io
MIT License
639 stars 92 forks source link

Run with upstart #901

Open dnd opened 9 years ago

dnd commented 9 years ago

What's the recommended way to run Flapjack with Upstart? Using the regular init script that comes with Flapjack I find it periodically crashing. I have tried multiple forms of flapjack server start with the upstart script(exec, script, expect fork/daemon, etc...), but it usually just hangs and doesn't come back. The only thing that seems to work is just straight exec flapjack server start with no fork expectations, but then upstart just continually tries to start the server process. Any help would be appreciated.

ghost commented 9 years ago

server start in flapjack v1 is daemonized, you'd need to run it with --no-daemonize I think. (v2 just runs in the foreground, but not knowing much about this stuff I've used start-stop-daemon: e.g. https://github.com/flapjack/omnibus-flapjack/blob/master/dist/etc/init.d/v2/deb/flapjack )

If you do come up with working Upstart scripts, we can integrate them into the packages via https://github.com/flapjack/omnibus-flapjack/tree/master/dist/etc/init.d/ , either v1 or v2 or both.

ghost commented 9 years ago

If the crashes are logged, can you open separate issues for those?

dnd commented 9 years ago

I'm running 1.6, and I tried --no-daemonize. It works great running straight from the command line, but when run inside an upstart script it never starts. Issuing service flapjack start just hangs there and never returns.

dnd commented 9 years ago

It looks like I may have been running into a bug with upstart. I tried a workaround to rename the upstart file since I couldn't restart, and for now at least it appears to be working.

This is tentatively what I have

description "flapjack"

start on runlevel [2345]
stop on runlevel [016]

respawn

env PATH=/opt/flapjack/bin:$PATH

exec flapjack server start --no-daemonize
dnd commented 9 years ago

Also, just to make sure. Is it perfectly safe to run flapjack on multiple machines at the same time?

ghost commented 9 years ago

As long as they're pointing to the same Redis instance, yes. In the future it'd be nice to move to a more easily distributed data store, but for now that's the limiting factor.