From 68c0fe7d1edc55a864c0bd392cedbd98e0ea2f37 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 10 Nov 2023 19:15:25 +0100 Subject: [PATCH] fix logs --- conf/bookwyrm-beat.service | 2 ++ conf/bookwyrm-server.service | 3 ++- conf/bookwyrm-worker.service | 2 ++ scripts/install | 8 +++++--- scripts/remove | 6 +++--- scripts/restore | 6 +++--- scripts/upgrade | 6 +++--- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/conf/bookwyrm-beat.service b/conf/bookwyrm-beat.service index 71e574f..72f6947 100644 --- a/conf/bookwyrm-beat.service +++ b/conf/bookwyrm-beat.service @@ -10,6 +10,8 @@ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ EnvironmentFile=__INSTALL_DIR__/.env ExecStart=__INSTALL_DIR__/venv/bin/celery -A celerywyrm beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler +StandardOutput=append:/var/log/__APP__/__APP__-beat.log +StandardError=inherit NoNewPrivileges=yes PrivateTmp=yes diff --git a/conf/bookwyrm-server.service b/conf/bookwyrm-server.service index a09a60d..c0b2907 100644 --- a/conf/bookwyrm-server.service +++ b/conf/bookwyrm-server.service @@ -9,7 +9,8 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ EnvironmentFile=__INSTALL_DIR__/.env -ExecStart=__INSTALL_DIR__/venv/bin/gunicorn bookwyrm.wsgi:application --bind 127.0.0.1:__PORT__ --error-logfile /var/log/__APP__/__APP__.log +ExecStart=__INSTALL_DIR__/venv/bin/gunicorn bookwyrm.wsgi:application --bind 127.0.0.1:__PORT__ +StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit [Install] diff --git a/conf/bookwyrm-worker.service b/conf/bookwyrm-worker.service index 410d418..f2a5f04 100644 --- a/conf/bookwyrm-worker.service +++ b/conf/bookwyrm-worker.service @@ -10,6 +10,8 @@ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ EnvironmentFile=__INSTALL_DIR__/.env ExecStart=__INSTALL_DIR__/venv/bin/celery -A celerywyrm worker -l info -Q high_priority,medium_priority,low_priority,imports +StandardOutput=append:/var/log/__APP__/__APP__-worker.log +StandardError=inherit NoNewPrivileges=yes PrivateTmp=yes diff --git a/scripts/install b/scripts/install index 229819d..2be83bd 100755 --- a/scripts/install +++ b/scripts/install @@ -66,6 +66,8 @@ ynh_script_progression --message="Configuring logrotate..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate --specific_user=$app touch /var/log/$app/$app.log +touch /var/log/$app/$app-beat.log +touch /var/log/$app/$app-worker.log chown -R $app:www-data /var/log/$app/ #================================================= @@ -87,9 +89,9 @@ ynh_add_systemd_config --service="bookwyrm-beat" --template="bookwyrm-beat.ser #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add "bookwyrm-beat" -yunohost service add "bookwyrm-server" -yunohost service add "bookwyrm-worker" +yunohost service add "bookwyrm-beat" --log="/var/log/$app/$app-beat.log" +yunohost service add "bookwyrm-server" --log="/var/log/$app/$app.log" +yunohost service add "bookwyrm-worker" --log="/var/log/$app/$app-worker.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index f8e2885..2618d60 100644 --- a/scripts/remove +++ b/scripts/remove @@ -33,9 +33,9 @@ ynh_systemd_action --service_name="bookwyrm-server" --action="stop" --log_path=" ynh_systemd_action --service_name="bookwyrm-worker" --action="stop" --log_path="systemd" --line_match="Stopped $app" # Remove the dedicated systemd config -ynh_remove_systemd_config --service="bookwyrm-beat" -ynh_remove_systemd_config --service="bookwyrm-server" -ynh_remove_systemd_config --service="bookwyrm-worker" +ynh_remove_systemd_config --service="bookwyrm-beat" --log="/var/log/$app/$app-beat.log" +ynh_remove_systemd_config --service="bookwyrm-server" --log="/var/log/$app/$app.log" +ynh_remove_systemd_config --service="bookwyrm-worker" --log="/var/log/$app/$app-worker.log" ynh_secure_remove --file="/etc/systemd/system/bookwyrm.target" diff --git a/scripts/restore b/scripts/restore index a0a0fba..0baaefc 100644 --- a/scripts/restore +++ b/scripts/restore @@ -58,9 +58,9 @@ systemctl enable "bookwyrm-worker.service" --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add "bookwyrm-beat" -yunohost service add "bookwyrm-server" -yunohost service add "bookwyrm-worker" +yunohost service add "bookwyrm-beat" --log="/var/log/$app/$app-beat.log" +yunohost service add "bookwyrm-server" --log="/var/log/$app/$app.log" +yunohost service add "bookwyrm-worker" --log="/var/log/$app/$app-worker.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 654ca3e..6109662 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,9 +103,9 @@ ynh_add_systemd_config --service="bookwyrm-beat" --template="bookwyrm-beat.ser #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add "bookwyrm-beat" -yunohost service add "bookwyrm-server" -yunohost service add "bookwyrm-worker" +yunohost service add "bookwyrm-beat" --log="/var/log/$app/$app-beat.log" +yunohost service add "bookwyrm-server" --log="/var/log/$app/$app.log" +yunohost service add "bookwyrm-worker" --log="/var/log/$app/$app-worker.log" #================================================= # START SYSTEMD SERVICE