1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/peertube_ynh.git synced 2024-09-03 19:56:29 +02:00

Merge pull request #306 from YunoHost-Apps/testing

Peertube plugin livechat
This commit is contained in:
yalh76 2022-02-10 20:34:43 +01:00 committed by GitHub
commit 6995b27972
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 170 additions and 87 deletions

View file

@ -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. 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): ### IMPORTANT POINT TO READ BEFORE INSTALLING
* Require **dedicated domain** like **peertube.domain.tld**. * Require **dedicated domain** like **peertube.domain.tld**.
* Admin username is: **root**. * Admin username is: **root**.
* **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation. * **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. * 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**. * 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 $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576
$ mkswap /swapfile $ mkswap /swapfile
$ swapon /swapfile $ swapon /swapfile
$ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab $ 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) * 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)** * **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
* 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 ## Documentation and resources

View file

@ -24,11 +24,6 @@ Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorren
## Avertissements / informations importantes ## 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 <a href="https://github.com/feross/webtorrent"> WebTorrent </a>.
### Pourquoi PeerTube? ### 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. 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. 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 ### Points importants à lire avant l'installation
* Nécessite un **domaine dédié** comme **peertube.domain.tld**.
1. Nécessite un **domaine dédié** comme **peertube.domain.tld**. * Le nom d'utilisateur de l'administrateur est: **root**.
1. 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.
1. **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.
1. 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**.
1. 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 $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576
$ mkswap /swapfile $ mkswap /swapfile
$ swapon /swapfile $ swapon /swapfile
$ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab $ 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) * 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)** * **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 #### PLUGINS
#### Support multi-utilisateur
* 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 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 ## Documentations et ressources

View file

@ -13,13 +13,13 @@
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# 3.2.1~ynh1 # 3.2.1~ynh1
upgrade=1 from_commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf # upgrade=1 from_commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf
# 3.2.1~ynh4 # 3.2.1~ynh4
upgrade=1 from_commit=08bf3fce3ad99e27e7f7d251838a9f9c63243e44 # upgrade=1 from_commit=08bf3fce3ad99e27e7f7d251838a9f9c63243e44
# 3.3.0~ynh2 # 3.3.0~ynh2
upgrade=1 from_commit=f3bb02002c8fa28748744302475139b6fcf7c651 # upgrade=1 from_commit=f3bb02002c8fa28748744302475139b6fcf7c651
# 3.3.0~ynh3 # 3.3.0~ynh3
upgrade=1 from_commit=ed59a268e93910f8b35b0f87399f91b8cad9ede0 # upgrade=1 from_commit=ed59a268e93910f8b35b0f87399f91b8cad9ede0
# 3.4.0~ynh1 # 3.4.0~ynh1
upgrade=1 from_commit=83a06ca4c96ccd941b49647b3698db2c6b771b79 upgrade=1 from_commit=83a06ca4c96ccd941b49647b3698db2c6b771b79
# 4.0.0~ynh1 # 4.0.0~ynh1

View file

@ -88,7 +88,7 @@ storage:
videos: '__DATADIR__/videos/' videos: '__DATADIR__/videos/'
streaming_playlists: '__DATADIR__/streaming-playlists/' streaming_playlists: '__DATADIR__/streaming-playlists/'
redundancy: '__DATADIR__/redundancy/' redundancy: '__DATADIR__/redundancy/'
logs: '__DATADIR__/logs/' logs: '/var/log/__APP__/'
previews: '__DATADIR__/previews/' previews: '__DATADIR__/previews/'
thumbnails: '__DATADIR__/thumbnails/' thumbnails: '__DATADIR__/thumbnails/'
torrents: '__DATADIR__/torrents/' torrents: '__DATADIR__/torrents/'

View file

@ -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. 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): ### IMPORTANT POINT TO READ BEFORE INSTALLING
* Require **dedicated domain** like **peertube.domain.tld**. * Require **dedicated domain** like **peertube.domain.tld**.
* Admin username is: **root**. * Admin username is: **root**.
* **Admin password and LDAP configuration** will be sent to the email address given at the time of the installation. * **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. * 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**. * 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 $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576
$ mkswap /swapfile $ mkswap /swapfile
$ swapon /swapfile $ swapon /swapfile
$ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab $ 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) * 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)** * **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
* 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

View file

@ -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 <a href="https://github.com/feross/webtorrent"> WebTorrent </a>.
### Pourquoi PeerTube? ### 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. 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. 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 ### Points importants à lire avant l'installation
* Nécessite un **domaine dédié** comme **peertube.domain.tld**.
1. Nécessite un **domaine dédié** comme **peertube.domain.tld**. * Le nom d'utilisateur de l'administrateur est: **root**.
1. 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.
1. **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.
1. 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**.
1. 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 $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576
$ mkswap /swapfile $ mkswap /swapfile
$ swapon /swapfile $ swapon /swapfile
$ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab $ 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) * 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)** * **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 #### PLUGINS
#### Support multi-utilisateur
* 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 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.

