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 #330 from YunoHost-Apps/ovh_fix_testing

Upgrade to version 4.2.0
This commit is contained in:
yalh76 2022-06-17 13:37:56 +02:00 committed by GitHub
commit 90564a226b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 603 additions and 244 deletions

133
.github/workflows/updater.sh vendored Normal file
View file

@ -0,0 +1,133 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
# Remove this exit command when you are ready to run this Action
#exit 1
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*".tar.xz")
src="app"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.xz ]]; then
extension=tar.xz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_EXTRACT=true
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

50
.github/workflows/updater.yml vendored Normal file
View file

@ -0,0 +1,50 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -1,7 +0,0 @@
language: python
before_install:
- git clone https://github.com/YunoHost/package_linter /tmp/package_linter
script:
- /tmp/package_linter/package_linter.py ./

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# PeerTube for YunoHost # PeerTube for YunoHost
[![Integration level](https://dash.yunohost.org/integration/peertube.svg)](https://dash.yunohost.org/appci/app/peertube) ![](https://ci-apps.yunohost.org/ci/badges/peertube.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/peertube.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/peertube.svg)](https://dash.yunohost.org/appci/app/peertube) ![Working status](https://ci-apps.yunohost.org/ci/badges/peertube.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/peertube.maintain.svg)
[![Install PeerTube with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=peertube) [![Install PeerTube with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=peertube)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -18,13 +18,13 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using <a href="https://github.com/feross/webtorrent">WebTorrent</a>. Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using <a href="https://github.com/feross/webtorrent">WebTorrent</a>.
**Shipped version:** 4.0.0~ynh2 **Shipped version:** 4.2.0~ynh1
**Demo:** http://peertube.cpy.re **Demo:** http://peertube.cpy.re
## Screenshots ## Screenshots
![](./doc/screenshots/screenshot1.png) ![Screenshot of PeerTube](./doc/screenshots/screenshot1.png)
## Disclaimers / important information ## Disclaimers / important information
@ -42,40 +42,44 @@ 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
* Official app website: https://joinpeertube.org/fr/ * Official app website: <https://joinpeertube.org/fr>
* Official admin documentation: https://docs.joinpeertube.org/ * Official admin documentation: <https://docs.joinpeertube.org>
* Upstream app code repository: https://github.com/Chocobozzz/PeerTube/ * Upstream app code repository: <https://github.com/Chocobozzz/PeerTube>
* YunoHost documentation for this app: https://yunohost.org/app_peertube * YunoHost documentation for this app: <https://yunohost.org/app_peertube>
* Report a bug: https://github.com/YunoHost-Apps/peertube_ynh/issues * Report a bug: <https://github.com/YunoHost-Apps/peertube_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/peertube_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/peertube_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug
or or
sudo yunohost app upgrade peertube -u https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug sudo yunohost app upgrade peertube -u https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,14 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# PeerTube pour YunoHost # PeerTube pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/peertube.svg)](https://dash.yunohost.org/appci/app/peertube) ![](https://ci-apps.yunohost.org/ci/badges/peertube.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/peertube.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/peertube.svg)](https://dash.yunohost.org/appci/app/peertube) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/peertube.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/peertube.maintain.svg)
[![Installer PeerTube avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=peertube) [![Installer PeerTube avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=peertube)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer PeerTube rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer PeerTube rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
@ -14,21 +18,16 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
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> 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>
**Version incluse :** 4.0.0~ynh2 **Version incluse :** 4.2.0~ynh1
**Démo :** http://peertube.cpy.re **Démo :** http://peertube.cpy.re
## Captures d'écran ## Captures d'écran
![](./doc/screenshots/screenshot1.png) ![Capture d'écran de PeerTube](./doc/screenshots/screenshot1.png)
## 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,47 +40,44 @@ 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
* Site officiel de l'app : https://joinpeertube.org/fr/ * Site officiel de l'app : <https://joinpeertube.org/fr>
* Documentation officielle de l'admin : https://docs.joinpeertube.org/ * Documentation officielle de l'admin : <https://docs.joinpeertube.org>
* Dépôt de code officiel de l'app : https://github.com/Chocobozzz/PeerTube/ * Dépôt de code officiel de l'app : <https://github.com/Chocobozzz/PeerTube>
* Documentation YunoHost pour cette app : https://yunohost.org/app_peertube * Documentation YunoHost pour cette app : <https://yunohost.org/app_peertube>
* Signaler un bug : https://github.com/YunoHost-Apps/peertube_ynh/issues * Signaler un bug : <https://github.com/YunoHost-Apps/peertube_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/peertube_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/peertube_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade peertube -u https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug sudo yunohost app upgrade peertube -u https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps **Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -1,9 +1,8 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
email="admin@example.com"
is_public=1 is_public=1
port="9000" admin="john"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=0 setup_sub_dir=0
@ -13,17 +12,21 @@
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
upgrade=1 from_commit=7c2bb0bb6a91b6b957b734f684aa3d64da892f4c upgrade=1 from_commit=7c2bb0bb6a91b6b957b734f684aa3d64da892f4c
# 4.0.0~ynh2
upgrade=1 from_commit=6995b27972e27c6cf8ee3e1f23a2de5cc8c8e8ee
# 4.1.1~ynh1
upgrade=1 from_commit=24c8333d70312e9dcf8d278e64787ca561a10b2e
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
port_already_use=0 port_already_use=0
@ -31,16 +34,3 @@
;;; Options ;;; Options
Email=anmol@datamol.org;yalh@yahoo.com Email=anmol@datamol.org;yalh@yahoo.com
Notification=yes Notification=yes
;;; Upgrade options
; commit=f4b43fd85ad3a169d27c53865a13548e44f17ebf
name=3.2.1~ynh1
; commit=08bf3fce3ad99e27e7f7d251838a9f9c63243e44
name=3.2.1~ynh4
; commit=f3bb02002c8fa28748744302475139b6fcf7c651
name=3.3.0~ynh2
; commit=ed59a268e93910f8b35b0f87399f91b8cad9ede0
name=3.3.0~ynh3
; commit=83a06ca4c96ccd941b49647b3698db2c6b771b79
name=3.4.0~ynh1
; commit=7c2bb0bb6a91b6b957b734f684aa3d64da892f4c
name=4.0.0~ynh1

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v4.0.0/peertube-v4.0.0.tar.xz SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v4.2.0/peertube-v4.2.0.tar.xz
SOURCE_SUM=afbc6ef1f950cb80fc1b61ef83e27ab25d2c7ec8f605e17bc59f8635848862da SOURCE_SUM=b655e52096fde65d72d5ff29f153c8d122fa253154a4bad127e6f392585fd3ab
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.xz SOURCE_FORMAT=tar.xz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -26,14 +26,14 @@ location = /api/v1/videos/upload-resumable {
} }
location / { location / {
try_files /dev/null @api; try_files /dev/null @api;
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }
location = /api/v1/videos/upload { location ~ ^/api/v1/videos/(upload|([^/]+/studio/edit))$ {
limit_except POST HEAD { deny all; } limit_except POST HEAD { deny all; }
# This is the maximum upload size, which roughly matches the maximum size of a video file. # This is the maximum upload size, which roughly matches the maximum size of a video file.
@ -119,7 +119,7 @@ tcp_nodelay on; # don't buffer data sent, good for small data burs
# Bypass PeerTube for performance reasons. Optional. # Bypass PeerTube for performance reasons. Optional.
# Should be consistent with client-overrides assets list in /server/controllers/client.ts # Should be consistent with client-overrides assets list in /server/controllers/client.ts
location ~ ^/client/(assets/images/(icons/icon-36x36\.png|icons/icon-48x48\.png|icons/icon-72x72\.png|icons/icon-96x96\.png|icons/icon-144x144\.png|icons/icon-192x192\.png|icons/icon-512x512\.png|logo\.svg|favicon\.png|default-playlist\.jpg|default-avatar-account\.png|default-avatar-video-channel\.png))$ { location ~ ^/client/(assets/images/(icons/icon-36x36\.png|icons/icon-48x48\.png|icons/icon-72x72\.png|icons/icon-96x96\.png|icons/icon-144x144\.png|icons/icon-192x192\.png|icons/icon-512x512\.png|logo\.svg|favicon\.png|default-playlist\.jpg|default-avatar-account\.png|default-avatar-account-48x48\.png|default-avatar-video-channel\.png|default-avatar-video-channel-48x48\.png))$ {
more_set_headers "Cache-Control : public, max-age=31536000, immutable"; # Cache 1 year more_set_headers "Cache-Control : public, max-age=31536000, immutable"; # Cache 1 year
try_files __DATADIR__/client-overrides/$1 __FINALPATH__/client/dist/$1 @api; try_files __DATADIR__/client-overrides/$1 __FINALPATH__/client/dist/$1 @api;

View file

@ -45,7 +45,7 @@ database:
# Redis server for short time storage # Redis server for short time storage
# You can also specify a 'socket' path to a unix socket but first need to # You can also specify a 'socket' path to a unix socket but first need to
# comment out hostname and port # set 'hostname' and 'port' to null
redis: redis:
hostname: 'localhost' hostname: 'localhost'
port: 6379 port: 6379
@ -73,12 +73,31 @@ email:
subject: subject:
prefix: '[PeerTube]' prefix: '[PeerTube]'
# PeerTube client/interface configuration # Update default PeerTube values
client: # Set by API when the field is not provided and put as default value in client
videos: defaults:
miniature: # Change default values when publishing a video (upload/import/go Live)
# By default PeerTube client displays author username publish:
prefer_author_display_name: false download_enabled: true
comments_enabled: true
# public = 1, unlisted = 2, private = 3, internal = 4
privacy: 1
# CC-BY = 1, CC-SA = 2, CC-ND = 3, CC-NC = 4, CC-NC-SA = 5, CC-NC-ND = 6, Public Domain = 7
# You can also choose a custom licence value added by a plugin
# No licence by default
licence: null
p2p:
# Enable P2P by default
# Can be enabled/disabled by anonymous users and logged in users
webapp:
enabled: true
embed:
enabled: true
# From the project root directory # From the project root directory
storage: storage:
@ -88,7 +107,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/'
@ -115,6 +134,9 @@ object_storage:
region: 'us-east-1' region: 'us-east-1'
# Set this ACL on each uploaded object
upload_acl: 'public'
credentials: credentials:
# You can also use AWS_ACCESS_KEY_ID env variable # You can also use AWS_ACCESS_KEY_ID env variable
access_key_id: '' access_key_id: ''
@ -155,7 +177,6 @@ trending:
interval_days: 7 # Compute trending videos for the last x days interval_days: 7 # Compute trending videos for the last x days
algorithms: algorithms:
enabled: enabled:
- 'best' # adaptation of Reddit's 'Best' algorithm (Hot minus History)
- 'hot' # adaptation of Reddit's 'Hot' algorithm - 'hot' # adaptation of Reddit's 'Hot' algorithm
- 'most-viewed' # default, used initially by PeerTube as the trending page - 'most-viewed' # default, used initially by PeerTube as the trending page
- 'most-liked' - 'most-liked'
@ -235,6 +256,13 @@ views:
ip_view_expiration: '1 hour' ip_view_expiration: '1 hour'
# Used to get country location of views of local videos
geo_ip:
enabled: true
country:
database_url: 'https://dbip.mirror.framasoft.org/files/dbip-country-lite-latest.mmdb'
plugins: plugins:
# The website PeerTube will ask for available PeerTube plugins and themes # The website PeerTube will ask for available PeerTube plugins and themes
# This is an unmoderated plugin index, so only install plugins/themes you trust # This is an unmoderated plugin index, so only install plugins/themes you trust
@ -287,7 +315,7 @@ cache:
admin: admin:
# Used to generate the root user at first startup # Used to generate the root user at first startup
# And to receive emails from the contact form # And to receive emails from the contact form
email: '__ADMIN_EMAIL__' email: '__ADMIN_MAIL__'
contact_form: contact_form:
enabled: true enabled: true
@ -381,19 +409,43 @@ live:
# /!\ transcoding.enabled (and not live.transcoding.enabled) has to be true to create a replay # /!\ transcoding.enabled (and not live.transcoding.enabled) has to be true to create a replay
allow_replay: true allow_replay: true
# Allow your users to change latency settings (small latency/default/high latency)
# Small latency live streams cannot use P2P
# High latency live streams can increase P2P ratio
latency_setting:
enabled: true
# Your firewall should accept traffic from this port in TCP if you enable live # Your firewall should accept traffic from this port in TCP if you enable live
rtmp: rtmp:
enabled: true enabled: true
# Listening hostname/port for RTMP server
# '::' to listen on IPv6 and IPv4, '0.0.0.0' to listen on IPv4
# Use null to automatically listen on '::' if IPv6 is available, or '0.0.0.0' otherwise
hostname: null
port: 1935 port: 1935
# Public hostname of your RTMP server
# Use null to use the same value than `webserver.hostname`
public_hostname: null
rtmps: rtmps:
enabled: false enabled: false
# Listening hostname/port for RTMPS server
# '::' to listen on IPv6 and IPv4, '0.0.0.0' to listen on IPv4
# Use null to automatically listen on '::' if IPv6 is available, or '0.0.0.0' otherwise
hostname: null
port: 1936 port: 1936
# Absolute path
# Absolute paths
key_file: '' key_file: ''
# Absolute path
cert_file: '' cert_file: ''
# Public hostname of your RTMPS server
# Use null to use the same value than `webserver.hostname`
public_hostname: null
# Allow to transcode the live streaming in multiple live resolutions # Allow to transcode the live streaming in multiple live resolutions
transcoding: transcoding:
enabled: true enabled: true
@ -414,13 +466,21 @@ live:
1440p: false 1440p: false
2160p: false 2160p: false
video_studio:
# Enable video edition by users (cut, add intro/outro, add watermark etc)
# If enabled, users can create transcoding tasks as they wish
enabled: false
import: import:
# Add ability for your users to import remote videos (from YouTube, torrent...) # Add ability for your users to import remote videos (from YouTube, torrent...)
videos: videos:
# Amount of import jobs to execute in parallel # Amount of import jobs to execute in parallel
concurrency: 1 concurrency: 1
http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html
http:
# We recommend to use a HTTP proxy if you enable HTTP import to prevent private URL access from this server
# See https://docs.joinpeertube.org/maintain-configuration?id=security for more information
enabled: false enabled: false
youtube_dl_release: youtube_dl_release:
@ -429,18 +489,22 @@ import:
# Examples: # Examples:
# * https://api.github.com/repos/ytdl-org/youtube-dl/releases # * https://api.github.com/repos/ytdl-org/youtube-dl/releases
# * https://api.github.com/repos/yt-dlp/yt-dlp/releases # * https://api.github.com/repos/yt-dlp/yt-dlp/releases
url: 'https://api.github.com/repos/yt-dlp/yt-dlp/releases' url: 'https://yt-dl.org/downloads/latest/youtube-dl'
# youtube-dl binary name # youtube-dl binary name
# yt-dlp is also supported # yt-dlp is also supported
name: 'yt-dlp' name: 'youtube-dl'
# Path to the python binary to execute for youtube-dl or yt-dlp # Path to the python binary to execute for youtube-dl or yt-dlp
python_path: '/usr/bin/python3' python_path: '/usr/bin/python3'
# IPv6 is very strongly rate-limited on most sites supported by youtube-dl # IPv6 is very strongly rate-limited on most sites supported by youtube-dl
force_ipv4: false force_ipv4: false
torrent: # Magnet URI or torrent file (use classic TCP/UDP/WebSeed to download the file) # Magnet URI or torrent file (use classic TCP/UDP/WebSeed to download the file)
torrent:
# We recommend to only enable magnet URI/torrent import if you trust your users
# See https://docs.joinpeertube.org/maintain-configuration?id=security for more information
enabled: false enabled: false
auto_blacklist: auto_blacklist:
@ -593,3 +657,21 @@ search:
disable_local_search: false disable_local_search: false
# If you did not disable local search, you can decide to use the search index by default # If you did not disable local search, you can decide to use the search index by default
is_default_search: false is_default_search: false
# PeerTube client/interface configuration
client:
videos:
miniature:
# By default PeerTube client displays author username
prefer_author_display_name: false
display_author_avatar: false
resumable_upload:
# Max size of upload chunks, e.g. '90MB'
# If null, it will be calculated based on network speed
max_chunk_size: null
menu:
login:
# If you enable only one external auth plugin
# You can automatically redirect your users on this external platform when they click on the login button
redirect_on_single_external_auth: false

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

@ -6,14 +6,14 @@
"en": "Video streaming platform using P2P directly in the web browser, connected to a federated network", "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network",
"fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé" "fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé"
}, },
"version": "4.0.0~ynh2", "version": "4.2.0~ynh1",
"url": "https://github.com/Chocobozzz/PeerTube", "url": "https://github.com/Chocobozzz/PeerTube",
"upstream": { "upstream": {
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"website": "https://joinpeertube.org/fr/", "website": "https://joinpeertube.org/fr",
"demo": "http://peertube.cpy.re", "demo": "http://peertube.cpy.re",
"admindoc": "https://docs.joinpeertube.org/", "admindoc": "https://docs.joinpeertube.org",
"code": "https://github.com/Chocobozzz/PeerTube/" "code": "https://github.com/Chocobozzz/PeerTube"
}, },
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"maintainer": [ "maintainer": [
@ -33,19 +33,19 @@
"nginx" "nginx"
], ],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain" "type": "domain"
}, },
{
"name": "admin",
"type": "user"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"default": true "default": true
},
{
"name": "admin",
"type": "user"
} }
] ]
} }

View file

@ -6,8 +6,9 @@
# dependencies used by the app # dependencies used by the app
pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https" pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https"
ynh_app_dependencies="prosody"
NODEJS_VERSION=16 nodejs_version=16
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -9,6 +9,7 @@
source _common.sh source _common.sh
source ynh_redis source ynh_redis
source ynh_send_readme_to_admin__2 source ynh_send_readme_to_admin__2
source ynh_apps
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -27,9 +28,9 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/" path_url="/"
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
admin_email=$(ynh_user_get_info --username=$admin --key="mail") admin=$YNH_APP_ARG_ADMIN
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
admin_pass=$(ynh_string_random --length=24) admin_pass=$(ynh_string_random --length=24)
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -55,7 +56,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
@ -65,7 +65,7 @@ ynh_app_setting_set --app=$app --key=datadir --value=$datadir
ynh_script_progression --message="Finding an available port..." ynh_script_progression --message="Finding an available port..."
# Find an available port # Find an available port
port=$(ynh_find_port --port=9000) port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port ynh_app_setting_set --app=$app --key=port --value=$port
# PeerTube Live port # PeerTube Live port
@ -82,13 +82,10 @@ ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." ynh_script_progression --message="Installing dependencies..."
# Install nodejs ynh_install_apps --apps="$ynh_app_dependencies"
#ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_app_dependencies $pkg_dependencies
#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" ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#================================================= #=================================================
@ -97,7 +94,7 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
ynh_script_progression --message="Configuring system user..." ynh_script_progression --message="Configuring system user..."
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# CREATE A POSTGRESQL DATABASE # CREATE A POSTGRESQL DATABASE
@ -106,12 +103,11 @@ ynh_script_progression --message="Creating a PostgreSQL database..."
db_name="peertube_${app}" db_name="peertube_${app}"
db_user=$(ynh_sanitize_dbid --db_name=$app) db_user=$(ynh_sanitize_dbid --db_name=$app)
db_pwd=$(ynh_string_random --length=30)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_user --value=$db_user ynh_app_setting_set --app=$app --key=db_user --value=$db_user
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
@ -130,7 +126,6 @@ ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
[ -d "../sources/patches-$(ynh_app_upstream_version)" ] && cp -a "../sources/patches-$(ynh_app_upstream_version)" "../sources/patches"
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path" chmod 750 "$final_path"
@ -152,11 +147,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 +162,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 +194,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 +205,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 +223,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 +242,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
@ -277,7 +286,7 @@ ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
ynh_script_progression --message="Sending a readme for the admin..." ynh_script_progression --message="Sending a readme for the admin..."
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install' ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_mail --type='install'
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -9,6 +9,7 @@
source _common.sh source _common.sh
source ynh_redis source ynh_redis
source ynh_send_readme_to_admin__2 source ynh_send_readme_to_admin__2
source ynh_apps
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -25,7 +26,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user) db_user=$(ynh_app_setting_get --app=$app --key=db_user)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
admin_email=$(ynh_user_get_info --username=$admin --key="mail") admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
datadir=$(ynh_app_setting_get --app=$app --key=datadir) datadir=$(ynh_app_setting_get --app=$app --key=datadir)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
@ -109,23 +110,28 @@ ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_nodejs ynh_remove_nodejs
ynh_remove_app_dependencies ynh_remove_app_dependencies
ynh_remove_apps
#================================================= #=================================================
# CLOSE A PORT # CLOSE A PORT
#================================================= #=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
if yunohost firewall list | grep -q "\- $rtmp_port$" if yunohost firewall list | grep -q "\- $rtmp_port$"
then then
ynh_script_progression --message="Closing port $rtmp_port..." ynh_script_progression --message="Closing port $rtmp_port..."
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
#================================================= #=================================================
@ -141,7 +147,7 @@ ynh_system_user_delete --username=$app
#================================================= #=================================================
ynh_script_progression --message="Sending a readme for the admin..." ynh_script_progression --message="Sending a readme for the admin..."
ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_email --type='remove' ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_mail --type='remove'
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -8,6 +8,7 @@
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source ../settings/scripts/ynh_apps
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -34,7 +35,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user) db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================
@ -47,20 +47,13 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
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
@ -93,21 +86,25 @@ chown -R $app:www-data "$datadir"
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." ynh_script_progression --message="Reinstalling dependencies..."
# Install nodejs ynh_install_apps --apps="$ynh_app_dependencies"
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_app_dependencies $pkg_dependencies
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" ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE POSTGRESQL DATABASE # RESTORE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." ynh_script_progression --message="Restoring the PostgreSQL database..."
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
@ -132,6 +129,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 +138,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

