This commit is contained in:
ericgaspar 2023-11-25 09:08:44 +01:00
parent 5b14a93fdb
commit a0701755c5
5 changed files with 21 additions and 21 deletions

View file

@ -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

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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
#=================================================

View file

@ -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
#=================================================