Fix first version + cleaning (#2)

* 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

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
This commit is contained in:
lapineige 2023-07-09 12:19:10 +02:00 committed by GitHub
parent 50bc6d3d33
commit 7eb7b4eb6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 31 additions and 54 deletions

View file

@ -16,15 +16,10 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview ## Overview
This is a dummy description of this app features 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~ynh1
## Screenshots
![Screenshot of PeerTube Remote Runner](./doc/screenshots/example.jpg)
## Documentation and resources ## Documentation and resources
* Official app website: <https://docs.joinpeertube.org/admin/remote-runners> * Official app website: <https://docs.joinpeertube.org/admin/remote-runners>

View file

@ -16,15 +16,10 @@ Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po
## Vue densemble ## Vue densemble
Ceci est une fausse description des fonctionalités de l'app 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~ynh1
## Captures décran
![Capture décran de PeerTube Remote Runner](./doc/screenshots/example.jpg)
## Documentations et ressources ## Documentations et ressources
* Site officiel de lapp : <https://docs.joinpeertube.org/admin/remote-runners> * Site officiel de lapp : <https://docs.joinpeertube.org/admin/remote-runners>

View file

@ -1,9 +0,0 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Path to source
alias __INSTALL_DIR__/;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}

View file

@ -9,7 +9,7 @@ Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/config
Environment="__YNH_NODE_LOAD_PATH__" Environment="__YNH_NODE_LOAD_PATH__"
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
ExecStart=__YNH_NODE__ __INSTALL_DIR__/peertube-runner server ExecStart=__YNH_NODE__ __INSTALL_DIR__/node_modules/@peertube/peertube-runner server
WorkingDirectory=__INSTALL_DIR__/ WorkingDirectory=__INSTALL_DIR__/
StandardOutput=syslog StandardOutput=syslog
StandardError=syslog StandardError=syslog

View file

@ -1,3 +0,0 @@
This is a dummy admin doc for this app
The app install dir is `__INSTALL_DIR__`

View file

@ -1 +1 @@
This is a dummy description of this app features Remote runner to offload heavy workloads jobs (such as transcoding) from one or several (distant) Peertube server.

View file

@ -1 +1 @@
Ceci est une fausse description des fonctionalités de l'app Un *runner* distant pour décharger le travail intense en ressources (comme le transcodage) d'un serveur PeerTube principal distant.

View file

@ -1,7 +1,7 @@
This is a dummy disclaimer to display after the install The app url is `__DOMAIN____PATH__`. You will not need this in the future, the runner will contact Peertube directly.
The app url is `__DOMAIN____PATH__` The app install dir is `__INSTALL_DIR__`.
The app install dir is `__INSTALL_DIR__` The app id is `__ID__`.
The app id is `__ID__` You now need to setup your Peertube server to use that remote runner for transcoding and so on : https://docs.joinpeertube.org/admin/remote-runners#enable-remote-runners

View file

@ -1 +0,0 @@
This is a dummy disclaimer to display after upgrades

View file

@ -1 +1,2 @@
This is a dummy disclaimer to display prior to the install To install this app, you will need to specify one Peertube server URL (the use of several servers is not supported yet out of the box, it requires to run a specific command).
You will also need a remote runner token : https://docs.joinpeertube.org/admin/remote-runners#manage-remote-runners

View file

@ -1 +1,2 @@
Ceci est un faux disclaimer à présenter avant l'installation Pour installer cette application, vous devrez spécifier l'URL d'un serveur Peertube (l'utilisation de plusieurs serveurs n'est pas encore supportée, il faut exécuter une commande spécifique).
Vous aurez également besoin d'un jeton (*token*) d'exécution à distance : https://docs.joinpeertube.org/admin/remote-runners#manage-remote-runners

View file

@ -1 +0,0 @@
This is a dummy disclaimer to display prior to any upgrade

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View file

@ -37,7 +37,7 @@ ram.runtime = "1000M"
[install.admin] [install.admin]
type = "user" type = "user"
[install.runner_url] [install.peertube_url]
type = "string" type = "string"
[install.runner_token] [install.runner_token]

View file

@ -18,18 +18,18 @@ 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="/var/log/$app/$app.log"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_change_url_nginx_config
#================================================= #=================================================
# SPECIFIC MODIFICATIONS # SPECIFIC MODIFICATIONS
#================================================= #=================================================
# ... # 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
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" 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" register --url $peertube_url --registration-token $runner_token --runner-name $app\_$(hostname)
popd
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION

View file

@ -33,16 +33,13 @@ popd
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 ynh_script_progression --message="Adding peertube runner service $app..." --weight=1
ynh_add_nginx_config
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
yunohost service add $app --description="Peertube remote runner" --log="/var/log/$app/$app.log" yunohost service add $app --description="Peertube remote runner" --log="/var/log/$app/$app.log"
#================================================= #=================================================
# APP INITIAL CONFIGURATION # APP INITIAL CONFIGURATION
#================================================= #=================================================
@ -62,8 +59,12 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
#================================================= #=================================================
# RUNNER REGISTRATION # RUNNER REGISTRATION
#================================================= #=================================================
ynh_script_progression --message="Registering the runner on Peertube server..." --weight=1
peertube-runner register --url runner_url --registration-token runner_token --runner-name $app$(hostname) 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)
popd
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,10 +10,11 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# RUNNER REGISTRATION # RUNNER UNREGISTRATION
#================================================= #=================================================
ynh_script_progression --message="Unregistering the runner on Peertube server..." --weight=1
peertube-runner unregister --url runner_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\_$(hostname)
#================================================= #=================================================
# REMOVE SYSTEM CONFIGURATIONS # REMOVE SYSTEM CONFIGURATIONS
@ -31,9 +32,6 @@ fi
ynh_remove_systemd_config ynh_remove_systemd_config
ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE NPM MODULE # REMOVE NPM MODULE
#================================================= #=================================================