From 94c1e65c62a11b8a6f240b0c2c9da3cfe63b3cbf Mon Sep 17 00:00:00 2001 From: lapineige Date: Tue, 25 Jul 2023 14:06:20 +0200 Subject: [PATCH 1/5] 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 * cleaning * cleaning --------- Co-authored-by: yunohost-bot Co-authored-by: Alexandre Aubin --- scripts/install | 6 +++++- scripts/remove | 2 +- scripts/restore | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index c622825..ab9b928 100755 --- a/scripts/install +++ b/scripts/install @@ -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 #================================================= diff --git a/scripts/remove b/scripts/remove index 2506ef7..5322e85 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\_$(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 diff --git a/scripts/restore b/scripts/restore index 02ed2e1..39c6ac8 100755 --- a/scripts/restore +++ b/scripts/restore @@ -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 #================================================= From 24a770c679fb07fd7a94b9721e103963db79d68b Mon Sep 17 00:00:00 2001 From: lapineige Date: Tue, 25 Jul 2023 14:06:51 +0200 Subject: [PATCH 2/5] bump version --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index e9d96e7..613ab24 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "PeerTube Remote Runner" description.en = "Remote runner to offload high CPU/long job (such as transcoding) from Peertube main server" description.fr = "Un runner distant pour décharger le travail intense en ressources CPU (comme le transcodage) d'un serveur PeerTube principal" -version = "1.0~ynh1" +version = "1.0~ynh2" maintainers = ["Lapineige"] From f2d89895e7fe5057b1df94882bc57dc78848ce38 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 25 Jul 2023 12:06:54 +0000 Subject: [PATCH 3/5] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 65a2295..226d92c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Remote runner to offload heavy workloads jobs (such as transcoding) from one or several (distant) Peertube server. -**Shipped version:** 1.0~ynh1 +**Shipped version:** 1.0~ynh2 ## Documentation and resources * Official app website: diff --git a/README_fr.md b/README_fr.md index 7fa1d33..7a5a6b7 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Un *runner* distant pour décharger le travail intense en ressources (comme le transcodage) d'un serveur PeerTube principal distant. -**Version incluse :** 1.0~ynh1 +**Version incluse :** 1.0~ynh2 ## Documentations et ressources * Site officiel de l’app : From f86b190d169edcb676f5916e1c01dc309d40b893 Mon Sep 17 00:00:00 2001 From: eric_G <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:01:42 +0200 Subject: [PATCH 4/5] Testing (#5) * 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 * cleaning * cleaning * Update manifest.toml * fix linter * Update tests.toml --------- Co-authored-by: lapineige Co-authored-by: yunohost-bot Co-authored-by: Alexandre Aubin --- manifest.toml | 7 +++---- tests.toml | 10 ++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 tests.toml diff --git a/manifest.toml b/manifest.toml index 613ab24..b908d98 100644 --- a/manifest.toml +++ b/manifest.toml @@ -3,7 +3,7 @@ packaging_format = 2 id = "peertube_remote_runner" name = "PeerTube Remote Runner" description.en = "Remote runner to offload high CPU/long job (such as transcoding) from Peertube main server" -description.fr = "Un runner distant pour décharger le travail intense en ressources CPU (comme le transcodage) d'un serveur PeerTube principal" +description.fr = "Runner distant pour décharger le travail intense en ressources CPU (comme le transcodage) d'un serveur PeerTube principal" version = "1.0~ynh2" @@ -16,7 +16,7 @@ admindoc = "https://docs.joinpeertube.org/maintain/tools#peertube-runner" code = "https://github.com/Chocobozzz/PeerTube/tree/develop/packages/peertube-runner" [integration] -yunohost = ">= 11.1.21" +yunohost = ">= 11.2" architectures = "all" multi_instance = true ldap = false @@ -28,8 +28,7 @@ ram.runtime = "1000M" [install] [install.domain] type = "domain" - full_domain = false - + [install.path] type = "path" default = "/peertube_runner" diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..56320b7 --- /dev/null +++ b/tests.toml @@ -0,0 +1,10 @@ +test_format = 1.0 + +[default] + + # ------------------------------- + # Default args to use for install + # ------------------------------- + + args.peertube_url = "https://domain.tld" + args.runner_token = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" From 85a2ce0d21350a91190400788d7557a849fc10c1 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 31 Oct 2023 14:28:12 +0000 Subject: [PATCH 5/5] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 226d92c..ac17ec5 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Remote runner to offload heavy workloads jobs (such as transcoding) from one or * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: +* YunoHost Store: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index 7a5a6b7..6a348e7 100644 --- a/README_fr.md +++ b/README_fr.md @@ -25,7 +25,7 @@ Un *runner* distant pour décharger le travail intense en ressources (comme le t * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : +* YunoHost Store: * Signaler un bug : ## Informations pour les développeurs