diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-02 17:47:10 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:23:20 +0100 |
commit | dc850e386f19d97d80efd77302425433a204d08b (patch) | |
tree | 4b33f1b6fa495c8b5c9fb9441aee138b2a6f8251 | |
parent | 160ad56539be0a2e27b8ae1ec5575c9f7762b798 (diff) | |
download | Ishtar-dc850e386f19d97d80efd77302425433a204d08b.tar.bz2 Ishtar-dc850e386f19d97d80efd77302425433a204d08b.zip |
Use supervisor instead of systemd script for celery daemon
-rw-r--r-- | CHANGES.md | 11 | ||||
-rwxr-xr-x | install/ishtar-prepare-instance | 21 | ||||
-rw-r--r-- | install/monit.template | 6 | ||||
-rw-r--r-- | install/supervisor.template | 10 | ||||
-rw-r--r-- | ishtar_common/version.py | 4 |
5 files changed, 37 insertions, 15 deletions
diff --git a/CHANGES.md b/CHANGES.md index 0e43d855b..82eb4fcf7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,17 @@ --- title: Ishtar changelog -date: 2022-11-29 +date: 2022-12-02 --- + +v4.0.30 - 2022-12-02 +-------------------- + +### Improvements ### +- Use supervisor instead of systemd script for celery daemon +- Forms: minor template fix + + v4.0.29 - 2022-11-29 -------------------- diff --git a/install/ishtar-prepare-instance b/install/ishtar-prepare-instance index c47881bad..f176d8f90 100755 --- a/install/ishtar-prepare-instance +++ b/install/ishtar-prepare-instance @@ -260,14 +260,14 @@ EOF /usr/sbin/rabbitmqctl set_permissions -p /ishtar$INSTANCE ishtar$INSTANCE ".*" ".*" ".*" CELERY_CONF="CELERY_BROKER_URL = 'amqp://ishtar"$INSTANCE":"$RBMQ_PASSWORD"@localhost//ishtar"$INSTANCE"'" CELERY_BIN_PATH=`which celery` - sed -s "s|#APP_NAME#|$INSTANCE|g;\ - s|#CELERY_BIN_PATH#|$CELERY_BIN_PATH|g;" \ - "install/celeryd.default.template" > \ - "/etc/default/celeryd-"$INSTANCE + + # supervisor conf no matter what + mkdir -p /etc/supervisor/conf.d/ sed -s "s|#APP_NAME#|$INSTANCE|g;\ s|#INSTALL_PATH#|$INSTALL_PATH|g;"\ - "install/celery.service.template" > \ - "/etc/systemd/system/celery-"$INSTANCE".service" + "install/supervisor.template" > \ + "/etc/supervisor/conf.d/celery_"$INSTANCE".conf" + sed -s "s|example_project|$INSTANCE|g;" \ $INSTANCE"/celery_app.py.sample" > \ $INSTANCE"/celery_app.py" @@ -276,7 +276,7 @@ EOF "install/monit.template" > \ "/etc/monit/conf-available/celery-"$INSTANCE fi - systemctl daemon-reload + fi ### __init__.py @@ -386,8 +386,11 @@ EOF ### Celery - start worker if [ $USE_CELERY = 'yes' ]; then - systemctl enable celery-$INSTANCE - systemctl start celery-$INSTANCE + SUPERVISOR=`which supervisorctl` + if [ $SUPERVISOR ]; then + supervisorctl add celery_$INSTANCE + supervisorctl start celery_$INSTANCE + fi fi cecho y " - create superuser" diff --git a/install/monit.template b/install/monit.template index a791927f5..9386b2688 100644 --- a/install/monit.template +++ b/install/monit.template @@ -1,5 +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#" +check program celery-#APP_NAME# with path "/usr/bin/supervisorctl status celery_#APP_NAME# | grep RUNNING" + start program "/usr/bin/supervisorctl start celery_#APP_NAME#" + stop program "/usr/bin/supervisorctl stop celery_#APP_NAME#" if status != 0 then restart if 5 restarts within 5 cycles then timeout diff --git a/install/supervisor.template b/install/supervisor.template new file mode 100644 index 000000000..99bfe8e34 --- /dev/null +++ b/install/supervisor.template @@ -0,0 +1,10 @@ +[program:celery_#APP_NAME#] +command=/usr/bin/celery -A #APP_NAME# worker --loglevel=INFO -c 6 +directory=#INSTALL_PATH# +user=www-data +autostart=true +autorestart=true +stdout_logfile=/var/log/celery/#APP_NAME#.log +redirect_stderr=true +stopasgroup=true + diff --git a/ishtar_common/version.py b/ishtar_common/version.py index bd12e8394..2319f5e97 100644 --- a/ishtar_common/version.py +++ b/ishtar_common/version.py @@ -1,5 +1,5 @@ -# 4.0.29 -VERSION = (4, 0, 29) +# 4.0.30 +VERSION = (4, 0, 30) def get_version(): |