View file

@ -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=domain --value=$domain
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -91,6 +90,17 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Yarn # 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" 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
yunohost app install prosody
else
yunohost tools update
yunohost app upgrade prosody
fi
ynh_app_setting_set --app=$app --key=require_prosody --value="1"
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
@ -152,11 +162,13 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Creating a data directory..." ynh_script_progression --message="Creating a data directory..."
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir mkdir -p $datadir
chmod 750 "$datadir/.." chmod 750 "$datadir"
chmod -R o-rwx "$datadir/.." chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir/.." chown -R $app:www-data "$datadir"
#================================================= #=================================================
# BUILD YARN DEPENDENCIES # BUILD YARN DEPENDENCIES
@ -165,7 +177,8 @@ ynh_script_progression --message="Building Yarn dependencies..."
pushd "$final_path" pushd "$final_path"
ynh_use_nodejs 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
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean
popd popd
#================================================= #=================================================
@ -196,6 +209,8 @@ ynh_add_systemd_config
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
mkdir -p "/var/log/$app"
chown -R $app:$app "/var/log/$app"
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP server listening on localhost"
@ -205,7 +220,16 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
ynh_script_progression --message="Installing LDAP plugin..." ynh_script_progression --message="Installing LDAP plugin..."
pushd "$final_path" 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 popd
#================================================= #=================================================
@ -214,7 +238,7 @@ popd
ynh_script_progression --message="Changing PeerTube admin password..." ynh_script_progression --message="Changing PeerTube admin password..."
pushd "$final_path" 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 popd
#================================================= #=================================================
@ -233,14 +257,14 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_script_progression --message="Configuring log rotation..." ynh_script_progression --message="Configuring log rotation..."
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate --logfile="$datadir/logs/peertube.log" ynh_use_logrotate
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating 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 # START SYSTEMD SERVICE

View file

@ -110,6 +110,31 @@ ynh_script_progression --message="Removing dependencies..."
ynh_remove_nodejs ynh_remove_nodejs
ynh_remove_app_dependencies 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 # CLOSE A PORT
#================================================= #=================================================
@ -126,6 +151,16 @@ then
ynh_exec_warn_less yunohost firewall disallow TCP $rtmp_port ynh_exec_warn_less yunohost firewall disallow TCP $rtmp_port
fi 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 # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -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..." ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing) # 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 # RESTORE THE APP MAIN DIR
@ -99,8 +99,16 @@ ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
# Install dependencies # Install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Yarn if ! yunohost app list | grep -q "prosody"
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" then
yunohost tools update
yunohost app install prosody
else
yunohost tools update
yunohost app upgrade prosody
fi
ynh_app_setting_set --app=$app --key=require_prosody --value="1"
#================================================= #=================================================
# RESTORE THE POSTGRESQL DATABASE # RESTORE THE POSTGRESQL DATABASE
@ -132,6 +140,8 @@ systemctl enable $app.service --quiet
#================================================= #=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." 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" ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
@ -139,7 +149,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
ynh_script_progression --message="Integrating 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 # START SYSTEMD SERVICE

View file

@ -139,13 +139,22 @@ if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
fi fi
# Remove hook
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 # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # 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 # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -212,9 +221,16 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Yarn # 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" 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 if ! yunohost app list | grep -q "prosody"
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app" then
yunohost tools regen-conf nginx yunohost tools update
yunohost app install prosody
else
yunohost tools update
yunohost app upgrade prosody
fi
ynh_app_setting_set --app=$app --key=require_prosody --value="1"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -225,9 +241,9 @@ ynh_script_progression --message="Creating a data directory..."
mkdir -p $datadir mkdir -p $datadir
chmod 750 "$datadir/.." chmod 750 "$datadir"
chmod -R o-rwx "$datadir/.." chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir/.." chown -R $app:www-data "$datadir"
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
@ -249,7 +265,8 @@ ynh_script_progression --message="Building Yarn dependencies..."
pushd "$final_path" pushd "$final_path"
ynh_use_nodejs 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
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn cache clean
popd popd
#================================================= #=================================================
@ -274,7 +291,16 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
ynh_script_progression --message="Installing LDAP plugin..." ynh_script_progression --message="Installing LDAP plugin..."
pushd "$final_path" 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 popd
#================================================= #=================================================
@ -284,7 +310,7 @@ popd
if ynh_compare_current_package_version --comparison lt --version 4.0.0~ynh1; then 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..." ynh_script_progression --message="Running Peertube 4.0.0 migration script..."
pushd "$final_path" 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 popd
fi fi
@ -311,7 +337,7 @@ ynh_use_logrotate --non-append
#================================================= #=================================================
ynh_script_progression --message="Integrating 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 # START SYSTEMD SERVICE