From 667deb5d4cf4b15e56bb13479d036b1705a0055e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 31 Mar 2021 03:29:34 +0200 Subject: [PATCH] Fix services --- conf/funkwhale-worker.service | 2 +- scripts/install | 14 +++++++------- scripts/remove | 6 +++--- scripts/restore | 6 +++--- scripts/upgrade | 20 ++++++++++---------- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/conf/funkwhale-worker.service b/conf/funkwhale-worker.service index 6b685cc..5e5fe08 100644 --- a/conf/funkwhale-worker.service +++ b/conf/funkwhale-worker.service @@ -8,7 +8,7 @@ User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/api EnvironmentFile=__FINALPATH__/config/.env -ExecStart=__FINALPATH__/virtualenv/bin/celery -A funkwhale_api.taskapp worker --concurrency=${CELERYD_CONCURRENCY-0} --loglevel INFO --logfile=/var/log/__APP__/worker.log +ExecStart=__FINALPATH__/virtualenv/bin/celery -A funkwhale_api.taskapp worker --loglevel INFO --logfile=/var/log/__APP__/worker.log #NoNewPrivileges=true #PrivateDevices=true diff --git a/scripts/install b/scripts/install index 9019367..8bd2f96 100644 --- a/scripts/install +++ b/scripts/install @@ -167,7 +167,7 @@ pushd $final_path python api/manage.py migrate ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name" echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('$admin', '$admin_mail', 'funkwhale') " | python api/manage.py shell - python api/manage.py collectstatic + echo "yes" | python api/manage.py collectstatic popd #================================================= @@ -178,9 +178,9 @@ ynh_script_progression --message="Configuring a systemd service..." ynh_add_config --template="../conf/funkwhale.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="$app-server" --template="funkwhale-server.service" -ynh_add_systemd_config --service="$app-worker" --template="funkwhale-worker.service" -ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.service" +ynh_add_systemd_config --service="$app-server" --template="funkwhale-server.service" --others_var="datadir" +ynh_add_systemd_config --service="$app-worker" --template="funkwhale-worker.service" --others_var="datadir" +ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.service" --others_var="datadir" #================================================= # GENERIC FINALIZATION @@ -211,9 +211,9 @@ yunohost service add "${app}-worker" --log="/var/log/$app/worker.log" ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="/var/log/$app/beat.log" -ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="/var/log/$app/server.log" -ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="/var/log/$app/worker.log" +ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="systemd" --line_match="Running with the following plugins enabled" +ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Application startup complete" +ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="Running with the following plugins enabled" #================================================= # SETUP FAIL2BAN diff --git a/scripts/remove b/scripts/remove index f5e544e..8ea1a3b 100644 --- a/scripts/remove +++ b/scripts/remove @@ -53,9 +53,9 @@ fi #================================================= ynh_script_progression --message="Stopping and removing the systemd service..." -ynh_systemd_action --action="stop" --service_name="${app}-beat" -ynh_systemd_action --action="stop" --service_name="${app}-server" -ynh_systemd_action --action="stop" --service_name="${app}-worker" +ynh_systemd_action --action="stop" --service_name="${app}-beat" --log_path="systemd" --line_match="Stopped Funkwhale" +ynh_systemd_action --action="stop" --service_name="${app}-server" --log_path="systemd" --line_match="Stopped Funkwhale" +ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="systemd" --line_match="Stopped Funkwhale" # Remove the dedicated systemd config ynh_remove_systemd_config --service="$app-server" diff --git a/scripts/restore b/scripts/restore index 1110799..3d2cfc0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -143,9 +143,9 @@ yunohost service add "${app}-worker" --log="/var/log/$app/worker.log" #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="/var/log/$app/beat.log" -ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="/var/log/$app/server.log" -ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="/var/log/$app/worker.log" +ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="systemd" --line_match="Running with the following plugins enabled" +ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Application startup complete" +ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="Running with the following plugins enabled" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index ca44959..9451344 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -82,9 +82,9 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name="${app}-beat" --action="stop" --log_path="/var/log/$app/beat.log" -ynh_systemd_action --service_name="${app}-server" --action="stop" --log_path="/var/log/$app/server.log" -ynh_systemd_action --service_name="${app}-worker" --action="stop" --log_path="/var/log/$app/worker.log" +ynh_systemd_action --action="stop" --service_name="${app}-beat" --log_path="systemd" --line_match="Stopped Funkwhale" +ynh_systemd_action --action="stop" --service_name="${app}-server" --log_path="systemd" --line_match="Stopped Funkwhale" +ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="systemd" --line_match="Stopped Funkwhale" #================================================= # MOVE DATAS @@ -184,7 +184,7 @@ pushd $final_path python api/manage.py migrate ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name" - python api/manage.py collectstatic --clear --noinput + echo "yes" | python api/manage.py collectstatic --clear --noinput # https://code.eliotberriot.com/funkwhale/funkwhale/tags/0.16 # users-now-have-an-activitypub-actor-manual-action-required # python api/manage.py script create_actors --no-input @@ -213,9 +213,9 @@ ynh_script_progression --message="Upgrading systemd configuration..." ynh_add_config --template="../conf/funkwhale.target" --destination="/etc/systemd/system/$app.target" # Create a dedicated systemd config -ynh_add_systemd_config --service="$app-server" --template="funkwhale-server.service" -ynh_add_systemd_config --service="$app-worker" --template="funkwhale-worker.service" -ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.service" +ynh_add_systemd_config --service="$app-server" --template="funkwhale-server.service" --others_var="datadir" +ynh_add_systemd_config --service="$app-worker" --template="funkwhale-worker.service" --others_var="datadir" +ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.service" --others_var="datadir" #================================================= # GENERIC FINALIZATION @@ -246,9 +246,9 @@ yunohost service add "${app}-worker" --log="/var/log/$app/worker.log" ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="/var/log/$app/beat.log" -ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="/var/log/$app/server.log" -ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="/var/log/$app/worker.log" +ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="systemd" --line_match="Running with the following plugins enabled" +ynh_systemd_action --service_name="${app}-server" --action="start" --log_path="systemd" --line_match="Application startup complete" +ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="systemd" --line_match="Running with the following plugins enabled" #================================================= # UPGRADE FAIL2BAN