on master help sign in
add monit/ logic to attempt restarting processes
commit99534120e5dea00e1196866549a66246d07d773b authorEvan Czaplicki <evancz@users.noreply.github.com> dateWed 30 Oct 2019, 17:27 (7 years ago) parent5e4d115
3 files changed+36
worker/monit/start.sh+5 worker/monit/stop.sh+3 worker/monit/worker.conf+28
worker/monit/start.shnew file+5
@@ -0,0 +1,5 @@
1+#!/bin/bash
2+
3+cd /home/USER/compiler/worker/
4+./dist-newstyle/build/x86_64-linux/ghc-8.6.3/elm-0.19.1/x/worker/build/worker/worker &
5+echo $! > worker.pid
worker/monit/stop.shnew file+3
@@ -0,0 +1,3 @@
1+#!/bin/bash
2+
3+kill `cat /home/USER/compiler/worker/worker.pid`
worker/monit/worker.confnew file+28
@@ -0,0 +1,28 @@
1+# Monit is configured via /etc/monit/monitrc and /etc/monit/conf-enabled/*
2+#
3+# Setup:
4+#
5+# Replace USER in all the monit/* files
6+# Move start.sh and stop.sh out of monit/
7+# Copy this file to /etc/monit/conf-enabled/worker
8+#
9+# Useful commands:
10+#
11+# monit status # see currently running things
12+# monit restart elm-worker # restart the Haskell server
13+#
14+# monit # start monit
15+# monit quit # quit monit
16+#
17+
18+
19+check process nginx with pidfile /var/run/nginx.pid
20+ start program = "systemctl start nginx"
21+ stop program = "systemctl stop nginx"
22+ if failed host worker.elm-lang.org port 443 protocol https and request "/" then restart
23+
24+
25+check process elm-worker with pidfile /home/USER/compiler/worker/worker.pid
26+ start program = "/home/USER/compiler/worker/start.sh" with timeout 60 seconds
27+ stop program = "/home/USER/compiler/worker/stop.sh"
28+ if failed host localhost port 8000 protocol http and request "/" then restart