From 0f66f8c7ba9c46c169fe1e159e4ec2f284ea4c7b Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 6 Nov 2023 21:04:32 +0100 Subject: [PATCH 01/31] adjust email for Yunohost >11.2 --- conf/.env.production | 6 +++--- manifest.toml | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/conf/.env.production b/conf/.env.production index c05bcbf..1678b60 100644 --- a/conf/.env.production +++ b/conf/.env.production @@ -47,11 +47,11 @@ FLOWER_PASSWORD=changeme # Email config EMAIL_HOST=localhost EMAIL_PORT=587 -EMAIL_HOST_USER=__ADMIN_MAIL__ -EMAIL_HOST_PASSWORD= +EMAIL_HOST_USER=__APP__ +EMAIL_HOST_PASSWORD=__MAIL_PWD__ EMAIL_USE_TLS=true EMAIL_USE_SSL=false -EMAIL_SENDER_NAME=__ADMIN_MAIL__ +EMAIL_SENDER_NAME==__APP__@__DOMAIN__ # defaults to DOMAIN #EMAIL_SENDER_DOMAIN= diff --git a/manifest.toml b/manifest.toml index 3962534..0daced5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -57,6 +57,7 @@ ram.runtime = "50M" [resources.system_user] + allow_email = true [resources.install_dir] From a240657baac1bfff5c66b2508b0edc98898cb942 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 8 Nov 2023 13:41:57 +0100 Subject: [PATCH 02/31] allow multi_instance? --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 3962534..8ef0fda 100644 --- a/manifest.toml +++ b/manifest.toml @@ -21,7 +21,7 @@ fund = ["https://patreon.com/bookwyrm", "https://opencollective.com/bookwyrm"] [integration] yunohost = ">= 11.2" architectures = "all" -multi_instance = false +multi_instance = true ldap = false sso = false disk = "50M" From a1c38e5fdb15c0caf4c3adf1a20dbf333b1aee2d Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:14:54 +0100 Subject: [PATCH 03/31] Fix multi_instance services --- scripts/backup | 8 ++++---- scripts/install | 20 ++++++++++---------- scripts/remove | 14 +++++++------- scripts/restore | 26 +++++++++++++------------- scripts/upgrade | 26 +++++++++++++------------- 5 files changed, 47 insertions(+), 47 deletions(-) diff --git a/scripts/backup b/scripts/backup index 5d28395..e7c53ce 100755 --- a/scripts/backup +++ b/scripts/backup @@ -31,10 +31,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/etc/systemd/system/${app}-beat.service" -ynh_backup --src_path="/etc/systemd/system/${app}-server.service" -ynh_backup --src_path="/etc/systemd/system/${app}-worker.service" -ynh_backup --src_path="/etc/systemd/system/$app.target" +ynh_backup --src_path="/etc/systemd/system/bookwyrm-beat.service" +ynh_backup --src_path="/etc/systemd/system/bookwyrm-server.service" +ynh_backup --src_path="/etc/systemd/system/bookwyrm-worker.service" +ynh_backup --src_path="/etc/systemd/system/bookwyrm.target" #================================================= # BACKUP THE POSTGRESQL DATABASE diff --git a/scripts/install b/scripts/install index 873e4e8..b068190 100755 --- a/scripts/install +++ b/scripts/install @@ -63,12 +63,12 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_add_config --template="../conf/${app}.target" --destination="/etc/systemd/system/$app.target" +ynh_add_config --template="../conf/bookwyrm.target" --destination="/etc/systemd/system/bookwyrm.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="${app}-server" --template="${app}-server.service" -ynh_add_systemd_config --service="${app}-worker" --template="${app}-worker.service" -ynh_add_systemd_config --service="${app}-beat" --template="${app}-beat.service" +ynh_add_systemd_config --service="bookwyrm-server" --template="bookwyrm-server.service" +ynh_add_systemd_config --service="bookwyrm-worker" --template="bookwyrm-worker.service" +ynh_add_systemd_config --service="bookwyrm-beat" --template="bookwyrm-beat.service" #================================================= # GENERIC FINALIZATION @@ -77,9 +77,9 @@ ynh_add_systemd_config --service="${app}-beat" --template="${app}-beat.service #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add "${app}-beat" -yunohost service add "${app}-server" -yunohost service add "${app}-worker" +yunohost service add "bookwyrm-beat" +yunohost service add "bookwyrm-server" +yunohost service add "bookwyrm-worker" #================================================= # START SYSTEMD SERVICE @@ -87,9 +87,9 @@ yunohost service add "${app}-worker" ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="systemd" --line_match="Started" -ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" -ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="ready" +ynh_systemd_action --service_name="bookwyrm-beat" --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name="bookwyrm-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" +ynh_systemd_action --service_name="bookwyrm-worker" --action="start" --log_path="systemd" --line_match="ready" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 804edb6..f8e2885 100644 --- a/scripts/remove +++ b/scripts/remove @@ -28,16 +28,16 @@ fi #================================================= ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 -ynh_systemd_action --service_name="${app}-beat" --action="stop" --log_path="systemd" --line_match="Stopped $app" -ynh_systemd_action --service_name="${app}-server" --action="stop" --log_path="systemd" --line_match="Stopped $app" -ynh_systemd_action --service_name="${app}-worker" --action="stop" --log_path="systemd" --line_match="Stopped $app" +ynh_systemd_action --service_name="bookwyrm-beat" --action="stop" --log_path="systemd" --line_match="Stopped $app" +ynh_systemd_action --service_name="bookwyrm-server" --action="stop" --log_path="systemd" --line_match="Stopped $app" +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="${app}-beat" -ynh_remove_systemd_config --service="${app}-server" -ynh_remove_systemd_config --service="${app}-worker" +ynh_remove_systemd_config --service="bookwyrm-beat" +ynh_remove_systemd_config --service="bookwyrm-server" +ynh_remove_systemd_config --service="bookwyrm-worker" -ynh_secure_remove --file="/etc/systemd/system/$app.target" +ynh_secure_remove --file="/etc/systemd/system/bookwyrm.target" #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index 2e544a4..a0a0fba 100644 --- a/scripts/restore +++ b/scripts/restore @@ -44,32 +44,32 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 -ynh_restore_file --origin_path="/etc/systemd/system/${app}-beat.service" -ynh_restore_file --origin_path="/etc/systemd/system/${app}-server.service" -ynh_restore_file --origin_path="/etc/systemd/system/${app}-worker.service" -ynh_restore_file --origin_path="/etc/systemd/system/$app.target" +ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm-beat.service" +ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm-server.service" +ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm-worker.service" +ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm.target" -systemctl enable "${app}-beat.service" --quiet -systemctl enable "${app}-server.service" --quiet -systemctl enable "${app}-worker.service" --quiet +systemctl enable "bookwyrm-beat.service" --quiet +systemctl enable "bookwyrm-server.service" --quiet +systemctl enable "bookwyrm-worker.service" --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add "${app}-beat" -yunohost service add "${app}-server" -yunohost service add "${app}-worker" +yunohost service add "bookwyrm-beat" +yunohost service add "bookwyrm-server" +yunohost service add "bookwyrm-worker" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="systemd" --line_match="Started" -ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" -ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="ready" +ynh_systemd_action --service_name="bookwyrm-beat" --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name="bookwyrm-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" +ynh_systemd_action --service_name="bookwyrm-worker" --action="start" --log_path="systemd" --line_match="ready" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index f6ee5d6..654ca3e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,9 +28,9 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --action="stop" --service_name="${app}-beat" --log_path="systemd" --line_match="Stopped" -ynh_systemd_action --action="stop" --service_name="${app}-server" --log_path="systemd" --line_match="Stopped" -ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="systemd" --line_match="Stopped" +ynh_systemd_action --action="stop" --service_name="bookwyrm-beat" --log_path="systemd" --line_match="Stopped" +ynh_systemd_action --action="stop" --service_name="bookwyrm-server" --log_path="systemd" --line_match="Stopped" +ynh_systemd_action --action="stop" --service_name="bookwyrm-worker" --log_path="systemd" --line_match="Stopped" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -89,12 +89,12 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 -ynh_add_config --template="../conf/${app}.target" --destination="/etc/systemd/system/$app.target" +ynh_add_config --template="../conf/bookwyrm.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="${app}-server" --template="${app}-server.service" -ynh_add_systemd_config --service="${app}-worker" --template="${app}-worker.service" -ynh_add_systemd_config --service="${app}-beat" --template="${app}-beat.service" +ynh_add_systemd_config --service="bookwyrm-server" --template="bookwyrm-server.service" +ynh_add_systemd_config --service="bookwyrm-worker" --template="bookwyrm-worker.service" +ynh_add_systemd_config --service="bookwyrm-beat" --template="bookwyrm-beat.service" #================================================= # GENERIC FINALIZATION @@ -103,18 +103,18 @@ ynh_add_systemd_config --service="${app}-beat" --template="${app}-beat.service #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add "${app}-beat" -yunohost service add "${app}-server" -yunohost service add "${app}-worker" +yunohost service add "bookwyrm-beat" +yunohost service add "bookwyrm-server" +yunohost service add "bookwyrm-worker" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="systemd" --line_match="Started" -ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" -ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="ready" +ynh_systemd_action --service_name="bookwyrm-beat" --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name="bookwyrm-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" +ynh_systemd_action --service_name="bookwyrm-worker" --action="start" --log_path="systemd" --line_match="ready" #================================================= # END OF SCRIPT From e9d843811717ceab1a494997af075a269ec7f6e0 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 9 Nov 2023 20:29:38 +0100 Subject: [PATCH 04/31] add logs to debug --- conf/bookwyrm-server.service | 4 +++- scripts/install | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/conf/bookwyrm-server.service b/conf/bookwyrm-server.service index 568143c..33d7ca7 100644 --- a/conf/bookwyrm-server.service +++ b/conf/bookwyrm-server.service @@ -9,7 +9,9 @@ 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__ +ExecStart=__INSTALL_DIR__/venv/bin/gunicorn bookwyrm.wsgi:application --bind 127.0.0.1:__PORT__ --error-logfile /var/log/__APP__/__APP__.log +StandardOutput=append:/var/log/__APP__/__APP__.log +StandardError=inherit [Install] WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index b068190..229819d 100755 --- a/scripts/install +++ b/scripts/install @@ -58,6 +58,16 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# LOGROTATE CONFIGURATION +#================================================= +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 +chown -R $app:www-data /var/log/$app/ + #================================================= # SETUP SYSTEMD #================================================= From e23da452ea8e0dc196584e5f1bf8998094be6723 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 9 Nov 2023 20:40:00 +0100 Subject: [PATCH 05/31] fix logs --- conf/bookwyrm-server.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/bookwyrm-server.service b/conf/bookwyrm-server.service index 33d7ca7..c0b2907 100644 --- a/conf/bookwyrm-server.service +++ b/conf/bookwyrm-server.service @@ -9,7 +9,7 @@ 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 From 09229acf3b38653498af2da3a9ab06f32da162e1 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 9 Nov 2023 20:46:04 +0100 Subject: [PATCH 06/31] wrong one --- conf/bookwyrm-server.service | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/bookwyrm-server.service b/conf/bookwyrm-server.service index c0b2907..a09a60d 100644 --- a/conf/bookwyrm-server.service +++ b/conf/bookwyrm-server.service @@ -9,8 +9,7 @@ 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__ -StandardOutput=append:/var/log/__APP__/__APP__.log +ExecStart=__INSTALL_DIR__/venv/bin/gunicorn bookwyrm.wsgi:application --bind 127.0.0.1:__PORT__ --error-logfile /var/log/__APP__/__APP__.log StandardError=inherit [Install] From eb240ab5dd21a9c2c01f263f02e15174137a7af9 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 10 Nov 2023 19:05:35 +0100 Subject: [PATCH 07/31] install Source Han Sans font --- scripts/install | 9 +++++++++ scripts/upgrade | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/scripts/install b/scripts/install index 873e4e8..4f3e133 100755 --- a/scripts/install +++ b/scripts/install @@ -50,6 +50,15 @@ $install_dir/venv/bin/python3 "$install_dir/manage.py" initdb $install_dir/venv/bin/python3 "$install_dir/manage.py" compile_themes $install_dir/venv/bin/python3 "$install_dir/manage.py" collectstatic --no-input +#================================================= +# INSTALL SOURCE HAN SANS FONT +#================================================= +ynh_script_progression --message="Installing Source Han Sans font..." --weight=1 + +pushd $install_dir/static/fonts/source_han_sans + wget https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc +popd + #================================================= # NGINX CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f6ee5d6..d7290b1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -70,6 +70,15 @@ $install_dir/venv/bin/python3 "$install_dir/manage.py" populate_streams $install_dir/venv/bin/python3 "$install_dir/manage.py" makemigrations --merge --noinput $install_dir/venv/bin/python3 "$install_dir/manage.py" migrate +#================================================= +# INSTALL SOURCE HAN SANS FONT +#================================================= +ynh_script_progression --message="Installing Source Han Sans font..." --weight=1 + +pushd $install_dir/static/fonts/source_han_sans + wget https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc +popd + #================================================= # SET PERMISSIONS ON BOOKWYRM DIRECTORY #================================================= 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 08/31] 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 From 7abf2cbf0e98edc7c00cbb04f066304629dfe1f6 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 10 Nov 2023 19:46:24 +0100 Subject: [PATCH 09/31] fix services names --- ...wyrm-beat.service => __APP__-beat.service} | 0 ...-server.service => __APP__-server.service} | 0 ...-worker.service => __APP__-worker.service} | 0 conf/{bookwyrm.target => __APP__.target} | 0 manifest.toml | 2 +- scripts/backup | 8 ++++---- scripts/install | 20 +++++++++---------- scripts/remove | 14 ++++++------- scripts/restore | 12 +++++------ scripts/upgrade | 18 ++++++++--------- 10 files changed, 37 insertions(+), 37 deletions(-) rename conf/{bookwyrm-beat.service => __APP__-beat.service} (100%) rename conf/{bookwyrm-server.service => __APP__-server.service} (100%) rename conf/{bookwyrm-worker.service => __APP__-worker.service} (100%) rename conf/{bookwyrm.target => __APP__.target} (100%) diff --git a/conf/bookwyrm-beat.service b/conf/__APP__-beat.service similarity index 100% rename from conf/bookwyrm-beat.service rename to conf/__APP__-beat.service diff --git a/conf/bookwyrm-server.service b/conf/__APP__-server.service similarity index 100% rename from conf/bookwyrm-server.service rename to conf/__APP__-server.service diff --git a/conf/bookwyrm-worker.service b/conf/__APP__-worker.service similarity index 100% rename from conf/bookwyrm-worker.service rename to conf/__APP__-worker.service diff --git a/conf/bookwyrm.target b/conf/__APP__.target similarity index 100% rename from conf/bookwyrm.target rename to conf/__APP__.target diff --git a/manifest.toml b/manifest.toml index 8ef0fda..3251996 100644 --- a/manifest.toml +++ b/manifest.toml @@ -69,7 +69,7 @@ ram.runtime = "50M" main.default = 8000 [resources.apt] - packages = "postgresql, postgresql-contrib, python3-venv, libpq-dev, python3-dev" + packages = "postgresql, postgresql-contrib, python3-venv, libpq-dev, python3-pip, python3-dev, libpq-dev" [resources.database] type = "postgresql" diff --git a/scripts/backup b/scripts/backup index e7c53ce..1187a94 100755 --- a/scripts/backup +++ b/scripts/backup @@ -31,10 +31,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP SYSTEMD #================================================= -ynh_backup --src_path="/etc/systemd/system/bookwyrm-beat.service" -ynh_backup --src_path="/etc/systemd/system/bookwyrm-server.service" -ynh_backup --src_path="/etc/systemd/system/bookwyrm-worker.service" -ynh_backup --src_path="/etc/systemd/system/bookwyrm.target" +ynh_backup --src_path="/etc/systemd/system/$app-beat.service" +ynh_backup --src_path="/etc/systemd/system/$app-server.service" +ynh_backup --src_path="/etc/systemd/system/$app-worker.service" +ynh_backup --src_path="/etc/systemd/system/$app.target" #================================================= # BACKUP THE POSTGRESQL DATABASE diff --git a/scripts/install b/scripts/install index 2be83bd..5131411 100755 --- a/scripts/install +++ b/scripts/install @@ -75,12 +75,12 @@ chown -R $app:www-data /var/log/$app/ #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_add_config --template="../conf/bookwyrm.target" --destination="/etc/systemd/system/bookwyrm.target" +ynh_add_config --template="../conf/$app.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="bookwyrm-server" --template="bookwyrm-server.service" -ynh_add_systemd_config --service="bookwyrm-worker" --template="bookwyrm-worker.service" -ynh_add_systemd_config --service="bookwyrm-beat" --template="bookwyrm-beat.service" +ynh_add_systemd_config --service="$app-server" --template="$app-server.service" +ynh_add_systemd_config --service="$app-worker" --template="$app-worker.service" +ynh_add_systemd_config --service="$app-beat" --template="$app-beat.service" #================================================= # GENERIC FINALIZATION @@ -89,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" --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" +yunohost service add "$app-beat" --log="/var/log/$app/$app-beat.log" +yunohost service add "$app-server" --log="/var/log/$app/$app.log" +yunohost service add "$app-worker" --log="/var/log/$app/$app-worker.log" #================================================= # START SYSTEMD SERVICE @@ -99,9 +99,9 @@ yunohost service add "bookwyrm-worker" --log="/var/log/$app/$app-worker.log" ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name="bookwyrm-beat" --action="start" --log_path="systemd" --line_match="Started" -ynh_systemd_action --service_name="bookwyrm-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" -ynh_systemd_action --service_name="bookwyrm-worker" --action="start" --log_path="systemd" --line_match="ready" +ynh_systemd_action --service_name="$app-beat" --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name="$app-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" +ynh_systemd_action --service_name="$app-worker" --action="start" --log_path="systemd" --line_match="ready" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 2618d60..3c43ab7 100644 --- a/scripts/remove +++ b/scripts/remove @@ -28,16 +28,16 @@ fi #================================================= ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 -ynh_systemd_action --service_name="bookwyrm-beat" --action="stop" --log_path="systemd" --line_match="Stopped $app" -ynh_systemd_action --service_name="bookwyrm-server" --action="stop" --log_path="systemd" --line_match="Stopped $app" -ynh_systemd_action --service_name="bookwyrm-worker" --action="stop" --log_path="systemd" --line_match="Stopped $app" +ynh_systemd_action --service_name="$app-beat" --action="stop" --log_path="systemd" --line_match="Stopped $app" +ynh_systemd_action --service_name="$app-server" --action="stop" --log_path="systemd" --line_match="Stopped $app" +ynh_systemd_action --service_name="$app-worker" --action="stop" --log_path="systemd" --line_match="Stopped $app" # Remove the dedicated systemd config -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_remove_systemd_config --service="$app-beat" --log="/var/log/$app/$app-beat.log" +ynh_remove_systemd_config --service="$app-server" --log="/var/log/$app/$app.log" +ynh_remove_systemd_config --service="$app-worker" --log="/var/log/$app/$app-worker.log" -ynh_secure_remove --file="/etc/systemd/system/bookwyrm.target" +ynh_secure_remove --file="/etc/systemd/system/$app.target" #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index 0baaefc..0113f4b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -58,18 +58,18 @@ systemctl enable "bookwyrm-worker.service" --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -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" +yunohost service add "$app-beat" --log="/var/log/$app/$app-beat.log" +yunohost service add "$app-server" --log="/var/log/$app/$app.log" +yunohost service add "$app-worker" --log="/var/log/$app/$app-worker.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="bookwyrm-beat" --action="start" --log_path="systemd" --line_match="Started" -ynh_systemd_action --service_name="bookwyrm-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" -ynh_systemd_action --service_name="bookwyrm-worker" --action="start" --log_path="systemd" --line_match="ready" +ynh_systemd_action --service_name="$app-beat" --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name="$app-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" +ynh_systemd_action --service_name="$app-worker" --action="start" --log_path="systemd" --line_match="ready" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 6109662..c0566f6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -92,9 +92,9 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_add_config --template="../conf/bookwyrm.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="bookwyrm-server" --template="bookwyrm-server.service" -ynh_add_systemd_config --service="bookwyrm-worker" --template="bookwyrm-worker.service" -ynh_add_systemd_config --service="bookwyrm-beat" --template="bookwyrm-beat.service" +ynh_add_systemd_config --service="$app-server" --template="$app-server.service" +ynh_add_systemd_config --service="$app-worker" --template="$app-worker.service" +ynh_add_systemd_config --service="$app-beat" --template="$app-beat.service" #================================================= # GENERIC FINALIZATION @@ -103,18 +103,18 @@ 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" --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" +yunohost service add "$app-beat" --log="/var/log/$app/$app-beat.log" +yunohost service add "$app-server" --log="/var/log/$app/$app.log" +yunohost service add "$app-worker" --log="/var/log/$app/$app-worker.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="bookwyrm-beat" --action="start" --log_path="systemd" --line_match="Started" -ynh_systemd_action --service_name="bookwyrm-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" -ynh_systemd_action --service_name="bookwyrm-worker" --action="start" --log_path="systemd" --line_match="ready" +ynh_systemd_action --service_name="$app-beat" --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name="$app-server" --action="start" --log_path="systemd" --line_match="Booting worker with pid" +ynh_systemd_action --service_name="$app-worker" --action="start" --log_path="systemd" --line_match="ready" #================================================= # END OF SCRIPT From 9783fd305b1e270eb565b3de4822da92081282e3 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 10 Nov 2023 20:02:29 +0100 Subject: [PATCH 10/31] fix service remove --- scripts/remove | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/remove b/scripts/remove index 3c43ab7..3867c62 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,10 +17,22 @@ source /usr/share/yunohost/helpers #================================================= # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status $app >/dev/null +if ynh_exec_warn_less yunohost service status "${app}-server" >/dev/null then - ynh_script_progression --message="Removing $app service integration..." --weight=1 - yunohost service remove $app + ynh_script_progression --message="Removing ${app}-server service integration..." + yunohost service remove "${app}-server" +fi + +if ynh_exec_warn_less yunohost service status "${app}-worker" >/dev/null +then + ynh_script_progression --message="Removing ${app}-worker service integration..." + yunohost service remove "${app}-worker" +fi + +if ynh_exec_warn_less yunohost service status "${app}-beat" >/dev/null +then + ynh_script_progression --message="Removing ${app}-beat service integration..." + yunohost service remove "${app}-beat" fi #================================================= From 7ab6eb3006859a724d4679ad39060b74ae1d3553 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 10 Nov 2023 21:04:57 +0100 Subject: [PATCH 11/31] fix service name --- conf/{__APP__-beat.service => bookwyrm-beat.service} | 0 conf/{__APP__-server.service => bookwyrm-server.service} | 0 conf/{__APP__-worker.service => bookwyrm-worker.service} | 0 conf/{__APP__.target => bookwyrm.target} | 0 scripts/install | 8 ++++---- scripts/upgrade | 6 +++--- 6 files changed, 7 insertions(+), 7 deletions(-) rename conf/{__APP__-beat.service => bookwyrm-beat.service} (100%) rename conf/{__APP__-server.service => bookwyrm-server.service} (100%) rename conf/{__APP__-worker.service => bookwyrm-worker.service} (100%) rename conf/{__APP__.target => bookwyrm.target} (100%) diff --git a/conf/__APP__-beat.service b/conf/bookwyrm-beat.service similarity index 100% rename from conf/__APP__-beat.service rename to conf/bookwyrm-beat.service diff --git a/conf/__APP__-server.service b/conf/bookwyrm-server.service similarity index 100% rename from conf/__APP__-server.service rename to conf/bookwyrm-server.service diff --git a/conf/__APP__-worker.service b/conf/bookwyrm-worker.service similarity index 100% rename from conf/__APP__-worker.service rename to conf/bookwyrm-worker.service diff --git a/conf/__APP__.target b/conf/bookwyrm.target similarity index 100% rename from conf/__APP__.target rename to conf/bookwyrm.target diff --git a/scripts/install b/scripts/install index 5131411..0279e2d 100755 --- a/scripts/install +++ b/scripts/install @@ -75,12 +75,12 @@ chown -R $app:www-data /var/log/$app/ #================================================= ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_add_config --template="../conf/$app.target" --destination="/etc/systemd/system/$app.target" +ynh_add_config --template="../conf/bookwyrm.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="$app-server" --template="$app-server.service" -ynh_add_systemd_config --service="$app-worker" --template="$app-worker.service" -ynh_add_systemd_config --service="$app-beat" --template="$app-beat.service" +ynh_add_systemd_config --service="$app-server" --template="bookwyrm-server.service" +ynh_add_systemd_config --service="$app-worker" --template="bookwyrm-worker.service" +ynh_add_systemd_config --service="$app-beat" --template="bookwyrm-beat.service" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index c0566f6..cc961c9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -92,9 +92,9 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_add_config --template="../conf/bookwyrm.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="$app-server" --template="$app-server.service" -ynh_add_systemd_config --service="$app-worker" --template="$app-worker.service" -ynh_add_systemd_config --service="$app-beat" --template="$app-beat.service" +ynh_add_systemd_config --service="$app-server" --template="bookwyrm-server.service" +ynh_add_systemd_config --service="$app-worker" --template="bookwyrm-worker.service" +ynh_add_systemd_config --service="$app-beat" --template="bookwyrm-beat.service" #================================================= # GENERIC FINALIZATION From d515001404fe766b97e6cfa1d52c5b8473b65cd7 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 10 Nov 2023 21:40:09 +0100 Subject: [PATCH 12/31] fix shitload warning --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 4f3e133..d06ea27 100755 --- a/scripts/install +++ b/scripts/install @@ -56,7 +56,7 @@ $install_dir/venv/bin/python3 "$install_dir/manage.py" collectstatic --no-input ynh_script_progression --message="Installing Source Han Sans font..." --weight=1 pushd $install_dir/static/fonts/source_han_sans - wget https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc +ynh_exec_warn_less wget https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc popd #================================================= From a62cc5dd0bc05735d09682c89aef42880cff7f70 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 10 Nov 2023 21:45:55 +0100 Subject: [PATCH 13/31] fix warning wget --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index d7290b1..86c4e2d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -76,7 +76,7 @@ $install_dir/venv/bin/python3 "$install_dir/manage.py" migrate ynh_script_progression --message="Installing Source Han Sans font..." --weight=1 pushd $install_dir/static/fonts/source_han_sans - wget https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc +ynh_exec_warn_less wget https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc popd #================================================= From 3ff95f0b45975c3a0096b7f609b2749a050ea89d Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Sat, 11 Nov 2023 18:59:50 +0100 Subject: [PATCH 14/31] fix remove --- scripts/remove | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/remove b/scripts/remove index 3867c62..ba1f9ff 100644 --- a/scripts/remove +++ b/scripts/remove @@ -51,14 +51,6 @@ ynh_remove_systemd_config --service="$app-worker" --log="/var/log/$app/$app-work ynh_secure_remove --file="/etc/systemd/system/$app.target" -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 - -# Remove the app directory securely -ynh_secure_remove --file="$install_dir" - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -67,6 +59,17 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE LOGS +#================================================= +ynh_script_progression --message="Removing logs..." --weight=5 + +ynh_remove_logrotate + +# Remove the log files +ynh_secure_remove --file="/var/log/$app" + + #================================================= # END OF SCRIPT #================================================= From 6a09312333d9c38de1058a9297972c537349d559 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 13 Nov 2023 13:55:06 +0100 Subject: [PATCH 15/31] remove legacy admin_mail --- scripts/install | 2 -- scripts/upgrade | 2 -- 2 files changed, 4 deletions(-) diff --git a/scripts/install b/scripts/install index 873e4e8..56e69aa 100755 --- a/scripts/install +++ b/scripts/install @@ -9,8 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers - -admin_mail=$(ynh_user_get_info --username=$admin --key=username) key=$(ynh_string_random --length=32) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f6ee5d6..60a4db6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,8 +13,6 @@ source /usr/share/yunohost/helpers # LOAD SETTINGS #================================================= -admin_mail=$(ynh_user_get_info --username=$admin --key=username) - #================================================= # CHECK VERSION #================================================= From c2f10e7622f29cfa5f221a7c088a14c0d009354a Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 13 Nov 2023 13:58:05 +0100 Subject: [PATCH 16/31] fix services --- conf/bookwyrm-beat.service | 2 -- conf/bookwyrm-server.service | 2 -- conf/bookwyrm-worker.service | 4 +--- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/conf/bookwyrm-beat.service b/conf/bookwyrm-beat.service index 72f6947..71e574f 100644 --- a/conf/bookwyrm-beat.service +++ b/conf/bookwyrm-beat.service @@ -10,8 +10,6 @@ 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 c0b2907..568143c 100644 --- a/conf/bookwyrm-server.service +++ b/conf/bookwyrm-server.service @@ -10,8 +10,6 @@ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ EnvironmentFile=__INSTALL_DIR__/.env 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] WantedBy=multi-user.target diff --git a/conf/bookwyrm-worker.service b/conf/bookwyrm-worker.service index f2a5f04..5c15a6f 100644 --- a/conf/bookwyrm-worker.service +++ b/conf/bookwyrm-worker.service @@ -9,9 +9,7 @@ User=__APP__ 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 +ExecStart=__INSTALL_DIR__/venv/bin/celery -A celerywyrm worker -l info -Q high_priority,medium_priority,low_priority,streams,images,suggested_users,email,connectors,lists,inbox,imports,import_triggered,broadcast,misc NoNewPrivileges=yes PrivateTmp=yes From d0e574b89551da487752f5c24c600c867ec5ebc3 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 13 Nov 2023 13:59:16 +0100 Subject: [PATCH 17/31] fix service [Unit] --- conf/bookwyrm-beat.service | 2 +- conf/bookwyrm-server.service | 2 +- conf/bookwyrm-worker.service | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/bookwyrm-beat.service b/conf/bookwyrm-beat.service index 71e574f..3d1538a 100644 --- a/conf/bookwyrm-beat.service +++ b/conf/bookwyrm-beat.service @@ -1,7 +1,7 @@ [Unit] Description=__APP__ celery beat process -After=redis.service postgresql.service +After=network.target postgresql.service redis.service PartOf=__APP__.target [Service] diff --git a/conf/bookwyrm-server.service b/conf/bookwyrm-server.service index 568143c..4e5a449 100644 --- a/conf/bookwyrm-server.service +++ b/conf/bookwyrm-server.service @@ -1,7 +1,7 @@ [Unit] Description=__APP__ application server -After=redis.service postgresql.service +After=network.target postgresql.service redis.service PartOf=__APP__.target [Service] diff --git a/conf/bookwyrm-worker.service b/conf/bookwyrm-worker.service index 5c15a6f..c006133 100644 --- a/conf/bookwyrm-worker.service +++ b/conf/bookwyrm-worker.service @@ -1,7 +1,7 @@ [Unit] Description=__APP__ celery worker -After=redis.service postgresql.service +After=network.target postgresql.service redis.service PartOf=__APP__.target [Service] From 51a332b2ed044600672923dde7cdb068b902056a Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:12:07 +0100 Subject: [PATCH 18/31] cleanup + fix remove --- scripts/remove | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/scripts/remove b/scripts/remove index ba1f9ff..b95a8ed 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,7 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers - #================================================= # STANDARD REMOVE #================================================= @@ -17,22 +16,22 @@ source /usr/share/yunohost/helpers #================================================= # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status "${app}-server" >/dev/null +if ynh_exec_warn_less yunohost service status "$app-server" >/dev/null then - ynh_script_progression --message="Removing ${app}-server service integration..." - yunohost service remove "${app}-server" + ynh_script_progression --message="Removing $app-server service integration..." + yunohost service remove "$app-server" fi -if ynh_exec_warn_less yunohost service status "${app}-worker" >/dev/null +if ynh_exec_warn_less yunohost service status "$app-worker" >/dev/null then - ynh_script_progression --message="Removing ${app}-worker service integration..." - yunohost service remove "${app}-worker" + ynh_script_progression --message="Removing $app-worker service integration..." + yunohost service remove "$app-worker" fi -if ynh_exec_warn_less yunohost service status "${app}-beat" >/dev/null +if ynh_exec_warn_less yunohost service status "$app-beat" >/dev/null then - ynh_script_progression --message="Removing ${app}-beat service integration..." - yunohost service remove "${app}-beat" + ynh_script_progression --message="Removing $app-beat service integration..." + yunohost service remove "$app-beat" fi #================================================= @@ -45,9 +44,9 @@ ynh_systemd_action --service_name="$app-server" --action="stop" --log_path="syst ynh_systemd_action --service_name="$app-worker" --action="stop" --log_path="systemd" --line_match="Stopped $app" # Remove the dedicated systemd config -ynh_remove_systemd_config --service="$app-beat" --log="/var/log/$app/$app-beat.log" -ynh_remove_systemd_config --service="$app-server" --log="/var/log/$app/$app.log" -ynh_remove_systemd_config --service="$app-worker" --log="/var/log/$app/$app-worker.log" +ynh_remove_systemd_config --service="$app-beat" +ynh_remove_systemd_config --service="$app-server" +ynh_remove_systemd_config --service="$app-worker" ynh_secure_remove --file="/etc/systemd/system/$app.target" From 889e0d8e6f2419ad739195bd34fa2245613023a0 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 14 Nov 2023 13:57:57 +0100 Subject: [PATCH 19/31] Update .env file at upgrade --- scripts/upgrade | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 60a4db6..2d1c5cb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,6 +46,17 @@ chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" +#================================================= +# CONFIGURE THE INSTALL SCRIPT +#================================================= +ynh_script_progression --message="Upgrading .env file..." --weight=1 + +ynh_add_config --template="../conf/.env.production" --destination="$install_dir/.env" +chmod 600 $install_dir/.env +chown $app: "$install_dir/.env" + +set -a; source "$install_dir/.env"; set +a + #================================================= # CONFIGURE THEN INSTALL SCRIPT AND DEPENDENCIES From 3b55e4654383ca854e0f2abdac11fff48a0c29a0 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 14 Nov 2023 15:09:10 +0100 Subject: [PATCH 20/31] Fix key variable missing? --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 2d1c5cb..495a868 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,6 +13,8 @@ source /usr/share/yunohost/helpers # LOAD SETTINGS #================================================= +key=$(ynh_app_setting_get --app=$app --key=key --value=$key) + #================================================= # CHECK VERSION #================================================= From 9d215a7f689c96c7882b5a7e4442853e824f84f7 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 14 Nov 2023 18:02:40 +0100 Subject: [PATCH 21/31] set key setting for later updates --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 56e69aa..1255feb 100755 --- a/scripts/install +++ b/scripts/install @@ -10,6 +10,7 @@ source _common.sh source /usr/share/yunohost/helpers key=$(ynh_string_random --length=32) +ynh_app_setting_set --app=$app --key=key --value=$key #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE From 4faebd445caa15c65130d46625a575221b3deb39 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 14 Nov 2023 18:05:08 +0100 Subject: [PATCH 22/31] fix $key in .env file --- scripts/upgrade | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 495a868..a73deb4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -13,7 +13,11 @@ source /usr/share/yunohost/helpers # LOAD SETTINGS #================================================= -key=$(ynh_app_setting_get --app=$app --key=key --value=$key) +# uncomment me after some updates whenever the key variable is set in install for some times +#key=$(ynh_app_setting_get --app=$app --key=key --value=$key) + +#remove me when key setting is uncommented (see above) +key=$(ynh_string_random --length=32) #================================================= # CHECK VERSION From eb7b07bd172931584a3907718e399612d6fc152e Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 14 Nov 2023 18:24:59 +0100 Subject: [PATCH 23/31] Fix email sender --- conf/.env.production | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/.env.production b/conf/.env.production index 1678b60..275a1f1 100644 --- a/conf/.env.production +++ b/conf/.env.production @@ -51,7 +51,7 @@ EMAIL_HOST_USER=__APP__ EMAIL_HOST_PASSWORD=__MAIL_PWD__ EMAIL_USE_TLS=true EMAIL_USE_SSL=false -EMAIL_SENDER_NAME==__APP__@__DOMAIN__ +EMAIL_SENDER_NAME=__APP__@__DOMAIN__ # defaults to DOMAIN #EMAIL_SENDER_DOMAIN= From 063c283cc68dfcab8fb9656ed7f7f5c3f535d74e Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 14 Nov 2023 19:02:10 +0100 Subject: [PATCH 24/31] Stupid typo in sender name --- conf/.env.production | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/.env.production b/conf/.env.production index 275a1f1..0aaf35e 100644 --- a/conf/.env.production +++ b/conf/.env.production @@ -51,7 +51,7 @@ EMAIL_HOST_USER=__APP__ EMAIL_HOST_PASSWORD=__MAIL_PWD__ EMAIL_USE_TLS=true EMAIL_USE_SSL=false -EMAIL_SENDER_NAME=__APP__@__DOMAIN__ +EMAIL_SENDER_NAME=__APP__ # defaults to DOMAIN #EMAIL_SENDER_DOMAIN= From 196762d0b2f6dc76f7fd265f13f2cd39caac415c Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Sun, 19 Nov 2023 12:26:20 +0100 Subject: [PATCH 25/31] Disable multi_instance again There are still federation errors when a second instance is installed. --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 3251996..480478c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -21,7 +21,7 @@ fund = ["https://patreon.com/bookwyrm", "https://opencollective.com/bookwyrm"] [integration] yunohost = ">= 11.2" architectures = "all" -multi_instance = true +multi_instance = false ldap = false sso = false disk = "50M" From dc65d983dfc24214bf602c9586be65b356321aee Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:19:13 +0100 Subject: [PATCH 26/31] use ynh_setup_source to install font --- manifest.toml | 4 ++++ scripts/install | 12 ++---------- scripts/upgrade | 12 ++---------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/manifest.toml b/manifest.toml index 722864d..72f5f2b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -55,6 +55,10 @@ ram.runtime = "50M" autoupdate.strategy = "latest_github_tag" + [resources.sources.fonts] + url = "https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc" + sha256 = "" + [resources.system_user] allow_email = true diff --git a/scripts/install b/scripts/install index 00134ff..7bbe6ba 100755 --- a/scripts/install +++ b/scripts/install @@ -18,7 +18,8 @@ ynh_app_setting_set --app=$app --key=key --value=$key ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir" --source_id="main" +ynh_setup_source --dest_dir="$install_dir/static/fonts/source_han_sans" --source_id="fonts" # Set permissions to app files chmod -R o-rwx "$install_dir" @@ -49,15 +50,6 @@ $install_dir/venv/bin/python3 "$install_dir/manage.py" initdb $install_dir/venv/bin/python3 "$install_dir/manage.py" compile_themes $install_dir/venv/bin/python3 "$install_dir/manage.py" collectstatic --no-input -#================================================= -# INSTALL SOURCE HAN SANS FONT -#================================================= -ynh_script_progression --message="Installing Source Han Sans font..." --weight=1 - -pushd $install_dir/static/fonts/source_han_sans -ynh_exec_warn_less wget https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc -popd - #================================================= # NGINX CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a5be43f..d6862df 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -45,7 +45,8 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep=".env" + ynh_setup_source --dest_dir="$install_dir" --source_id="main" --keep=".env" + ynh_setup_source --dest_dir="$install_dir/static/fonts/source_han_sans" --source_id="fonts" fi chmod 750 "$install_dir" @@ -85,15 +86,6 @@ $install_dir/venv/bin/python3 "$install_dir/manage.py" populate_streams $install_dir/venv/bin/python3 "$install_dir/manage.py" makemigrations --merge --noinput $install_dir/venv/bin/python3 "$install_dir/manage.py" migrate -#================================================= -# INSTALL SOURCE HAN SANS FONT -#================================================= -ynh_script_progression --message="Installing Source Han Sans font..." --weight=1 - -pushd $install_dir/static/fonts/source_han_sans -ynh_exec_warn_less wget https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc -popd - #================================================= # SET PERMISSIONS ON BOOKWYRM DIRECTORY #================================================= From 334ae89c27eab3966b12f7faf7223978060369ba Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:21:49 +0100 Subject: [PATCH 27/31] =?UTF-8?q?disable=20source=20.env=20because=20doesn?= =?UTF-8?q?=E2=80=99t=20seems=20to=20be=20usefull=20this=20way?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 7bbe6ba..6de0e0a 100755 --- a/scripts/install +++ b/scripts/install @@ -34,7 +34,7 @@ ynh_add_config --template="../conf/.env.production" --destination="$install_dir/ chmod 600 $install_dir/.env chown $app:www-data "$install_dir/.env" -set -a; source "$install_dir/.env"; set +a +# set -a; source "$install_dir/.env"; set +a mkdir "$install_dir/venv" python3 -m venv "$install_dir/venv" diff --git a/scripts/upgrade b/scripts/upgrade index d6862df..5156a51 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,7 +62,7 @@ ynh_add_config --template="../conf/.env.production" --destination="$install_dir/ chmod 600 $install_dir/.env chown $app: "$install_dir/.env" -set -a; source "$install_dir/.env"; set +a +#set -a; source "$install_dir/.env"; set +a #================================================= From 0ad8b0310697ff207a13c19ce458088f329849f7 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:26:27 +0100 Subject: [PATCH 28/31] Oops add checksum --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 72f5f2b..0c7b41d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -57,7 +57,7 @@ ram.runtime = "50M" [resources.sources.fonts] url = "https://github.com/adobe-fonts/source-han-sans/raw/release/Variable/OTC/SourceHanSans-VF.ttf.ttc" - sha256 = "" + sha256 = "1662483cf0cdaf04438618fc67e807a00dadb3fd3b4193c3c23cf7ad4dcc499f" [resources.system_user] From 33d9120aa63ee7a15e8940b69c016d300349cdd9 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:48:26 +0100 Subject: [PATCH 29/31] =?UTF-8?q?Get=20rid=20of=20the=20source=20.env=20be?= =?UTF-8?q?cause=20wasn=E2=80=99t=20usefull?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/install | 2 -- scripts/upgrade | 3 --- 2 files changed, 5 deletions(-) diff --git a/scripts/install b/scripts/install index 6de0e0a..381ed38 100755 --- a/scripts/install +++ b/scripts/install @@ -34,8 +34,6 @@ ynh_add_config --template="../conf/.env.production" --destination="$install_dir/ chmod 600 $install_dir/.env chown $app:www-data "$install_dir/.env" -# set -a; source "$install_dir/.env"; set +a - mkdir "$install_dir/venv" python3 -m venv "$install_dir/venv" $install_dir/venv/bin/pip3 install -r "$install_dir/requirements.txt" diff --git a/scripts/upgrade b/scripts/upgrade index 5156a51..660b18c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,9 +62,6 @@ ynh_add_config --template="../conf/.env.production" --destination="$install_dir/ chmod 600 $install_dir/.env chown $app: "$install_dir/.env" -#set -a; source "$install_dir/.env"; set +a - - #================================================= # CONFIGURE THEN INSTALL SCRIPT AND DEPENDENCIES #================================================= From 749f46fa909220a3a503ee0710d09b0be1705e9e Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:49:21 +0100 Subject: [PATCH 30/31] Update Yunohost packaging version --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 0c7b41d..fa28d52 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "BookWyrm" description.en = "Platform for social reading" description.fr = "Plateforme de lecture sociale" -version = "0.6.6~ynh1" +version = "0.6.6~ynh2" maintainers = ["oufmilo"] From b49b87f14fef7bf5a4a1032acbcdc31b8b27e8cf Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 4 Dec 2023 12:49:24 +0000 Subject: [PATCH 31/31] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 454509e..9d200e7 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in BookWyrm is a social network for tracking your reading, talking about books, writing reviews, and discovering what to read next. -**Shipped version:** 0.6.6~ynh1 +**Shipped version:** 0.6.6~ynh2 **Demo:** https://joinbookwyrm.com/fr/ diff --git a/README_fr.md b/README_fr.md index c58878d..2f5d09a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po BookWyrm est un réseau social pour garder la trace de vos lectures, parler de livres, écrire des critiques et découvrir quoi lire ensuite. -**Version incluse :** 0.6.6~ynh1 +**Version incluse :** 0.6.6~ynh2 **Démo :** https://joinbookwyrm.com/fr/