@ -8,6 +8,7 @@
source _common.sh source _common.sh
source ynh_redis source ynh_redis
source ynh_apps
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -19,15 +20,15 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port) rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user) db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) datadir=$(ynh_app_setting_get --app=$app --key=datadir)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
admin_email=$(ynh_user_get_info --username=$admin --key="mail")
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
#================================================= #=================================================
@ -67,7 +68,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..."
ynh_app_setting_delete --app=$app --key=admin_pass ynh_app_setting_delete --app=$app --key=admin_pass
ynh_app_setting_delete --app=$app --key=admin_email ynh_app_setting_delete --app=$app --key=admin_mail
# If db_name doesn't exist, create it # If db_name doesn't exist, create it
if [ -z "$db_name" ]; then if [ -z "$db_name" ]; then
@ -139,13 +140,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
@ -169,7 +179,6 @@ then
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
[ -d "../sources/patches-$(ynh_app_upstream_version)" ] && cp -a "../sources/patches-$(ynh_app_upstream_version)" "../sources/patches"
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
#Copy the admin saved settings from tmp directory to final path #Copy the admin saved settings from tmp directory to final path
@ -190,6 +199,16 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_apps --apps="$ynh_app_dependencies"
ynh_install_app_dependencies $pkg_dependencies
#ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -198,24 +217,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
# Install nodejs
#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"
# Remove hook
ynh_secure_remove --file="/usr/share/yunohost/hooks/conf_regen/15-nginx_$app"
yunohost tools regen-conf nginx
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
@ -225,9 +226,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
@ -248,8 +249,9 @@ chown $app:$app "$final_path/config/local-production.json"
ynh_script_progression --message="Building Yarn dependencies..." 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,17 +276,33 @@ 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 popd
#================================================= #=================================================
# PEERTUBE 4.0.0 UPGRADE MIGRATION SCRIPT # 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
#=================================================
# PEERTUBE UPGRADE MIGRATION SCRIPT
#================================================= #=================================================
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
fi
if ynh_compare_current_package_version --comparison lt --version 4.2.0~ynh1; then
ynh_script_progression --message="Running Peertube 4.2.0 migration script..."
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_node dist/scripts/migrations/peertube-4.2.js
popd popd
fi fi
@ -311,7 +329,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

