Fix multi_instance services

This commit is contained in:
Thomas 2023-11-08 14:14:54 +01:00 committed by GitHub
parent a240657baa
commit a1c38e5fdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 47 deletions

View file

@ -31,10 +31,10 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
ynh_backup --src_path="/etc/systemd/system/${app}-beat.service" ynh_backup --src_path="/etc/systemd/system/bookwyrm-beat.service"
ynh_backup --src_path="/etc/systemd/system/${app}-server.service" ynh_backup --src_path="/etc/systemd/system/bookwyrm-server.service"
ynh_backup --src_path="/etc/systemd/system/${app}-worker.service" ynh_backup --src_path="/etc/systemd/system/bookwyrm-worker.service"
ynh_backup --src_path="/etc/systemd/system/$app.target" ynh_backup --src_path="/etc/systemd/system/bookwyrm.target"
#================================================= #=================================================
# BACKUP THE POSTGRESQL DATABASE # BACKUP THE POSTGRESQL DATABASE

View file

@ -63,12 +63,12 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1 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 # Create a dedicated systemd config
ynh_add_systemd_config --service="${app}-server" --template="${app}-server.service" ynh_add_systemd_config --service="bookwyrm-server" --template="bookwyrm-server.service"
ynh_add_systemd_config --service="${app}-worker" --template="${app}-worker.service" ynh_add_systemd_config --service="bookwyrm-worker" --template="bookwyrm-worker.service"
ynh_add_systemd_config --service="${app}-beat" --template="${app}-beat.service" ynh_add_systemd_config --service="bookwyrm-beat" --template="bookwyrm-beat.service"
#================================================= #=================================================
# GENERIC FINALIZATION # 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 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add "${app}-beat" yunohost service add "bookwyrm-beat"
yunohost service add "${app}-server" yunohost service add "bookwyrm-server"
yunohost service add "${app}-worker" yunohost service add "bookwyrm-worker"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -87,9 +87,9 @@ yunohost service add "${app}-worker"
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name="${app}-beat" --action="start" --log_path="systemd" --line_match="Started" ynh_systemd_action --service_name="bookwyrm-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="bookwyrm-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-worker" --action="start" --log_path="systemd" --line_match="ready"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -28,16 +28,16 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 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="bookwyrm-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="bookwyrm-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-worker" --action="stop" --log_path="systemd" --line_match="Stopped $app"
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config --service="${app}-beat" ynh_remove_systemd_config --service="bookwyrm-beat"
ynh_remove_systemd_config --service="${app}-server" ynh_remove_systemd_config --service="bookwyrm-server"
ynh_remove_systemd_config --service="${app}-worker" 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 # REMOVE APP MAIN DIR

View file

@ -44,32 +44,32 @@ chown -R $app:www-data "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 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/bookwyrm-beat.service"
ynh_restore_file --origin_path="/etc/systemd/system/${app}-server.service" ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm-server.service"
ynh_restore_file --origin_path="/etc/systemd/system/${app}-worker.service" ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm-worker.service"
ynh_restore_file --origin_path="/etc/systemd/system/$app.target" ynh_restore_file --origin_path="/etc/systemd/system/bookwyrm.target"
systemctl enable "${app}-beat.service" --quiet systemctl enable "bookwyrm-beat.service" --quiet
systemctl enable "${app}-server.service" --quiet systemctl enable "bookwyrm-server.service" --quiet
systemctl enable "${app}-worker.service" --quiet systemctl enable "bookwyrm-worker.service" --quiet
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add "${app}-beat" yunohost service add "bookwyrm-beat"
yunohost service add "${app}-server" yunohost service add "bookwyrm-server"
yunohost service add "${app}-worker" yunohost service add "bookwyrm-worker"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 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="bookwyrm-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="bookwyrm-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-worker" --action="start" --log_path="systemd" --line_match="ready"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -28,9 +28,9 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 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="bookwyrm-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="bookwyrm-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-worker" --log_path="systemd" --line_match="Stopped"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -89,12 +89,12 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 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 # Create a dedicated systemd config
ynh_add_systemd_config --service="${app}-server" --template="${app}-server.service" ynh_add_systemd_config --service="bookwyrm-server" --template="bookwyrm-server.service"
ynh_add_systemd_config --service="${app}-worker" --template="${app}-worker.service" ynh_add_systemd_config --service="bookwyrm-worker" --template="bookwyrm-worker.service"
ynh_add_systemd_config --service="${app}-beat" --template="${app}-beat.service" ynh_add_systemd_config --service="bookwyrm-beat" --template="bookwyrm-beat.service"
#================================================= #=================================================
# GENERIC FINALIZATION # 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 ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add "${app}-beat" yunohost service add "bookwyrm-beat"
yunohost service add "${app}-server" yunohost service add "bookwyrm-server"
yunohost service add "${app}-worker" yunohost service add "bookwyrm-worker"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 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="bookwyrm-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="bookwyrm-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-worker" --action="start" --log_path="systemd" --line_match="ready"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT