Unique runner ID (#4)

* Use ynh NPM

* Use ynh NPM

* improve runner_name

* improve runner_name

* peertube_url

* peertube_url

* peertube_url

* test new npm command

* fix syntax

* fix syntax

* change npm commands

* fix npm command

* fix parameters

* fix parameters

* use npm_node

* use npm_node

* fix typo

* relative path

* debugging

* fix debug

* improve debug

* fix node_module

* fix command syntax

* fix syntax

* debug

* Fix binary path

* Fix remove

* Cleaning

* Delete doc/screenshots directory

* Auto-update README

* cleaning + remove nginx

* Delete nginx.conf

* cleaning + remove nginx

* Delete POST_UPGRADE.md

* Delete PRE_UPGRADE.md

* Delete PRE_INSTALL_fr.md

* Delete PRE_INSTALL.md

* Update POST_INSTALL.md

* Update POST_INSTALL.md

* Update DESCRIPTION.md

* Auto-update README

* Update DESCRIPTION_fr.md

* Auto-update README

* Delete ADMIN.md

* better doc link

* Create PRE_INSTALL.md

* Create PRE_INSTALL_fr.md

* Fix change_url

* Add path + help messages

* Improvements

* change hostname to unique ID

* change hostname to unique ID

* cleaning

* register the runner (again)

* fix id

Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org>

* cleaning

* cleaning

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org>
This commit is contained in:
lapineige 2023-07-25 14:06:20 +02:00 committed by GitHub
parent dca24edb3b
commit 94c1e65c62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View file

@ -61,9 +61,13 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
#=================================================
ynh_script_progression --message="Registering the runner on Peertube server..." --weight=1
runner_id=$(ynh_string_random --length=5 --filter='0-9')
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\_$(hostname)
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\_$(hostname)
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

View file

@ -58,6 +58,15 @@ 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
#=================================================