110
scripts/ynh_apps Normal file
View file

@ -0,0 +1,110 @@
#!/bin/bash
# Install others YunoHost apps
#
# usage: ynh_install_apps --apps="appfoo?domain=domain.foo&path=/foo appbar?domain=domain.bar&path=/bar&admin=USER&language=fr&is_public=1&pass?word=pass&port=666"
# | arg: -a, --apps= - apps to install
#
# Requires YunoHost version *.*.* or higher.
ynh_install_apps() {
# Declare an array to define the options of this helper.
local legacy_args=a
local -A args_array=([a]=apps=)
local apps
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
# Split the list of apps in an array
local apps_list=($(echo $apps | tr " " "\n"))
local apps_dependencies=""
# For each app
for one_app_and_its_args in "${apps_list[@]}"
do
# Retrieve the name of the app (part before ?)
local one_app=$(cut -d "?" -f1 <<< "$one_app_and_its_args")
[ -z "$one_app" ] && ynh_die --message="You didn't provided a YunoHost app to install"
yunohost tools update apps
# Installing or upgrading the app depending if it's installed or not
if ! yunohost app list --output-as json --quiet | jq -e --arg id $one_app '.apps[] | select(.id == $id)' >/dev/null
then
# Retrieve the arguments of the app (part after ?)
local one_argument=$(cut -d "?" -f2- <<< "$one_app_and_its_args")
[ ! -z "$one_argument" ] && one_argument="--args $one_argument"
# Install the app with its arguments
yunohost app install $one_app $one_argument
else
# Upgrade the app
yunohost app upgrade $one_app
fi
if [ ! -z "$apps_dependencies" ]
then
apps_dependencies="$apps_dependencies, $one_app"
else
apps_dependencies="$one_app"
fi
done
ynh_app_setting_set --app=$app --key=apps_dependencies --value="$apps_dependencies"
}
# Remove other YunoHost apps
#
# Other YunoHost apps will be removed only if no other apps need them.
#
# usage: ynh_remove_apps
#
# Requires YunoHost version *.*.* or higher.
ynh_remove_apps() {
# Retrieve the apps dependencies of the app
local apps_dependencies=$(ynh_app_setting_get --app=$app --key=apps_dependencies)
ynh_app_setting_delete --app=$app --key=apps_dependencies
if [ ! -z "$apps_dependencies" ]
then
# Split the list of apps dependencies in an array
local apps_dependencies_list=($(echo $apps_dependencies | tr ", " "\n"))
# For each apps dependencies
for one_app in "${apps_dependencies_list[@]}"
do
# Retrieve the list of installed apps
local installed_apps_list=$(yunohost app list --output-as json --quiet | jq -r .apps[].id)
local required_by=""
local installed_app_required_by=""
# For each other installed app
for one_installed_app in $installed_apps_list
do
# Retrieve the other apps dependencies
one_installed_apps_dependencies=$(ynh_app_setting_get --app=$one_installed_app --key=apps_dependencies)
if [ ! -z "$one_installed_apps_dependencies" ]
then
one_installed_apps_dependencies_list=($(echo $one_installed_apps_dependencies | tr ", " "\n"))
# For each dependency of the other apps
for one_installed_app_dependency in "${one_installed_apps_dependencies_list[@]}"
do
if [[ $one_installed_app_dependency == $one_app ]]; then
required_by="$required_by $one_installed_app"
fi
done
fi
done
# If $one_app is no more required
if [[ -z "$required_by" ]]
then
# Remove $one_app
ynh_print_info --message="Removing of $one_app"
yunohost app remove $one_app --purge
else
ynh_print_info --message="$one_app was not removed because it's still required by${required_by}"
fi
done
fi
}

