From c6ba9b47433f3784bff4b7669ae73fa2aa795a44 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:12:51 +0100 Subject: [PATCH] add services --- ...ges.service => overleaf-history-v1.service} | 6 +++--- conf/overleaf-project-history.service | 18 ++++++++++++++++++ scripts/backup | 3 ++- scripts/change_url | 7 ++++--- scripts/install | 11 +++++++---- scripts/remove | 18 ++++++++++++------ scripts/restore | 14 ++++++++++---- scripts/upgrade | 12 ++++++++---- 8 files changed, 64 insertions(+), 25 deletions(-) rename conf/{overleaf-track-changes.service => overleaf-history-v1.service} (60%) create mode 100644 conf/overleaf-project-history.service diff --git a/conf/overleaf-track-changes.service b/conf/overleaf-history-v1.service similarity index 60% rename from conf/overleaf-track-changes.service rename to conf/overleaf-history-v1.service index d069c46..53f7f76 100644 --- a/conf/overleaf-track-changes.service +++ b/conf/overleaf-history-v1.service @@ -1,5 +1,5 @@ [Unit] -Description=__APP__ track-changes +Description=__APP__ history-v1 After=network.target [Service] @@ -8,8 +8,8 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ EnvironmentFile=__INSTALL_DIR__/variables.env -ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/track-changes/app.js -StandardOutput=append:/var/log/__APP__/track-changes.log +ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/history-v1/app.js +StandardOutput=append:/var/log/__APP__/history-v1.log StandardError=inherit Restart=on-failure RestartSec=5s diff --git a/conf/overleaf-project-history.service b/conf/overleaf-project-history.service new file mode 100644 index 0000000..4bc10a4 --- /dev/null +++ b/conf/overleaf-project-history.service @@ -0,0 +1,18 @@ +[Unit] +Description=__APP__ project-history +After=network.target + +[Service] +Type=simple +User=__APP__ +Group=__APP__ +WorkingDirectory=__INSTALL_DIR__/ +EnvironmentFile=__INSTALL_DIR__/variables.env +ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/project-history/app.js +StandardOutput=append:/var/log/__APP__/project-history.log +StandardError=inherit +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/scripts/backup b/scripts/backup index f7d93be..645124e 100755 --- a/scripts/backup +++ b/scripts/backup @@ -51,10 +51,11 @@ ynh_backup --src_path="/etc/systemd/system/$app-contacts.service" ynh_backup --src_path="/etc/systemd/system/$app-docstore.service" ynh_backup --src_path="/etc/systemd/system/$app-document-updater.service" ynh_backup --src_path="/etc/systemd/system/$app-filestore.service" +ynh_backup --src_path="/etc/systemd/system/$app-history-v1.service" ynh_backup --src_path="/etc/systemd/system/$app-notifications.service" +ynh_backup --src_path="/etc/systemd/system/$app-project-history.service" ynh_backup --src_path="/etc/systemd/system/$app-real-time.service" ynh_backup --src_path="/etc/systemd/system/$app-spelling.service" -#ynh_backup --src_path="/etc/systemd/system/$app-track-changes.service" ynh_backup --src_path="/etc/systemd/system/$app-web.service" #================================================= diff --git a/scripts/change_url b/scripts/change_url index a363130..397a720 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -22,10 +22,11 @@ ynh_systemd_action --service_name="$app-contacts" --action="stop" --log_path="/v ynh_systemd_action --service_name="$app-docstore" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-document-updater" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-filestore" --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app-history-v1" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-notifications" --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app-project-history" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-real-time" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-spelling" --action="stop" --log_path="/var/log/$app/$app.log" -#ynh_systemd_action --service_name="$app-track-changes" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-web" --action="stop" --log_path="/var/log/$app/$app.log" #================================================= @@ -60,17 +61,17 @@ chown $app:$app "$install_dir/settings.js" #================================================= ynh_script_progression --message="Starting a systemd service..." -# Start a systemd service ynh_systemd_action --service_name="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --line_match="Using settings from" +ynh_systemd_action --service_name="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --line_match="Using settings from" +ynh_systemd_action --service_name="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --line_match="Using settings from" -#ynh_systemd_action --service_name="$app-track-changes" --action="start" --log_path="/var/log/$app/track-changes.log" --line_match="listening on" ynh_systemd_action --service_name="$app-web" --action="start" --log_path="/var/log/$app/web.log" --line_match="listening on" --line_match="Using settings from" #================================================= diff --git a/scripts/install b/scripts/install index b537ec4..d820398 100755 --- a/scripts/install +++ b/scripts/install @@ -19,6 +19,7 @@ admin_mail=$(ynh_user_get_info --username=$admin --key=mail) ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=crypto_random --value=$crypto_random +ynh_app_setting_set --app=$app --key=web_api_password --value=$web_api_password #================================================= # STANDARD MODIFICATIONS @@ -159,10 +160,11 @@ ynh_add_systemd_config --service="$app-contacts" --template="overleaf-contacts.s ynh_add_systemd_config --service="$app-docstore" --template="overleaf-docstore.service" ynh_add_systemd_config --service="$app-document-updater" --template="overleaf-document-updater.service" ynh_add_systemd_config --service="$app-filestore" --template="overleaf-filestore.service" +ynh_add_systemd_config --service="$app-history-v1" --template="overleaf-history-v1.service" ynh_add_systemd_config --service="$app-notifications" --template="overleaf-notifications.service" +ynh_add_systemd_config --service="$app-project-history" --template="overleaf-project-history.service" ynh_add_systemd_config --service="$app-real-time" --template="overleaf-real-time.service" ynh_add_systemd_config --service="$app-spelling" --template="overleaf-spelling.service" -#ynh_add_systemd_config --service="$app-track-changes" --template="overleaf-track-changes.service" ynh_add_systemd_config --service="$app-web" --template="overleaf-web.service" #================================================= @@ -188,10 +190,11 @@ yunohost service add "$app-contacts" --log="/var/log/$app/contacts.log" yunohost service add "$app-docstore" --log="/var/log/$app/docstore.log" yunohost service add "$app-document-updater" --log="/var/log/$app/document-updater.log" yunohost service add "$app-filestore" --log="/var/log/$app/filestore.log" +yunohost service add "$app-history-v1" --log="/var/log/$app/history-v1.log" yunohost service add "$app-notifications" --log="/var/log/$app/notifications.log" +yunohost service add "$app-project-history" --log="/var/log/$app/project-history.log" yunohost service add "$app-real-time" --log="/var/log/$app/real-time.log" yunohost service add "$app-spelling" --log="/var/log/$app/spelling.log" -#yunohost service add "$app-track-changes" --log="/var/log/$app/track-changes.log" yunohost service add "$app-web" --log="/var/log/$app/web.log" #================================================= @@ -199,17 +202,17 @@ yunohost service add "$app-web" --log="/var/log/$app/web.log" #================================================= ynh_script_progression --message="Starting a systemd service..." -# Start a systemd service ynh_systemd_action --service_name="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --line_match="Using settings from" +ynh_systemd_action --service_name="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --line_match="Using settings from" +ynh_systemd_action --service_name="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --line_match="Using settings from" -#ynh_systemd_action --service_name="$app-track-changes" --action="start" --log_path="/var/log/$app/track-changes.log" --line_match="listening on" ynh_systemd_action --service_name="$app-web" --action="start" --log_path="/var/log/$app/web.log" --line_match="listening on" --line_match="Using settings from" #================================================= diff --git a/scripts/remove b/scripts/remove index f087541..ea7b944 100755 --- a/scripts/remove +++ b/scripts/remove @@ -46,11 +46,21 @@ then ynh_script_progression --message="Removing $app-filestore service integration..." yunohost service remove "$app-filestore" fi +if ynh_exec_warn_less yunohost service status "$app-history-v1" >/dev/null +then + ynh_script_progression --message="Removing $app-history-v1 service integration..." + yunohost service remove "$app-history-v1" +fi if ynh_exec_warn_less yunohost service status "$app-notifications" >/dev/null then ynh_script_progression --message="Removing $app-notifications service integration..." yunohost service remove "$app-notifications" fi +if ynh_exec_warn_less yunohost service status "$app-project-history" >/dev/null +then + ynh_script_progression --message="Removing $app-project-history service integration..." + yunohost service remove "$app-project-history" +fi if ynh_exec_warn_less yunohost service status "$app-real-time" >/dev/null then ynh_script_progression --message="Removing $app-real-time service integration..." @@ -61,11 +71,6 @@ then ynh_script_progression --message="Removing $app-spelling service integration..." yunohost service remove "$app-spelling" fi -#if ynh_exec_warn_less yunohost service status "$app-track-changes" >/dev/null -#then - #ynh_script_progression --message="Removing $app-track-changes service integration..." - #yunohost service remove "$app-track-changes" -#fi if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null then ynh_script_progression --message="Removing $app-web service integration..." @@ -84,10 +89,11 @@ ynh_remove_systemd_config --service="$app-contacts" ynh_remove_systemd_config --service="$app-docstore" ynh_remove_systemd_config --service="$app-document-updater" ynh_remove_systemd_config --service="$app-filestore" +ynh_remove_systemd_config --service="$app-history-v1" ynh_remove_systemd_config --service="$app-notifications" +ynh_remove_systemd_config --service="$app-project-history" ynh_remove_systemd_config --service="$app-real-time" ynh_remove_systemd_config --service="$app-spelling" -#ynh_remove_systemd_config --service="$app-track-changes" ynh_remove_systemd_config --service="$app-web" #================================================= diff --git a/scripts/restore b/scripts/restore index 72b0608..c604779 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,6 +10,8 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +ynh_app_setting_set --app=$app --key=web_api_password --value=$web_api_password + #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -80,14 +82,16 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app-document-updater.servic systemctl enable $app-document-updater.service --quiet ynh_restore_file --origin_path="/etc/systemd/system/$app-filestore.service" systemctl enable $app-filestore.service --quiet +ynh_restore_file --origin_path="/etc/systemd/system/$app-history-v1.service" +systemctl enable $app-history-v1.service --quiet ynh_restore_file --origin_path="/etc/systemd/system/$app-notifications.service" systemctl enable $app-notifications.service --quiet +ynh_restore_file --origin_path="/etc/systemd/system/$app-project-history.service" +systemctl enable $app-project-history.service --quiet ynh_restore_file --origin_path="/etc/systemd/system/$app-real-time.service" systemctl enable $app-real-time.service --quiet ynh_restore_file --origin_path="/etc/systemd/system/$app-spelling.service" systemctl enable $app-spelling.service --quiet -#ynh_restore_file --origin_path="/etc/systemd/system/$app-track-changes.service" -#systemctl enable $app-track-changes.service --quiet ynh_restore_file --origin_path="/etc/systemd/system/$app-web.service" systemctl enable $app-web.service --quiet @@ -111,10 +115,11 @@ yunohost service add "$app-contacts" --log="/var/log/$app/contacts.log" yunohost service add "$app-docstore" --log="/var/log/$app/docstore.log" yunohost service add "$app-document-updater" --log="/var/log/$app/document-updater.log" yunohost service add "$app-filestore" --log="/var/log/$app/filestore.log" +yunohost service add "$app-history-v1" --log="/var/log/$app/history-v1.log" yunohost service add "$app-notifications" --log="/var/log/$app/notifications.log" +yunohost service add "$app-project-history" --log="/var/log/$app/project-history.log" yunohost service add "$app-real-time" --log="/var/log/$app/real-time.log" yunohost service add "$app-spelling" --log="/var/log/$app/spelling.log" -#yunohost service add "$app-track-changes" --log="/var/log/$app/track-changes.log" yunohost service add "$app-web" --log="/var/log/$app/web.log" #================================================= @@ -128,10 +133,11 @@ ynh_systemd_action --service_name="$app-contacts" --action="start" --log_path="/ ynh_systemd_action --service_name="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --line_match="Using settings from" +ynh_systemd_action --service_name="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --line_match="Using settings from" +ynh_systemd_action --service_name="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --line_match="Using settings from" -#ynh_systemd_action --service_name="$app-track-changes" --action="start" --log_path="/var/log/$app/track-changes.log" --line_match="listening on" ynh_systemd_action --service_name="$app-web" --action="start" --log_path="/var/log/$app/web.log" --line_match="listening on" --line_match="Using settings from" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ca83d88..fe5ee51 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,10 +30,11 @@ ynh_systemd_action --service_name="$app-contacts" --action="stop" --log_path="/v ynh_systemd_action --service_name="$app-docstore" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-document-updater" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-filestore" --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app-history-v1" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-notifications" --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app-project-history" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-real-time" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-spelling" --action="stop" --log_path="/var/log/$app/$app.log" -#ynh_systemd_action --service_name="$app-track-changes" --action="stop" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name="$app-web" --action="stop" --log_path="/var/log/$app/$app.log" #================================================= @@ -165,10 +166,11 @@ ynh_add_systemd_config --service="$app-contacts" --template="overleaf-contacts.s ynh_add_systemd_config --service="$app-docstore" --template="overleaf-docstore.service" ynh_add_systemd_config --service="$app-document-updater" --template="overleaf-document-updater.service" ynh_add_systemd_config --service="$app-filestore" --template="overleaf-filestore.service" +ynh_add_systemd_config --service="$app-history-v1" --template="overleaf-history-v1.service" ynh_add_systemd_config --service="$app-notifications" --template="overleaf-notifications.service" +ynh_add_systemd_config --service="$app-project-history" --template="overleaf-project-history.service" ynh_add_systemd_config --service="$app-real-time" --template="overleaf-real-time.service" ynh_add_systemd_config --service="$app-spelling" --template="overleaf-spelling.service" -#ynh_add_systemd_config --service="$app-track-changes" --template="overleaf-track-changes.service" ynh_add_systemd_config --service="$app-web" --template="overleaf-web.service" #================================================= @@ -194,10 +196,11 @@ yunohost service add "$app-contacts" --log="/var/log/$app/contacts.log" yunohost service add "$app-docstore" --log="/var/log/$app/docstore.log" yunohost service add "$app-document-updater" --log="/var/log/$app/document-updater.log" yunohost service add "$app-filestore" --log="/var/log/$app/filestore.log" +yunohost service add "$app-history-v1" --log="/var/log/$app/history-v1.log" yunohost service add "$app-notifications" --log="/var/log/$app/notifications.log" +yunohost service add "$app-project-history" --log="/var/log/$app/project-history.log" yunohost service add "$app-real-time" --log="/var/log/$app/real-time.log" yunohost service add "$app-spelling" --log="/var/log/$app/spelling.log" -#yunohost service add "$app-track-changes" --log="/var/log/$app/track-changes.log" yunohost service add "$app-web" --log="/var/log/$app/web.log" #================================================= @@ -211,10 +214,11 @@ ynh_systemd_action --service_name="$app-contacts" --action="start" --log_path="/ ynh_systemd_action --service_name="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --line_match="Using settings from" +ynh_systemd_action --service_name="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --line_match="Using settings from" +ynh_systemd_action --service_name="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --line_match="Using settings from" ynh_systemd_action --service_name="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --line_match="Using settings from" -#ynh_systemd_action --service_name="$app-track-changes" --action="start" --log_path="/var/log/$app/track-changes.log" --line_match="listening on" ynh_systemd_action --service_name="$app-web" --action="start" --log_path="/var/log/$app/web.log" --line_match="listening on" --line_match="Using settings from" #=================================================