From a0701755c5d87d6a9e0847031ceb5aa1f994a775 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 25 Nov 2023 09:08:44 +0100 Subject: [PATCH] cleaning --- conf/systemd.service | 4 ++-- scripts/change_url | 6 +++--- scripts/install | 8 ++++---- scripts/remove | 4 ++-- scripts/restore | 20 ++++++++++---------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 908560e..f1b400f 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -4,11 +4,11 @@ After=network.target [Service] Type=simple +User=__APP__ +Group=__APP__ Environment=NODE_ENV=production Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/config Environment="__YNH_NODE_LOAD_PATH__" -User=__APP__ -Group=__APP__ ExecStart=__YNH_NODE__ __INSTALL_DIR__/node_modules/@peertube/peertube-runner server WorkingDirectory=__INSTALL_DIR__/ StandardOutput=syslog diff --git a/scripts/change_url b/scripts/change_url index 567110b..d7173ef 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -16,12 +16,12 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # SPECIFIC MODIFICATIONS #================================================= -# CHANGE REMOTE RUNNER URL INSIDE PEERTUBE +# CHANGE REMOTE RUNNER URL INSIDE PEERTUBE #================================================= ynh_script_progression --message="Removing the runner from Peertube, registering it with the new URL and name..." --weight=1 @@ -38,7 +38,7 @@ popd #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 7794a67..44c1db0 100755 --- a/scripts/install +++ b/scripts/install @@ -27,7 +27,7 @@ chown -R $app:www-data "$install_dir" pushd "$install_dir" ynh_use_nodejs - ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm install @peertube/peertube-runner + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm install @peertube/peertube-runner popd #================================================= @@ -48,12 +48,12 @@ yunohost service add $app --description="Peertube remote runner" --log="/var/log ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # SPECIFIC FINALIZATION #================================================= -# RUNNER REGISTRATION +# RUNNER REGISTRATION #================================================= ynh_script_progression --message="Registering the runner on Peertube server..." --weight=1 @@ -62,7 +62,7 @@ ynh_app_setting_set --app=$app --key='runner_id' --value=$runner_id pushd "$install_dir" ynh_use_nodejs - ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node "$install_dir/node_modules/@peertube/peertube-runner" register --url $peertube_url --registration-token $runner_token --runner-name $app\_$runner_id + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node "$install_dir/node_modules/@peertube/peertube-runner" register --url $peertube_url --registration-token $runner_token --runner-name $app\_$runner_id popd #================================================= diff --git a/scripts/remove b/scripts/remove index 6df6e46..c5dd518 100755 --- a/scripts/remove +++ b/scripts/remove @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Unregistering the runner on Peertube server..." --weight=1 -ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node "$install_dir/node_modules/@peertube/peertube-runner" unregister --url $peertube_url --registration-token $runner_token --runner-name $app\_$runner_id +ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node "$install_dir/node_modules/@peertube/peertube-runner" unregister --url $peertube_url --registration-token $runner_token --runner-name $app\_$runner_id #================================================= # REMOVE SYSTEM CONFIGURATIONS @@ -38,7 +38,7 @@ ynh_script_progression --message="Removing Peertube remote runner npm module..." pushd "$install_dir" ynh_use_nodejs - ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm uninstall @peertube/peertube-runner + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm uninstall @peertube/peertube-runner popd #================================================= diff --git a/scripts/restore b/scripts/restore index 7fb82a6..01b8494 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,7 +33,7 @@ ynh_script_progression --message="Installing Peertube remote runner npm module.. pushd "$install_dir" ynh_use_nodejs - ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm install @peertube/peertube-runner + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_npm install @peertube/peertube-runner popd #================================================= @@ -46,15 +46,6 @@ systemctl enable $app.service --quiet yunohost service add $app --description="Peertube remote runner" --log="/var/log/$app/$app.log" -#================================================= -# RUNNER REGISTRATION -#================================================= - -pushd "$install_dir" - ynh_use_nodejs - ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node "$install_dir/node_modules/@peertube/peertube-runner" register --url $peertube_url --registration-token $runner_token --runner-name $app\_$runner_id -popd - #================================================= # GENERIC FINALIZATION #================================================= @@ -67,6 +58,15 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap ynh_systemd_action --service_name=nginx --action=reload +#================================================= +# RUNNER REGISTRATION +#================================================= + +pushd "$install_dir" + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$install_dir/config" NODE_ENV=production $ynh_node "$install_dir/node_modules/@peertube/peertube-runner" register --url $peertube_url --registration-token $runner_token --runner-name $app\_$runner_id +popd + #================================================= # END OF SCRIPT #=================================================