From 25d4879815125aab2e80dbc75ce1ba1deb2106c6 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 22 Jul 2019 17:15:16 +0200 Subject: Monit template for celery --- install/ishtar-install | 1 + install/ishtar-prepare-instance | 20 ++++++++++++++++++++ install/monit.template | 5 +++++ 3 files changed, 26 insertions(+) create mode 100644 install/monit.template diff --git a/install/ishtar-install b/install/ishtar-install index 050e340a8..97e1b02c6 100755 --- a/install/ishtar-install +++ b/install/ishtar-install @@ -492,6 +492,7 @@ EOF mkdir -p /var/log/celery/ mkdir -p /var/run/celery/ chown www-data:www-data /var/log/celery/ /var/run/celery/ + mkdir -p /etc/monit/conf-available/ fi echo "-------------------------------------------------------------------------------"; diff --git a/install/ishtar-prepare-instance b/install/ishtar-prepare-instance index bd235d5a2..59aa2f0e2 100755 --- a/install/ishtar-prepare-instance +++ b/install/ishtar-prepare-instance @@ -279,6 +279,9 @@ EOF sed -s "s|example_project|$INSTANCE|g;" \ $INSTANCE"/celery_app.py.sample" > \ $INSTANCE"/celery_app.py" + sed -s "s|#APP_NAME#|$INSTANCE|g;" \ + "install/monit.template" > \ + "/etc/monit/conf-available/celery-"$INSTANCE systemctl daemon-reload fi @@ -411,6 +414,23 @@ EOF echo "" echo " And then enjoy ishtar!" echo "" + + if [ -v USE_CELERY ]; then + cat >&2 <<-'EOF' + + If you use monit a configuration file has been generated for the celery + daemon: +EOF + cecho g "/etc/monit/conf-available/celery-"$INSTANCE + cat >&2 <<-'EOF' + + To activate it: +EOF + cecho y "ln -s /etc/monit/conf-available/celery-"$INSTANCE" \\" + cecho y " /etc/monit/conf-enabled/celery-"$INSTANCE + cecho y "systemctl restart monit" + fi + } do_install_instance diff --git a/install/monit.template b/install/monit.template new file mode 100644 index 000000000..a791927f5 --- /dev/null +++ b/install/monit.template @@ -0,0 +1,5 @@ +check program celery-#APP_NAME# with path "/bin/systemctl --quiet is-active celery-#APP_NAME#" + start program "/bin/systemctl --quiet start celery-#APP_NAME#" + stop program "/bin/systemctl --quiet stop celery-#APP_NAME#" + if status != 0 then restart + if 5 restarts within 5 cycles then timeout -- cgit v1.2.3