View file

@ -1,26 +0,0 @@
diff '--color=auto' -ru ./dist/server/helpers/youtube-dl/youtube-dl-cli.js ./dist/server/helpers/youtube-dl/youtube-dl-cli.js
--- ./dist/server/helpers/youtube-dl/youtube-dl-cli.js 2021-12-13 09:22:44.000000000 +0100
+++ ./dist/server/helpers/youtube-dl/youtube-dl-cli.js 2022-01-11 22:35:52.992330841 +0100
@@ -104,7 +104,8 @@
let completeArgs = this.wrapWithProxyOptions(args);
completeArgs = this.wrapWithIPOptions(completeArgs);
completeArgs = this.wrapWithFFmpegOptions(completeArgs);
- const output = yield (0, execa_1.default)('python', [youtubeDLBinaryPath, ...completeArgs, url], processOptions);
+ const { PYTHON_PATH } = config_1.CONFIG.IMPORT.VIDEOS.HTTP.YOUTUBE_DL_RELEASE;
+ const output = yield (0, execa_1.default)(PYTHON_PATH, [youtubeDLBinaryPath, ...completeArgs, url], processOptions);
logger_1.logger.debug('Runned youtube-dl command.', Object.assign({ command: output.command }, lTags()));
return output.stdout
? output.stdout.trim().split(/\r?\n/)
diff '--color=auto' -ru ./dist/server/initializers/config.js ./dist/server/initializers/config.js
--- ./dist/server/initializers/config.js 2021-12-13 09:22:43.000000000 +0100
+++ ./dist/server/initializers/config.js 2022-01-11 22:35:51.812344562 +0100
@@ -295,7 +295,8 @@
get ENABLED() { return config.get('import.videos.http.enabled'); },
YOUTUBE_DL_RELEASE: {
get URL() { return config.get('import.videos.http.youtube_dl_release.url'); },
- get NAME() { return config.get('import.videos.http.youtube_dl_release.name'); }
+ get NAME() { return config.get('import.videos.http.youtube_dl_release.name'); },
+ get PYTHON_PATH() { return config.get('import.videos.http.youtube_dl_release.python_path'); }
},
get FORCE_IPV4() { return config.get('import.videos.http.force_ipv4'); }
},