From 2032d0f83a389d1a7e64c609fb58d33c29aaf35f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 30 Jan 2022 21:34:03 +0100 Subject: [PATCH 1/7] Install PEERTUBE LIVECHAT PLUGIN Fix #278 --- doc/DISCLAIMER.md | 23 +++++++++++++---------- doc/DISCLAIMER_fr.md | 29 ++++++++++------------------- scripts/install | 25 ++++++++++++++++++++++--- scripts/restore | 5 +++++ scripts/upgrade | 26 ++++++++++++++++++++------ 5 files changed, 70 insertions(+), 38 deletions(-) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index f7d823e..a1c7156 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -12,19 +12,22 @@ Servers are run independently by different people and organizations. They can ap By watching a video, you help the hosting provider to broadcast it by becoming a broadcaster of the video yourself. Each instance doesn't need much money to broadcast the videos of its users. -* Any known limitations, constrains or stuff not working, such as (but not limited to): - * Require **dedicated domain** like **peertube.domain.tld**. - * Admin username is: **root**. - * **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation. - * URL can not be changed once selected. Choose the domain wisely. - * You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**. +### IMPORTANT POINT TO READ BEFORE INSTALLING +* Require **dedicated domain** like **peertube.domain.tld**. +* Admin username is: **root**. +* **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation. +* URL can not be changed once selected. Choose the domain wisely. +* You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**. $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 $ mkswap /swapfile $ swapon /swapfile $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab - * This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server) - * **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** - * LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation. - * HTTP auth is not supported +* This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server) +* **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** +* HTTP auth is not supported + +### PLUGINS +* LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation. +* PeerTube plugin livechat is installed with Prosody. To enable, just select «Prosody server controlled by Peertube» as chat mode in the plugin configutation of the PeerTube admin page diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md index acc6ba9..9d0fe38 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DISCLAIMER_fr.md @@ -1,8 +1,3 @@ -## Vue d'ensemble - -### Qu'est-ce que PeerTube ? -PeerTube est une plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent . - ### Pourquoi PeerTube? Nous ne pouvons pas créer d'alternatives de streaming vidéo FOSS à YouTube, Dailymotion, Vimeo... avec un logiciel centralisé. Une organisation seule ne peut pas avoir assez d'argent pour payer la bande passante et le stockage vidéo de son serveur. @@ -15,26 +10,22 @@ Les serveurs sont gérés indépendamment par différentes personnes et organisa En regardant une vidéo, vous aidez l'hébergeur à la diffuser en devenant vous-même un diffuseur de la vidéo. Chaque instance n'a pas besoin de beaucoup d'argent pour diffuser les vidéos de ses utilisateurs. -## Points importants à lire avant l'installation - -1. Nécessite un **domaine dédié** comme **peertube.domain.tld**. -1. Le nom d'utilisateur de l'administrateur est: **root**. -1. **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation. -1. L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine. -1. Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**. - +### Points importants à lire avant l'installation +* Nécessite un **domaine dédié** comme **peertube.domain.tld**. +* Le nom d'utilisateur de l'administrateur est: **root**. +* **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation. +* L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine. +* Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**. $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 $ mkswap /swapfile $ swapon /swapfile $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab -1. Cette application est **multi-instance** (vous pouvez avoir plus d'une instance PeerTube en cours d'exécution sur un serveur YunoHost) -1. **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** +* Cette application est **multi-instance** (vous pouvez avoir plus d'une instance PeerTube en cours d'exécution sur un serveur YunoHost) +* **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** -## Caractéristiques spécifiques YunoHost - -#### Support multi-utilisateur +#### PLUGINS * L'authentification LDAP est prise en charge, les instructions de configuration sont envoyées à l'adresse email indiquée au moment de l'installation -* L'authentification HTTP n'est pas prise en charge +* le plugin PeerTube livechat est installé ainsi que Prosody. pour l'activer, sélectionner «Prosody server controlled by Peertube» dans le paramétre chat mode du plugin dans la page d'administration de PeerTube. diff --git a/scripts/install b/scripts/install index 0bd23d1..63b226d 100644 --- a/scripts/install +++ b/scripts/install @@ -91,6 +91,11 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Yarn ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +if ! yunohost app list | grep -q "prosody" +then + yunohost app install prosody --args "domain=$domain&admin=$admin&language=$language&password=$password" +fi + #================================================= # CREATE DEDICATED USER #================================================= @@ -165,7 +170,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile popd #================================================= @@ -205,7 +210,21 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l ynh_script_progression --message="Installing LDAP plugin..." pushd "$final_path" - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap +popd + +#================================================= +# INSTALL PEERTUBE LIVECHAT PLUGIN +#================================================= +ynh_script_progression --message="Installing PeerTube livechat plugin..." + +if ! yunohost app list | grep -q "prosody" +then + yunohost app install prosody --args "domain=$domain&admin=$admin&language=$language&password=$password" +fi + +pushd "$final_path" + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat popd #================================================= @@ -214,7 +233,7 @@ popd ynh_script_progression --message="Changing PeerTube admin password..." pushd "$final_path" - echo $admin_pass | ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run reset-password -- -u root + echo $admin_pass | ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run reset-password -- -u root popd #================================================= diff --git a/scripts/restore b/scripts/restore index a5050e3..ea26709 100644 --- a/scripts/restore +++ b/scripts/restore @@ -102,6 +102,11 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Yarn ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +if ! yunohost app list | grep -q "prosody" +then + yunohost app install prosody --args "domain=$domain&admin=$admin&language=$language&password=$password" +fi + #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 6c956f8..8cd267c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -139,6 +139,10 @@ if ! ynh_permission_exists --permission="api"; then ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" fi +# Remove hook +ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" +yunohost tools regen-conf nginx + #================================================= # CREATE DEDICATED USER #================================================= @@ -212,9 +216,10 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Yarn ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" -# Remove hook -ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" -yunohost tools regen-conf nginx +if ! yunohost app list | grep -q "prosody" +then + yunohost app install prosody --args "domain=$domain&admin=$admin&language=$language&password=$password" +fi #================================================= # SPECIFIC UPGRADE @@ -249,7 +254,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile popd #================================================= @@ -274,7 +279,16 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l ynh_script_progression --message="Installing LDAP plugin..." pushd "$final_path" - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-auth-ldap +popd + +#================================================= +# INSTALL PEERTUBE LIVECHAT PLUGIN +#================================================= +ynh_script_progression --message="Installing PeerTube livechat plugin..." + +pushd "$final_path" + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat popd #================================================= @@ -284,7 +298,7 @@ popd if ynh_compare_current_package_version --comparison lt --version 4.0.0~ynh1; then ynh_script_progression --message="Running Peertube 4.0.0 migration script..." pushd "$final_path" - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.0.js + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_node dist/scripts/migrations/peertube-4.0.js popd fi From d4375be93f0fe8037662ae6702caf80e63a31194 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 30 Jan 2022 20:34:10 +0000 Subject: [PATCH 2/7] Auto-update README --- README.md | 23 +++++++++++++---------- README_fr.md | 29 ++++++++++------------------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 599b5ba..236647a 100644 --- a/README.md +++ b/README.md @@ -42,22 +42,25 @@ Servers are run independently by different people and organizations. They can ap By watching a video, you help the hosting provider to broadcast it by becoming a broadcaster of the video yourself. Each instance doesn't need much money to broadcast the videos of its users. -* Any known limitations, constrains or stuff not working, such as (but not limited to): - * Require **dedicated domain** like **peertube.domain.tld**. - * Admin username is: **root**. - * **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation. - * URL can not be changed once selected. Choose the domain wisely. - * You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**. +### IMPORTANT POINT TO READ BEFORE INSTALLING +* Require **dedicated domain** like **peertube.domain.tld**. +* Admin username is: **root**. +* **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation. +* URL can not be changed once selected. Choose the domain wisely. +* You need more then **1 GB** of RAM. If you don't have it, please create a **swap memory**. $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 $ mkswap /swapfile $ swapon /swapfile $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab - * This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server) - * **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** - * LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation. - * HTTP auth is not supported +* This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server) +* **If you are hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch to [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** +* HTTP auth is not supported + +### PLUGINS +* LDAP auth is supported, LDAP configuration will be sent to the email address given at the time of the installation. +* PeerTube plugin livechat is installed with Prosody. To enable, just select «Prosody server controlled by Peertube» as chat mode in the plugin configutation of the PeerTube admin page ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index ebc54c4..d998376 100644 --- a/README_fr.md +++ b/README_fr.md @@ -24,11 +24,6 @@ Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorren ## Avertissements / informations importantes -## Vue d'ensemble - -### Qu'est-ce que PeerTube ? -PeerTube est une plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent . - ### Pourquoi PeerTube? Nous ne pouvons pas créer d'alternatives de streaming vidéo FOSS à YouTube, Dailymotion, Vimeo... avec un logiciel centralisé. Une organisation seule ne peut pas avoir assez d'argent pour payer la bande passante et le stockage vidéo de son serveur. @@ -41,29 +36,25 @@ Les serveurs sont gérés indépendamment par différentes personnes et organisa En regardant une vidéo, vous aidez l'hébergeur à la diffuser en devenant vous-même un diffuseur de la vidéo. Chaque instance n'a pas besoin de beaucoup d'argent pour diffuser les vidéos de ses utilisateurs. -## Points importants à lire avant l'installation - -1. Nécessite un **domaine dédié** comme **peertube.domain.tld**. -1. Le nom d'utilisateur de l'administrateur est: **root**. -1. **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation. -1. L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine. -1. Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**. - +### Points importants à lire avant l'installation +* Nécessite un **domaine dédié** comme **peertube.domain.tld**. +* Le nom d'utilisateur de l'administrateur est: **root**. +* **Le mot de passe administrateur et la configuration LDAP** seront envoyés à l'adresse email indiquée au moment de l'installation. +* L'URL ne peut pas être modifiée une fois sélectionnée. Choisissez judicieusement le domaine. +* Vous avez besoin de plus de **1 Go** de RAM. Si vous ne l'avez pas, veuillez créer une **mémoire swap**. $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 $ mkswap /swapfile $ swapon /swapfile $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab -1. Cette application est **multi-instance** (vous pouvez avoir plus d'une instance PeerTube en cours d'exécution sur un serveur YunoHost) -1. **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** +* Cette application est **multi-instance** (vous pouvez avoir plus d'une instance PeerTube en cours d'exécution sur un serveur YunoHost) +* **Si vous êtes hébergé sur une machine virtuelle OVH ou rencontrez `gyp ERR! configure error`, veuillez passer à [ovh_fix](https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix)** -## Caractéristiques spécifiques YunoHost - -#### Support multi-utilisateur +#### PLUGINS * L'authentification LDAP est prise en charge, les instructions de configuration sont envoyées à l'adresse email indiquée au moment de l'installation -* L'authentification HTTP n'est pas prise en charge +* le plugin PeerTube livechat est installé ainsi que Prosody. pour l'activer, sélectionner «Prosody server controlled by Peertube» dans le paramétre chat mode du plugin dans la page d'administration de PeerTube. ## Documentations et ressources From 0e570c97c3f7ddd975e7cc2278282924f499a7b5 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 3 Feb 2022 21:18:56 +0100 Subject: [PATCH 3/7] Improving prosody --- scripts/install | 5 ----- scripts/upgrade | 2 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index 63b226d..4badc73 100644 --- a/scripts/install +++ b/scripts/install @@ -218,11 +218,6 @@ popd #================================================= ynh_script_progression --message="Installing PeerTube livechat plugin..." -if ! yunohost app list | grep -q "prosody" -then - yunohost app install prosody --args "domain=$domain&admin=$admin&language=$language&password=$password" -fi - pushd "$final_path" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production $ynh_npm run plugin:install -- --npm-name peertube-plugin-livechat popd diff --git a/scripts/upgrade b/scripts/upgrade index 8cd267c..b5e6c97 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -219,6 +219,8 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st if ! yunohost app list | grep -q "prosody" then yunohost app install prosody --args "domain=$domain&admin=$admin&language=$language&password=$password" +elfi + yunohost app upgrade fi #================================================= From 1a4f04275fb680c0125acbdb54984e7ae49b1b7c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 6 Feb 2022 02:01:51 +0100 Subject: [PATCH 4/7] Implementing prosody --- scripts/install | 6 +++++- scripts/remove | 25 +++++++++++++++++++++++++ scripts/restore | 6 +++++- scripts/upgrade | 8 +++++--- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/scripts/install b/scripts/install index 4badc73..37eff8e 100644 --- a/scripts/install +++ b/scripts/install @@ -93,9 +93,13 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st if ! yunohost app list | grep -q "prosody" then - yunohost app install prosody --args "domain=$domain&admin=$admin&language=$language&password=$password" + yunohost app install prosody --force +else + yunohost app upgrade prosody --force fi +ynh_app_setting_set --app=$app --key=require_prosody --value="1" + #================================================= # CREATE DEDICATED USER #================================================= diff --git a/scripts/remove b/scripts/remove index fc5a63d..b88efa1 100644 --- a/scripts/remove +++ b/scripts/remove @@ -110,6 +110,31 @@ ynh_script_progression --message="Removing dependencies..." ynh_remove_nodejs ynh_remove_app_dependencies +# Remove Prosody +ynh_app_setting_delete --app=$app --key=require_prosody + +# List apps requiring Prosody +installed_apps=$(yunohost app list | grep -oP 'id: \K.*$') +required_by="" +installed_app_required_by="" +for installed_app in $installed_apps +do + installed_app_required_by=$(ynh_app_setting_get --app=$installed_app --key="require_prosody") + if [[ $installed_app_required_by ]] + then + required_by="${installed_app_required_by}" + fi + installed_app_required_by="" +done + +# If Prosody is no more required +if [[ ! $required_by ]] +then + # Remove Prosody + ynh_print_info --message="Removing of Prosody" + yunohost app remove prosody --purge +fi + #================================================= # CLOSE A PORT #================================================= diff --git a/scripts/restore b/scripts/restore index ea26709..cbca928 100644 --- a/scripts/restore +++ b/scripts/restore @@ -104,9 +104,13 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st if ! yunohost app list | grep -q "prosody" then - yunohost app install prosody --args "domain=$domain&admin=$admin&language=$language&password=$password" + yunohost app install prosody --force +else + yunohost app upgrade prosody --force fi +ynh_app_setting_set --app=$app --key=require_prosody --value="1" + #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b5e6c97..f96472a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -218,11 +218,13 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st if ! yunohost app list | grep -q "prosody" then - yunohost app install prosody --args "domain=$domain&admin=$admin&language=$language&password=$password" -elfi - yunohost app upgrade + yunohost app install prosody --force +else + yunohost app upgrade prosody --force fi +ynh_app_setting_set --app=$app --key=require_prosody --value="1" + #================================================= # SPECIFIC UPGRADE #================================================= From f3f8a6533ec19e48d6ec336af5404a42212d4f3a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 6 Feb 2022 15:30:20 +0100 Subject: [PATCH 5/7] fetch last apps.json --- scripts/install | 6 ++++-- scripts/restore | 6 ++++-- scripts/upgrade | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 37eff8e..65885a7 100644 --- a/scripts/install +++ b/scripts/install @@ -93,9 +93,11 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st if ! yunohost app list | grep -q "prosody" then - yunohost app install prosody --force + yunohost tools update + yunohost app install prosody else - yunohost app upgrade prosody --force + yunohost tools update + yunohost app upgrade prosody fi ynh_app_setting_set --app=$app --key=require_prosody --value="1" diff --git a/scripts/restore b/scripts/restore index cbca928..08d1ae6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -104,9 +104,11 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st if ! yunohost app list | grep -q "prosody" then - yunohost app install prosody --force + yunohost tools update + yunohost app install prosody else - yunohost app upgrade prosody --force + yunohost tools update + yunohost app upgrade prosody fi ynh_app_setting_set --app=$app --key=require_prosody --value="1" diff --git a/scripts/upgrade b/scripts/upgrade index f96472a..1782ea2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -218,9 +218,11 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st if ! yunohost app list | grep -q "prosody" then - yunohost app install prosody --force + yunohost tools update + yunohost app install prosody else - yunohost app upgrade prosody --force + yunohost tools update + yunohost app upgrade prosody fi ynh_app_setting_set --app=$app --key=require_prosody --value="1" From 7b0573e657520e5a2e1c5ed55e7f2ffb79dfbdb3 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 8 Feb 2022 01:41:44 +0100 Subject: [PATCH 6/7] Fix logs and .cache too big --- conf/production.yaml | 2 +- scripts/install | 16 ++++++++++------ scripts/remove | 10 ++++++++++ scripts/restore | 9 ++++----- scripts/upgrade | 16 +++++++++++----- 5 files changed, 36 insertions(+), 17 deletions(-) diff --git a/conf/production.yaml b/conf/production.yaml index 275c91f..3910e55 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -88,7 +88,7 @@ storage: videos: '__DATADIR__/videos/' streaming_playlists: '__DATADIR__/streaming-playlists/' redundancy: '__DATADIR__/redundancy/' - logs: '__DATADIR__/logs/' + logs: '/var/log/__APP__/' previews: '__DATADIR__/previews/' thumbnails: '__DATADIR__/thumbnails/' torrents: '__DATADIR__/torrents/' diff --git a/scripts/install b/scripts/install index 65885a7..c0e23e8 100644 --- a/scripts/install +++ b/scripts/install @@ -55,7 +55,6 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=datadir --value=$datadir #================================================= # STANDARD MODIFICATIONS @@ -163,11 +162,13 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Creating a data directory..." +ynh_app_setting_set --app=$app --key=datadir --value=$datadir + mkdir -p $datadir -chmod 750 "$datadir/.." -chmod -R o-rwx "$datadir/.." -chown -R $app:www-data "$datadir/.." +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" #================================================= # BUILD YARN DEPENDENCIES @@ -177,6 +178,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd #================================================= @@ -207,6 +209,8 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Starting a systemd service..." +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" @@ -253,14 +257,14 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" ynh_script_progression --message="Configuring log rotation..." # Use logrotate to manage application logfile(s) -ynh_use_logrotate --logfile="$datadir/logs/peertube.log" +ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port +yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $rtmp_port #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index b88efa1..e61e3c0 100644 --- a/scripts/remove +++ b/scripts/remove @@ -151,6 +151,16 @@ then ynh_exec_warn_less yunohost firewall disallow TCP $rtmp_port fi +#================================================= +# SPECIFIC REMOVE +#================================================= +# REMOVE VARIOUS FILES +#================================================= +ynh_script_progression --message="Removing various files..." + +# Remove the log files +ynh_secure_remove --file="/var/log/$app" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 08d1ae6..d12ada6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -60,7 +60,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR @@ -99,9 +99,6 @@ ynh_install_nodejs --nodejs_version=$NODEJS_VERSION # Install dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -# Install Yarn -ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" - if ! yunohost app list | grep -q "prosody" then yunohost tools update @@ -143,6 +140,8 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Restoring the logrotate configuration..." +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= @@ -150,7 +149,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port +yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $rtmp_port #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 1782ea2..83b35b5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -143,13 +143,18 @@ fi ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" yunohost tools regen-conf nginx +# Remove old log file +ynh_secure_remove --file="$datadir/logs" +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" + #================================================= # CREATE DEDICATED USER #================================================= ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -236,9 +241,9 @@ ynh_script_progression --message="Creating a data directory..." mkdir -p $datadir -chmod 750 "$datadir/.." -chmod -R o-rwx "$datadir/.." -chown -R $app:www-data "$datadir/.." +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" #================================================= # UPDATE A CONFIG FILE @@ -261,6 +266,7 @@ ynh_script_progression --message="Building Yarn dependencies..." pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install --production --pure-lockfile + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean popd #================================================= @@ -331,7 +337,7 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="$app daemon for Peertube" --log="$datadir/logs/peertube.log" --needs_exposed_ports $rtmp_port +yunohost service add $app --description="$app daemon for Peertube" --log="/var/log/$app/$app.log" --needs_exposed_ports $rtmp_port #================================================= # START SYSTEMD SERVICE From fd4049c7b8669aae7fd8bea3f5dd6389bf6b6f66 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 8 Feb 2022 20:01:12 +0100 Subject: [PATCH 7/7] reduce tests made --- check_process | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/check_process b/check_process index 08c4b32..68a1f9d 100644 --- a/check_process +++ b/check_process @@ -13,13 +13,13 @@ setup_public=1 upgrade=1 # 3.2.1~ynh1 - upgrade=1 from_commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf + # upgrade=1 from_commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf # 3.2.1~ynh4 - upgrade=1 from_commit=08bf3fce3ad99e27e7f7d251838a9f9c63243e44 + # upgrade=1 from_commit=08bf3fce3ad99e27e7f7d251838a9f9c63243e44 # 3.3.0~ynh2 - upgrade=1 from_commit=f3bb02002c8fa28748744302475139b6fcf7c651 + # upgrade=1 from_commit=f3bb02002c8fa28748744302475139b6fcf7c651 # 3.3.0~ynh3 - upgrade=1 from_commit=ed59a268e93910f8b35b0f87399f91b8cad9ede0 + # upgrade=1 from_commit=ed59a268e93910f8b35b0f87399f91b8cad9ede0 # 3.4.0~ynh1 upgrade=1 from_commit=83a06ca4c96ccd941b49647b3698db2c6b771b79 # 4.0.0~ynh1