From 1bab3c124882d22b5c9be78d57816acc6d27388c Mon Sep 17 00:00:00 2001
From: anmol26s <5068843+anmol26s@users.noreply.github.com>
Date: Mon, 1 Oct 2018 04:57:20 +0530
Subject: [PATCH] Upgraded to version 1.0.0-beta.15, systemd fix (#47)
* Updated dependencies and typos
* [add] French description
Description is missing in French apps list.
* Updated to version 1.0.0-beta.15
* Fix systemd and redundancy (#46)
* fixed env in systemd
* changed path while creating password
* changed path while creating password
* changed path while creating password
* changed path while creating password
* Path in systemd
* Fixed yarn in upgrade
---
README.md | 22 +++++++++++-----------
conf/app.src | 4 ++--
conf/nginx.conf | 2 +-
conf/production.yaml | 22 +++++++++++++++++++++-
conf/systemd.service | 3 ++-
manifest.json | 5 +++--
scripts/install | 29 ++++++++++++++++-------------
scripts/remove | 5 +++--
scripts/restore | 2 +-
scripts/upgrade | 6 +++---
10 files changed, 63 insertions(+), 37 deletions(-)
diff --git a/README.md b/README.md
index 87a9f1c..fff8871 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
[![Install Peertube with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=peertube)
=======
-Shipped Version: **1.0.0-beta.13**
+Shipped Version: **1.0.0-beta.15**
## What is Peertube ?
@@ -35,28 +35,28 @@ Want to see in action?
### Guidelines
- 1. Require dedicated domain like **peertube.domain.tld**.
- 1. No LDAP support (blocked until upstream implements it)
- 1. URL can not be changed once selected.
+ 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)
+ 1. This app is **multi-instance** (you can have more then one Peertube instance running on a YunoHost server)
-### Install
+### Installing guide
- 1. **App can be installed by YunoHost admin interface or by the following command:**
+ 1. App can be installed by YunoHost **admin web-interface** or by **running following command**:
$ sudo yunohost app install https://github.com/YunoHost-Apps/peertube_ynh
- 1. **root** is the admin username.
- 1. **root Password** will be sent to the email address given at the time of the installation.
+ 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/porduction.yml**.
- ### Updation
- 1. **App can be updated by YunoHost admin interface or with the following command:**
+ ### Update Guide
+ 1. App can be updated by YunoHost **admin web-interface** or with the following command**:
$ sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/peertube_ynh peertube
diff --git a/conf/app.src b/conf/app.src
index f5aea93..27a68ae 100644
--- a/conf/app.src
+++ b/conf/app.src
@@ -1,5 +1,5 @@
-SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v1.0.0-beta.13/peertube-v1.0.0-beta.13.tar.xz
-SOURCE_SUM=d23ebad3d1348a8fdf6ccaff81c16849045574578656ab7e676d4580c2da7383
+SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v1.0.0-beta.15/peertube-v1.0.0-beta.15.tar.xz
+SOURCE_SUM=fff45acc7cc84fc1847c0ed62fe2a64e683fe84b394cb64edb7a4b7fa9144da0
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.xz
SOURCE_IN_SUBDIR=true
diff --git a/conf/nginx.conf b/conf/nginx.conf
index 18bcbec..2210a02 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -45,7 +45,7 @@
send_timeout 600;
}
- # Bypass PeerTube webseed route for better performances
+ # Bypass PeerTube for performance reasons. Could be removed
location /static/webseed {
# Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client
limit_rate 800k;
diff --git a/conf/production.yaml b/conf/production.yaml
index 3e051ca..a13fb47 100644
--- a/conf/production.yaml
+++ b/conf/production.yaml
@@ -2,7 +2,7 @@ listen:
hostname: 'localhost'
port: __PORT__
-# Correspond to your reverse proxy "listen" configuration
+# Correspond to your reverse proxy server_name/listen configuration
webserver:
https: true
hostname: '__domain__'
@@ -67,6 +67,25 @@ search:
trending:
videos:
interval_days: 7 # Compute trending videos for the last x days
+
+# Cache remote videos on your server, to help other instances to broadcast the video
+# You can define multiple caches using different sizes/strategies
+# Once you have defined your strategies, choose which instances you want to cache in admin -> manage follows -> following
+redundancy:
+ videos:
+# -
+# size: '10GB'
+# strategy: 'most-views' # Cache videos that have the most views
+# -
+# size: '10GB'
+# strategy: 'trending' # Cache trending videos
+# -
+ size: '1GB'
+ # Minimum time the video must remain in the cache. Only accept values > 10 hours (to not overload remote instances)
+ min_lifetime: '48 hours'
+ strategy: 'recently-added' # Cache recently added videos
+ minViews: 10 # Having at least x views
+
###############################################################################
@@ -94,6 +113,7 @@ admin:
signup:
enabled: false
limit: 10 # When the limit is reached, registrations are disabled. -1 == unlimited
+ requires_email_verification: false
filters:
cidr: # You can specify CIDR ranges to whitelist (empty = no filtering) or blacklist
whitelist: []
diff --git a/conf/systemd.service b/conf/systemd.service
index 0fc291b..8f5be9d 100644
--- a/conf/systemd.service
+++ b/conf/systemd.service
@@ -8,7 +8,8 @@ Environment=NODE_ENV=production
Environment=NODE_CONFIG_DIR=__FINALPATH__/config
User=__APP__
Group=__APP__
-ExecStart=/bin/sh -c 'PATH=/opt/node_n/bin:$PATH exec npm start'
+Environment="PATH=__ENV_PATH__"
+ExecStart=/bin/sh -c ' npm start'
WorkingDirectory=__FINALPATH__/
StandardOutput=syslog
StandardError=syslog
diff --git a/manifest.json b/manifest.json
index 359a850..bfae4ab 100644
--- a/manifest.json
+++ b/manifest.json
@@ -3,9 +3,10 @@
"id": "peertube",
"packaging_format": 1,
"description": {
- "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é"
},
- "version": "1.0.0-beta.13",
+ "version": "1.0.0-beta.15",
"url": "https://github.com/Chocobozzz/PeerTube",
"license": "AGPL-3.0-only",
"maintainer": {
diff --git a/scripts/install b/scripts/install
index 06297cc..ae188e3 100644
--- a/scripts/install
+++ b/scripts/install
@@ -56,10 +56,10 @@ ynh_webpath_register "$app" "$domain" "$path_url"
# STORE SETTINGS FROM MANIFEST
#=================================================
-ynh_app_setting_set "$app" domain "$domain"
+ynh_app_setting_set "$app" domain "$domain"
ynh_app_setting_set "$app" admin_email "$admin_email"
-ynh_app_setting_set "$app" admin_pass "$admin_pass"
-ynh_app_setting_set "$app" is_public "$is_public"
+ynh_app_setting_set "$app" admin_pass "$admin_pass"
+ynh_app_setting_set "$app" is_public "$is_public"
#=================================================
# STANDARD MODIFICATIONS
@@ -90,18 +90,18 @@ mkdir -p "$datadir"
# install nodejs
ynh_install_nodejs 8
-# add backports for Debian Jessie (required to install ffmpeg)
+# Add backports for Debian Jessie (required to install ffmpeg)
if [ "$(lsb_release --codename --short)" == "jessie" ]; then
echo "deb http://httpredir.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/jessie-backports.list
fi
-# add yarn repo for Debian
+# Add yarn repo for Debian
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
ynh_package_update
-# install postgresql, ffmpeg, redis
-ynh_install_app_dependencies postgresql ffmpeg redis-server redis-tools mailutils yarn
+# install dependencies
+ynh_install_app_dependencies postgresql postgresql-contrib openssl g++ ffmpeg redis-server redis-tools mailutils yarn apt-transport-https
#=================================================
# DATABASE SETUP
@@ -151,11 +151,11 @@ touch "$final_path/config/local-production.json"
#=================================================
# Create a dedicated nginx config
-mkdir -p "/etc/nginx/conf.d/${domain}.d"
+mkdir -p "/etc/nginx/conf.d/${domain}.d" # ( I don't remember why this is here, I think can be removed)
ynh_add_nginx_config
-# Set right permissions for curl install
+# Set right permissions for the app
chown -R "$app":"$app" "$datadir"
# Reload Nginx
@@ -214,10 +214,13 @@ chown -R "$app":"$app" "$final_path" "$datadir"
systemctl reload nginx
+
+
#=================================================
# SETUP SYSTEMD
#=================================================
+ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
# Create a dedicated systemd config
ynh_add_systemd_config
systemctl enable "$app"
@@ -231,7 +234,7 @@ systemctl start "$app"
(
cd "$final_path"
sleep 30
- echo $admin_pass | NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production PATH="/opt/node_n/bin:$PATH" npm run reset-password -- -u root
+ echo $admin_pass | NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production npm run reset-password -- -u root
)
#=================================================
@@ -240,11 +243,11 @@ systemctl start "$app"
message=" $app was successfully installed :)
-Please open https://$domain$path_url
+Please open your $app domain: https://$domain$path_url
The admin username is: root
-Here is the admin password: $admin_pass
+The admin password is: $admin_pass
-If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/peertube_ynh"
+If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh"
ynh_send_readme_to_admin "$message"
diff --git a/scripts/remove b/scripts/remove
index 734a5d9..7b1b909 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -109,7 +109,8 @@ message="$app was successfully removed :)
$app was successfully removed. The domain https://$domain$path_url is free for other apps to be installed on it.
-But a futher action is required from your side to completely remove the $app data folder. If you are planing to restore the app in the future don't run the command given below. And if you are going to switch to othe server you will have to move /home/yunohost.app/$app to your new server.
+But a futher action is required from your side to completely remove the $app data folder. If you have backup and plan to restore this app in the future DON'T RUN THIS COMMAND.
+And if you are going to migrate to othe server you will have to move /home/yunohost.app/$app to your new server.
You need to run this command to remove the data (warning all your videos will be removed) :
@@ -117,6 +118,6 @@ You need to run this command to remove the data (warning all your videos will be
rm -R /home/yunohost.app/$app -f
-If you facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/peertube_ynh"
+If you facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/peertube_ynh"
ynh_send_readme_to_admin "$message"
diff --git a/scripts/restore b/scripts/restore
index b755f24..a3ea65c 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -99,7 +99,7 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.lis
ynh_package_update
# install postgresql, ffmpeg, redis
-ynh_install_app_dependencies postgresql ffmpeg redis-server redis-tools mailutils yarn
+ynh_install_app_dependencies postgresql postgresql-contrib openssl g++ ffmpeg redis-server redis-tools mailutils yarn apt-transport-https
#=================================================
# RESTORE THE PostgreSQL DATABASE
diff --git a/scripts/upgrade b/scripts/upgrade
index 44dfff5..1ff822b 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -105,7 +105,7 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.lis
ynh_package_update
# install postgresql, ffmpeg, redis
-ynh_install_app_dependencies postgresql ffmpeg redis-server redis-tools mailutils yarn
+ynh_install_app_dependencies postgresql postgresql-contrib openssl g++ ffmpeg redis-server redis-tools mailutils yarn apt-transport-https
#=================================================
# CHECK THE PATH
@@ -130,7 +130,7 @@ ynh_secure_remove "$tmpdir"
(
cd "$final_path"
- yarn install --production --pure-lockfile --silent --cache-folder /var/cache/yarn/
+ yarn install --production --pure-lockfile
)
@@ -172,7 +172,7 @@ ynh_use_logrotate --non-append
#=================================================
# SETUP SYSTEMD
#=================================================
-
+ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
# Create a dedicated systemd config
ynh_add_systemd_config