From e5a3db383e1775bbfec85caba5d06991415272ae Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 23 Jun 2019 15:43:45 +0200 Subject: [PATCH 01/12] Create install steps --- README.md | 152 +++++++++++++++++------------------------------------- 1 file changed, 47 insertions(+), 105 deletions(-) diff --git a/README.md b/README.md index 8d3de65..983bb89 100644 --- a/README.md +++ b/README.md @@ -1,112 +1,54 @@ -# PeerTube app for YunoHost +# ovh_fix branch for peertube_ynh -[![Integration level](https://dash.yunohost.org/integration/peertube.svg)](https://dash.yunohost.org/appci/app/peertube) -[![Install PeerTube with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=peertube) +If installing on an ovh virtual machine or having `gyp ERR! configure error` please follow the steps indicated in Chocobozzz/PeerTube#830 (comment) -## Overview - -### What is PeerTube ? -PeerTube is a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent. - -### Why PeerTube ? - -We can't build a FOSS video streaming alternatives to YouTube, Dailymotion, Vimeo... with a centralized software. One organization alone cannot have enough money to pay bandwidth and video storage of its server. - -So we need to have a decentralized network of servers seeding videos (as [Hubzilla YunoHost](https://github.com/YunoHost-Apps/hubzilla_ynh), [Friendica YunoHost](https://github.com/YunoHost-Apps/friendica_ynh),[Mastodon YunoHost](https://github.com/YunoHost-Apps/mastodon_ynh)), [Diaspora](https://github.com/diaspora/diaspora) ([Diaspora YunoHost](https://github.com/YunoHost-Apps/diaspora_ynh)),[Funkwhale](https://funkwhale.audio) ([Funkwhale YunoHost](https://github.com/YunoHost-Apps/funkwhale_ynh))). -But it's not enough because one video could become famous and overload the server. -It's the reason why we need to use a P2P protocol to limit the server load. -Thanks to [WebTorrent](https://github.com/feross/webtorrent), we can make P2P (thus BitTorrent) inside the web browser, as of today. - -### Why is that cool ? -Servers are run independently by different people and organizations. They can apply wildly different moderation policies, so you can find or make one that fits your taste perfectly. - -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. - -**Shipped version:** 1.3.1 - -## Screenshots - -![](https://framablog.org/wp-content/uploads/2018/03/Framatube-au-lancement.png) - -## Demo - -Want to see in action? - - * [Here](http://peertube.cpy.re) are the list of instances ran by people around the world. Be a part of it. - -## Installation - -Following command line examples have been updated for ovh virtual machine, according to indications in [Chocobozzz/PeerTube#830 (comment)](https://github.com/Chocobozzz/PeerTube/issues/830#issuecomment-425942717) - -**If you are NOT hosted on OVH virtual machine or experiencing `gyp ERR! configure error`, please switch back to [master branch](https://github.com/YunoHost-Apps/peertube_ynh)** +## Steps for installing +1. Install nodejs -### Guidelines - - 1. Require **dedicated domain** like **peertube.domain.tld**. - 1. **No LDAP** support (blocked until PeerTube core upstream implements it) - 1. URL can not be changed once selected. Choose the domain wisely. - 1. You need more then **1GB** of ram. If you don't have it, please create a **swap memory**. - - $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 - $ mkswap /swapfile - $ swapon /swapfile - $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab - 1. This app is **multi-instance** (you can have more then one PeerTube instance running on a YunoHost server) - -### Installing guide - - 1. App can be installed by **running following commands**: - - $ sudo yunohost app install https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix - $ cd /var/www/peertube && sudo yarn install --production --pure-lockfile - $ sudo systemctl restart peertube - 1. Admin username is : **root**. - 1. **Admin password** will be sent to the email address given at the time of the installation. - 1. **TLS** and **starttls** are disabled for the outgoing mails. If you intent to use email address not hosted on your local server,it's advised to have a proper SMTP configured with tls and starttls settings by editing **/var/www/peertube/config/production.yml**. - - ### Update Guide - 1. App can be updated with the **following commands**: - - $ sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix peertube - $ cd /var/www/peertube && sudo yarn install --production --pure-lockfile - $ sudo systemctl restart peertube -### Dependencies - - * NodeJS, PostgreSQL. - * On Debian Jessie,backport is added for the ffmpeg package. - -## Documentation - - * Official documentation: https://docs.joinpeertube.org/ - -## YunoHost specific features - -#### Supported architectures - -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/peertube%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/peertube/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/peertube%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/peertube/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/peertube%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/peertube/) - -## Links - - * Report a bug: https://github.com/YunoHost-Apps/peertube_ynh/issues - * App website: https://joinpeertube.org/fr/ - * GitHub App website: https://github.com/Chocobozzz/PeerTube/ - * YunoHost website: https://yunohost.org/ - ---- - -Developers info ----------------- - -**Only if you want to use a testing branch for coding, instead of merging directly into master.** -Please do 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. ``` -sudo yunohost app install https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug -or -sudo yunohost app upgrade peertube -u https://github.com/YunoHost-Apps/peertube_ynh/tree/testing --debug +$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - +$ sudo apt-get install -y nodejs ``` + +2. Install the peertube with OVH fix branch. + +``` +$ yunohost app install --debug https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix +``` + +3. After installation is complete run yarn install . + +``` +$ cd /var/www/peertube && yarn install --production --pure-lockfile +``` + +4. Give proper permissions to peertube + +``` +$ chown -R peertube:peertube /var/www/peertube +``` + +5. Restart peertube and check if there is any error message. + +``` +$ service peertube restart +$ journalctl -feu peertube +``` + +6. If there is no error in red in the last lines of log. Press ctrl+c to stop the logs. + +7. Go to your domain to check if peertube is running and everthing is ok. + +8. Change your root password by this command: + +``` + $ cd /var/www/peertube && NODE_CONFIG_DIR="/var/www/peertube/config/" NODE_ENV=production npm run reset-password -- -u root +``` + +Username: root +password: created in above step + +## Steps for upgrading + From 544de6cdcb780cfe2dd84b5dd6990e883d72e1be Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 23 Jun 2019 15:46:50 +0200 Subject: [PATCH 02/12] emphasis --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 983bb89..5e57d41 100644 --- a/README.md +++ b/README.md @@ -12,43 +12,43 @@ $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - $ sudo apt-get install -y nodejs ``` -2. Install the peertube with OVH fix branch. +2. Install the peertube with **OVH fix** branch. ``` $ yunohost app install --debug https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix ``` -3. After installation is complete run yarn install . +3. After installation is complete run **yarn install**. ``` $ cd /var/www/peertube && yarn install --production --pure-lockfile ``` -4. Give proper permissions to peertube +4. Give proper **permissions** to peertube ``` $ chown -R peertube:peertube /var/www/peertube ``` -5. Restart peertube and check if there is any error message. +5. **Restart peertube** and check if there is any error message. ``` $ service peertube restart $ journalctl -feu peertube ``` -6. If there is no error in red in the last lines of log. Press ctrl+c to stop the logs. +6. If there is no **error in red** in the last lines of log. Press **ctrl+c** to stop the logs. -7. Go to your domain to check if peertube is running and everthing is ok. +7. Go to your **domain** to check if peertube is running and everthing is ok. -8. Change your root password by this command: +8. Change your **root password** by this command: ``` $ cd /var/www/peertube && NODE_CONFIG_DIR="/var/www/peertube/config/" NODE_ENV=production npm run reset-password -- -u root ``` -Username: root -password: created in above step +Username: **root** +password: **created in above step** ## Steps for upgrading From 1c0abdeaed8999b4c35e1b836c5544eeb2819ae6 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 23 Jun 2019 15:52:32 +0200 Subject: [PATCH 03/12] Add upgrade steps --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e57d41..19c781f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ $ sudo apt-get install -y nodejs 2. Install the peertube with **OVH fix** branch. ``` -$ yunohost app install --debug https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix +$ yunohost app install https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix --debug ``` 3. After installation is complete run **yarn install**. @@ -52,3 +52,26 @@ password: **created in above step** ## Steps for upgrading +1. Upgrade peertube with **OVH fix** branch. + +``` +$ yunohost app upgrade peertube -u https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix --debug +``` + +2. After upgarde is complete run **yarn install**. + +``` +$ cd /var/www/peertube && yarn install --production --pure-lockfile +``` + +3. Give proper **permissions** to peertube + +``` +$ chown -R peertube:peertube /var/www/peertube +``` + +4. **Restart peertube** and check if there is any error message. + +``` +$ service peertube restart +``` From c5e55b75087fd41ef6e3d7482f38a00a7cdd1f45 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 23 Jun 2019 15:53:45 +0200 Subject: [PATCH 04/12] spelling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 19c781f..642be73 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ password: **created in above step** $ yunohost app upgrade peertube -u https://github.com/YunoHost-Apps/peertube_ynh/tree/ovh_fix --debug ``` -2. After upgarde is complete run **yarn install**. +2. After upgrade is complete run **yarn install**. ``` $ cd /var/www/peertube && yarn install --production --pure-lockfile From a0cf63dfd8e7cc924787f26678e2f356b20328ea Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 23 Jun 2019 16:02:24 +0200 Subject: [PATCH 05/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 642be73..0576af2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ovh_fix branch for peertube_ynh -If installing on an ovh virtual machine or having `gyp ERR! configure error` please follow the steps indicated in Chocobozzz/PeerTube#830 (comment) +If installing on an ovh virtual machine or having `gyp ERR! configure error` please follow the steps below ## Steps for installing From 8c9d6363743d7349719e1901dd04ae8061c2127e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 16 Oct 2019 23:12:18 +0200 Subject: [PATCH 06/12] Upgrade to 1.4.1 --- README.md | 2 +- check_process | 2 +- conf/app.src | 4 +- conf/local-production.json | 2 + conf/production.yaml | 144 ++++++++++++++++++++++++++++++------- manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/install | 12 ++-- scripts/restore | 2 +- scripts/upgrade | 24 ++++--- 10 files changed, 150 insertions(+), 46 deletions(-) create mode 100644 conf/local-production.json diff --git a/README.md b/README.md index 0576af2..8792195 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ If installing on an ovh virtual machine or having `gyp ERR! configure error` ple 1. Install nodejs ``` -$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - +$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - $ sudo apt-get install -y nodejs ``` diff --git a/check_process b/check_process index e3662cc..1bcf34f 100644 --- a/check_process +++ b/check_process @@ -17,7 +17,7 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=b8d44ebd8b85128398d9811a05e221ba01703970 + upgrade=1 from_commit=280ba0d4a9ebb9d8948e0db97200dbcb89b6c323 backup_restore=1 multi_instance=1 # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. diff --git a/conf/app.src b/conf/app.src index b68a873..e553737 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v1.3.1/peertube-v1.3.1.tar.xz -SOURCE_SUM=57737960c07122207f0126488750d675c64403f325aea5f094408e0140e2061c +SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v1.4.1/peertube-v1.4.1.tar.xz +SOURCE_SUM=49da83b9143ac4a6a486eff7b726830923022a97c6a692722bda20044fe6cd70 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.xz SOURCE_IN_SUBDIR=true diff --git a/conf/local-production.json b/conf/local-production.json new file mode 100644 index 0000000..2c63c08 --- /dev/null +++ b/conf/local-production.json @@ -0,0 +1,2 @@ +{ +} diff --git a/conf/production.yaml b/conf/production.yaml index d41be8c..52e9c12 100644 --- a/conf/production.yaml +++ b/conf/production.yaml @@ -5,14 +5,22 @@ listen: # Correspond to your reverse proxy server_name/listen configuration webserver: https: true - hostname: '__domain__' + hostname: '__DOMAIN__' port: 443 rates_limit: + api: + # 50 attempts in 10 seconds + window: 10 seconds + max: 50 login: # 15 attempts in 5 min window: 5 minutes max: 15 + signup: + # 2 attempts in 5 min (only succeeded attempts are taken into account) + window: 5 minutes + max: 2 ask_send_email: # 3 attempts in 5 min window: 5 minutes @@ -28,9 +36,9 @@ trust_proxy: database: hostname: 'localhost' port: 5432 - suffix: '___db_name__' - username: '__db_name__' - password: '__db_pwd__' + suffix: '___DB_NAME__' + username: '__DB_NAME__' + password: '__DB_PWD__' pool: max: 5 @@ -52,24 +60,33 @@ smtp: tls: false # If you use StartTLS: false disable_starttls: true ca_file: null # Used for self signed certificates - from_address: 'webmaster@__domain__' + from_address: 'webmaster@__DOMAIN__' + +email: + body: + signature: "PeerTube" + subject: + prefix: "[PeerTube]" # From the project root directory storage: - tmp: '/home/yunohost.app/__app__/storage/tmp/' # Used to download data (imports etc), store uploaded files before processing... - avatars: '/home/yunohost.app/__app__/storage/avatars/' - videos: '/home/yunohost.app/__app__/storage/videos/' - streaming_playlists: '/home/yunohost.app/__app__/storage/streaming-playlists/' - redundancy: '/home/yunohost.app/__app__/storage/videos/' - logs: '/home/yunohost.app/__app__/storage/logs/' - previews: '/home/yunohost.app/__app__/storage/previews/' - thumbnails: '/home/yunohost.app/__app__/storage/thumbnails/' - torrents: '/home/yunohost.app/__app__/storage/torrents/' - captions: '/home/yunohost.app/__app__/storage/captions/' - cache: '/home/yunohost.app/__app__/storage/cache/' + tmp: '/home/yunohost.app/__APP__/storage/tmp/' # Use to download data (imports etc), store uploaded files before processing... + avatars: '/home/yunohost.app/__APP__/storage/avatars/' + videos: '/home/yunohost.app/__APP__/storage/videos/' + streaming_playlists: '/home/yunohost.app/__APP__/storage/streaming-playlists/' + redundancy: '/home/yunohost.app/__APP__/storage/videos/' + logs: '/home/yunohost.app/__APP__/storage/logs/' + previews: '/home/yunohost.app/__APP__/storage/previews/' + thumbnails: '/home/yunohost.app/__APP__/storage/thumbnails/' + torrents: '/home/yunohost.app/__APP__/storage/torrents/' + captions: '/home/yunohost.app/__APP__/storage/captions/' + cache: '/home/yunohost.app/__APP__/storage/cache/' + plugins: '/home/yunohost.app/__APP__/storage/plugins/' log: level: 'info' # debug/info/warning/error + rotation: + enabled : true # Enabled by default, if disabled make sure that 'storage.logs' is pointing to a folder handled by logrotate search: # Add ability to fetch remote videos/actors by their URI, that may not be federated with your instance @@ -88,8 +105,8 @@ trending: # Once you have defined your strategies, choose which instances you want to cache in admin -> manage follows -> following redundancy: videos: - check_interval: '6 hour' # How often you want to check new videos to cache - strategies: + check_interval: '1 hour' # How often you want to check new videos to cache + strategies: # Just uncomment strategies you want # - # size: '10GB' # # Minimum time the video must remain in the cache. Only accept values > 10 hours (to not overload remote instances) @@ -139,6 +156,14 @@ views: remote: max_age: -1 +plugins: + # The website PeerTube will ask for available PeerTube plugins and themes + # This is an unmoderated plugin index, so only install plugins/themes you trust + index: + enabled: true + check_latest_versions_interval: '12 hours' # How often you want to check new plugins/themes versions + url: 'https://packages.joinpeertube.org' + ############################################################################### # @@ -161,7 +186,7 @@ cache: admin: # Used to generate the root user at first startup # And to receive emails from the contact form - email: '__email__' + email: '__EMAIL__' contact_form: enabled: true @@ -197,6 +222,7 @@ transcoding: 480p: false 720p: false 1080p: false + 2160p: false # /!\ EXPERIMENTAL /!\ # /!\ Requires ffmpeg >= 4 # Generate HLS playlists and fragmented MP4 files. Better playback than with WebTorrent: @@ -225,9 +251,62 @@ auto_blacklist: instance: name: 'YunoHost PeerTube' short_description: 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.' - description: '' # Support markdown - terms: '' # Support markdown + description: 'Welcome to this PeerTube instance!' # Support markdown + terms: 'No terms for now.' # Support markdown + code_of_conduct: '' # Supports markdown + + # Who moderates the instance? What is the policy regarding NSFW videos? Political videos? etc + moderation_information: '' # Supports markdown + + # Why did you create this instance? + creation_reason: '' + + # Who is behind the instance? A single person? A non profit? + administrator: '' + + # How long do you plan to maintain this instance? + maintenance_lifetime: '' + + # How will you pay the PeerTube instance server? With you own funds? With users donations? Advertising? + business_model: '' + + # If you want to explain on what type of hardware your PeerTube instance runs + # Example: "2 vCore, 2GB RAM..." + hardware_information: '' # Supports Markdown + + # What are the main languages of your instance? To interact with your users for example + # Uncomment or add the languages you want + # List of supported languages: https://peertube.cpy.re/api/v1/videos/languages + languages: +# - en +# - es +# - fr + + # You can specify the main categories of your instance (dedicated to music, gaming or politics etc) + # Uncomment or add the category ids you want + # List of supported categories: https://peertube.cpy.re/api/v1/videos/categories + categories: +# - 1 # Music +# - 2 # Films +# - 3 # Vehicles +# - 4 # Art +# - 5 # Sports +# - 6 # Travels +# - 7 # Gaming +# - 8 # People +# - 9 # Comedy +# - 10 # Entertainment +# - 11 # News & Politics +# - 12 # How To +# - 13 # Education +# - 14 # Activism +# - 15 # Science & Technology +# - 16 # Animals +# - 17 # Kids +# - 18 # Food + default_client_route: '/videos/trending' + # Whether or not the instance is dedicated to NSFW content # Enabling it will allow other administrators to know that you are mainly federating sensitive content # Moreover, the NSFW checkbox on video upload will be automatically checked by default @@ -235,6 +314,7 @@ instance: # By default, "do_not_list" or "blur" or "display" NSFW videos # Could be overridden per user with a setting default_nsfw_policy: 'do_not_list' + customizations: javascript: '' # Directly your JavaScript code (without