mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Fix celery behavior
This commit is contained in:
parent
9cf6fd0e89
commit
08bd696434
9 changed files with 20 additions and 36 deletions
|
@ -4,9 +4,6 @@ CELERYD_NODES="w1"
|
|||
# or we could have three nodes:
|
||||
#CELERYD_NODES="w1 w2 w3"
|
||||
|
||||
# Absolute or relative path to the 'celery' command:
|
||||
CELERY_BIN="/usr/bin/celery"
|
||||
|
||||
# App instance to use
|
||||
# comment out this line if you don't use an app
|
||||
CELERY_APP="weblate"
|
||||
|
@ -20,8 +17,8 @@ CELERYD_OPTS="--beat"
|
|||
# - %n will be replaced with the first part of the nodename.
|
||||
# - %I will be replaced with the current child process index
|
||||
# and is important when using the prefork pool to avoid race conditions.
|
||||
CELERYD_PID_FILE="/var/run/celery-__APP__/weblate-%n.pid"
|
||||
CELERYD_LOG_FILE="/var/log/uwsgi/app/__APP__-celery-%n%I.log"
|
||||
CELERYD_PID_FILE="/var/run/__APP__-celery/weblate-%n.pid"
|
||||
CELERYD_LOG_FILE="/var/log/__APP__-celery/celery-%n%I.log"
|
||||
CELERYD_LOG_LEVEL="INFO"
|
||||
|
||||
CELERY_WORKER_RUNNING="1"
|
|
@ -8,16 +8,19 @@ User=__APP__
|
|||
Group=__APP__
|
||||
PermissionsStartOnly=true
|
||||
EnvironmentFile=__FINALPATH__/celery-weblate
|
||||
Environment=PATH=__FINALPATH__/venv/bin:$PATH
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \
|
||||
ExecStartPre=/bin/mkdir -p /var/run/__APP__-celery
|
||||
ExecStartPre=/bin/chown -R __APP__ /var/run/__APP__-celery
|
||||
ExecStartPre=/bin/mkdir -p /var/log/__APP__-celery
|
||||
ExecStartPre=/bin/chown -R __APP__ /var/log/__APP__-celery
|
||||
ExecStart=__FINALPATH__/venv/bin/celery multi start ${CELERYD_NODES} \
|
||||
-A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
|
||||
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
|
||||
ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \
|
||||
--pidfile=${CELERYD_PID_FILE}'
|
||||
ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} \
|
||||
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}
|
||||
ExecStop=__FINALPATH__/venv/bin/celery multi stopwait ${CELERYD_NODES} \
|
||||
--pidfile=${CELERYD_PID_FILE}
|
||||
ExecReload=__FINALPATH__/venv/bin/celery multi restart ${CELERYD_NODES} \
|
||||
-A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
|
||||
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
|
||||
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -716,7 +716,7 @@ ALLOWED_HOSTS = ['__DOMAIN__']
|
|||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django_redis.cache.RedisCache',
|
||||
'LOCATION': 'redis://127.0.0.1:6379/_REDIS_DB__',
|
||||
'LOCATION': 'redis://127.0.0.1:6379/__REDIS_DB__',
|
||||
'OPTIONS': {
|
||||
'CLIENT_CLASS': 'django_redis.client.DefaultClient',
|
||||
'PARSER_CLASS': 'redis.connection.HiredisParser',
|
||||
|
@ -814,7 +814,7 @@ REST_FRAMEWORK = {
|
|||
# CELERY_BROKER_URL = 'memory://'
|
||||
# Celery worker configuration for production
|
||||
CELERY_TASK_ALWAYS_EAGER = False
|
||||
CELERY_BROKER_URL = 'redis://localhost:6379/__REDIS_DB__'
|
||||
CELERY_BROKER_URL = 'redis://127.0.0.1:6379/__REDIS_DB__'
|
||||
|
||||
# Celery settings, it is not recommended to change these
|
||||
CELERY_WORKER_PREFETCH_MULTIPLIER = 0
|
|
@ -8,7 +8,7 @@
|
|||
"description": {
|
||||
"en": "A translation platform using Git and Python"
|
||||
},
|
||||
"version": "3.2~ynh1",
|
||||
"version": "3.2.2~ynh1",
|
||||
"url": "https://weblate.org",
|
||||
"license": "AGPL-3.0",
|
||||
"maintainer": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
current_version="3.2"
|
||||
current_version="3.2.2"
|
||||
|
||||
ynh_check_global_uwsgi_config () {
|
||||
uwsgi --version || ynh_die "You need to add uwsgi (and appropriate plugin) as a dependency"
|
||||
|
|
|
@ -56,12 +56,6 @@ ynh_backup "db.sql"
|
|||
|
||||
ynh_backup "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE CRON FILE
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/usr/lib/tmpfiles.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE uwsgi files
|
||||
#=================================================
|
||||
|
|
|
@ -257,10 +257,8 @@ ynh_store_file_checksum "$final_path/venv/lib/python3.5/site-packages/weblate/se
|
|||
celeryconf="$final_path/celery-weblate"
|
||||
cp ../conf/celery-weblate "$celeryconf"
|
||||
|
||||
ynh_replace_string "__APP__" "$app" "$celeryconf"
|
||||
|
||||
echo "d /var/run/celery-$app 0775 $app $app" > "/usr/lib/tmpfiles.d/$app.conf"
|
||||
systemd-tmpfiles --create
|
||||
ynh_replace_string "__APP__" "$app" "$celeryconf"
|
||||
ynh_replace_string "__FINALPATH__" "$final_path" "$celeryconf"
|
||||
|
||||
ynh_add_systemd_config "$app-celery" "celery-weblate.service"
|
||||
|
||||
|
|
|
@ -62,11 +62,10 @@ ynh_remove_nginx_config
|
|||
ynh_secure_remove "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# REMOVE TMPFILES.D
|
||||
# REMOVE CELERY FILES
|
||||
#=================================================
|
||||
|
||||
ynh_secure_remove "/var/run/celery-$app"
|
||||
ynh_secure_remove "/usr/lib/tmpfiles.d/$app.conf"
|
||||
ynh_secure_remove "/var/run/$app-celery"
|
||||
|
||||
#=================================================
|
||||
# REMOVE uwsgi and systemd files
|
||||
|
|
|
@ -123,13 +123,6 @@ yunohost service add "uwsgi-app@$app.service" --log "/var/log/uwsgi/app/$app"
|
|||
|
||||
ynh_restore_file "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE TMPFILES.D
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/usr/lib/tmpfiles.d/$app.conf"
|
||||
systemd-tmpfiles --create
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE HUB BINARY FILE
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue