Update to latest release

Instead of relying on the `develop` branch of PeerTube, rely on the
releases. This implies a few changes in the way we launch PeerTube and
since then, a few configuration options and dependencies have been
added.
This commit is contained in:
Pierre-Antoine Rault 2018-02-28 16:41:02 +01:00
parent bdd1e9449e
commit 69be43b53c
10 changed files with 107 additions and 7985 deletions

View file

@ -1,17 +1,24 @@
# PeerTube app for YunoHost # PeerTube app for YunoHost
[![Install Peertube with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=Peertube)<br><br> [![Install Peertube with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=Peertube)<br><br>
## Installation(Read it) ## Installation
1. Require dedicated domain like **peertube.domain.tld**. 1. Require dedicated domain like **peertube.domain.tld**.
2. No LDAP support 1. No LDAP support (blocked until upstream implements it)
3. No Multi-instance 1. No Multi-instance
4. No change-url possible. 1. No url change possible
5. Peertube is under development stage,don't use it for production 1. Peertube is under development stage, **don't use it for production**
6. **Install the app by following command:** 1. Take notice that this YunoHost package *claims* the following features:
- [x] Install
- [x] Remove
- [ ] Upgrade
- [ ] Backup
- [ ] Restore
$ yunohost app install https://github.com/YunoHost-Apps/peertube_ynh 1. **Install the app by following command:**
7. **root** is the admin username and the admin email is the email address given at the time of installation.
8. **After installation change the password by this command:** $ sudo yunohost app install https://github.com/YunoHost-Apps/peertube_ynh
1. **root** is the admin username and the admin email is the email address given at the time of installation.
1. **After installation change the password by this command:**
$ cd /var/www/peertube && NODE_ENV=production npm run reset-password -- -u root $ cd /var/www/peertube && NODE_ENV=production npm run reset-password -- -u root
@ -29,8 +36,9 @@ Decentralized video streaming platform using P2P (BitTorrent) directly in the we
Want to see in action? Want to see in action?
* [Demo server](http://peertube.cpy.re) * [Demo](http://peertube.cpy.re)
* [Video](https://peertube.cpy.re/videos/watch/f78a97f8-a142-4ce1-a5bd-154bf9386504) to see how the "decentralization feature" looks like * [Video](https://peertube.cpy.re/videos/watch/f78a97f8-a142-4ce1-a5bd-154bf9386504) to see how the "decentralization feature" looks like
* [Video](https://peertube.valvin.fr/videos/watch/e510b421-92f3-4153-aaf9-baf5166f43e8) showcasing A2HS
## Why ## Why
@ -50,11 +58,6 @@ Thanks to [WebTorrent](https://github.com/feross/webtorrent), we can make P2P (t
* PostgreSQL * PostgreSQL
* FFmpeg * FFmpeg
## LICENSE
## Features PeerTube is licensed under the GNU Affero General Public License v3.0.
- [X] Install
- [X] Remove
- [ ] Upgrade
- [ ] Backup
- [ ] Restore

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://github.com/Chocobozzz/PeerTube/archive/develop.zip SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v0.0.29-alpha/peertube-v0.0.29-alpha.zip
SOURCE_SUM=f7266fc1cb2a127902707ccc0978b4ae5f7a08c1e089feb479a78e3410872ec0 SOURCE_SUM=91fff3e29c35e795bfab49f9753f8c034456e4d9bcbd8d438836071f799832c3
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR= SOURCE_IN_SUBDIR=true
SOURCE_FILENAME= SOURCE_FILENAME=

1
conf/backports.list Normal file
View file

@ -0,0 +1 @@
deb http://httpredir.debian.org/debian jessie-backports main

View file

@ -8,7 +8,7 @@ location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# For the video upload # For the video upload
client_max_body_size 2G; client_max_body_size 4G;
} }
# Bypass PeerTube webseed route for better performances # Bypass PeerTube webseed route for better performances

View file

@ -15,9 +15,15 @@ database:
username: 'peertube' username: 'peertube'
password: '__db_pwd__' password: '__db_pwd__'
# Your object store
redis:
hostname: 'localhost'
port: 6379
auth: null
# From the project root directory # From the project root directory
storage: storage:
certs: 'certs/' avatars: 'avatars/'
videos: 'videos/' videos: 'videos/'
logs: 'logs/' logs: 'logs/'
previews: 'previews/' previews: 'previews/'
@ -25,9 +31,12 @@ storage:
torrents: 'torrents/' torrents: 'torrents/'
cache: 'cache/' cache: 'cache/'
log:
level: 'info' # debug/info/warning/error
cache: cache:
previews: previews:
size: 100 # Max number of previews you want to cache size: 1 # Max number of previews you want to cache
admin: admin:
email: '__email__' email: '__email__'
@ -52,3 +61,11 @@ transcoding:
480p: true 480p: true
720p: true 720p: true
1080p: true 1080p: true
instance:
name: 'PeerTube'
description: 'Welcome to this PeerTube instance!' # Support markdown
terms: 'No terms for now.' # Support markdown
customizations:
javascript: '' # Directly your JavaScript code (without <script> tags). Will be eval at runtime
css: '' # Directly your CSS code (without <style> tags). Will be injected at runtime

View file

@ -6,7 +6,7 @@ Type=simple
Environment=NODE_ENV=production Environment=NODE_ENV=production
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
ExecStart=/usr/bin/npm start ExecStart=/bin/sh -c 'PATH=/opt/node_n/bin:$PATH exec npm start'
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__FINALPATH__/
StandardOutput=syslog StandardOutput=syslog
StandardError=syslog StandardError=syslog

1
conf/yarn.list Normal file
View file

@ -0,0 +1 @@
deb https://dl.yarnpkg.com/debian/ stable main

File diff suppressed because it is too large Load diff

View file

@ -3,11 +3,11 @@
"id": "peertube", "id": "peertube",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Peertube is a p2p video sharing app which works in browser too" "en": "Video streaming platform using P2P directly in the web browser, connected to a federated network"
}, },
"version": "1.0", "version": "1.1",
"url": "https://github.com/Chocobozzz/PeerTube", "url": "https://github.com/Chocobozzz/PeerTube",
"license": "AGPL", "license": "free",
"maintainer": { "maintainer": {
"name": "Anmol Sharma", "name": "Anmol Sharma",
"email": "anmol@datamol.org" "email": "anmol@datamol.org"
@ -17,9 +17,7 @@
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
"nginx", "nginx"
"nodejs",
"postgresql"
], ],
"arguments": { "arguments": {
"install" : [ "install" : [
@ -38,6 +36,15 @@
}, },
"example": "johndoe@example.com" "example": "johndoe@example.com"
}, },
{
"name": "pass",
"type": "password",
"ask": {
"en": "Enter password of this administrator ≥ 6 character",
"fr": "Ajouter le mot de passe pour cette administrateur ≥ 6 charactères"
},
"example": "battery horse staple nenuphar"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",

View file

@ -17,6 +17,9 @@ source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#ynh_clean_setup () {
#
#}
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
@ -25,6 +28,7 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/" path_url="/"
admin_email=$YNH_APP_ARG_EMAIL admin_email=$YNH_APP_ARG_EMAIL
admin_pass=$YNH_APP_ARG_PASS
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
# This is a multi-instance app, meaning it can be installed several times independently # This is a multi-instance app, meaning it can be installed several times independently
@ -57,6 +61,7 @@ ynh_webpath_register $app $domain $path_url
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_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 is_public $is_public
#================================================= #=================================================
@ -75,7 +80,21 @@ ynh_app_setting_set $app port $port
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_install_app_dependencies postgresql-9.4 yarn ffmpeg # Import debian archive pubkey, need on ARM arch
# taken from https://github.com/YunoHost-Apps/mastodon_ynh/blob/7db022c2cc3d6e9fa2e26803c4a424a3bb8c9bd4/scripts/install#L55
arch=$(uname -m)
if [[ $arch = arm* ]]; then
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
fi
# Install source.list debian package backports & yarn
sudo cp ../conf/backports.list /etc/apt/sources.list.d/
sudo curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
sudo cp ../conf/yarn.list /etc/apt/sources.list.d/
ynh_package_update
ynh_install_app_dependencies postgresql-9.4 yarn ffmpeg redis-server redis-tools
ynh_install_nodejs 8 ynh_install_nodejs 8
# Create postgresql database # Create postgresql database
@ -88,27 +107,6 @@ ynh_psql_create_user $app $db_pwd
ynh_psql_execute_as_root \ ynh_psql_execute_as_root \
"CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $app;" "CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $app;"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
cp -f ../conf/yarn.lock $final_path/client/yarn.lock
cp ../conf/production.yaml $final_path/config/.
(cd $final_path && yarn install)
(cd $final_path && npm run build)
#=================================================
# NGINX CONFIGURATION
#=================================================
# Create a dedicated nginx config
ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
@ -116,6 +114,25 @@ ynh_add_nginx_config
# Create a system user # Create a system user
ynh_system_user_create $app ynh_system_user_create $app
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
# cp -f ../conf/yarn.lock $final_path/client/yarn.lock
cp ../conf/production.yaml $final_path/config/production.yaml
(cd $final_path && yarn install --production --pure-lockfile)
# (cd $final_path && npm run build)
#=================================================
# NGINX CONFIGURATION
#=================================================
# Create a dedicated nginx config
sudo mkdir -p "/etc/nginx/conf.d/${domain}.d"
ynh_add_nginx_config
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -130,11 +147,9 @@ ynh_system_user_create $app
# Set right permissions for curl install # Set right permissions for curl install
chown -R $app:$app $final_path chown -R $app:$app $final_path
# Reload Nginx # Reload Nginx
systemctl reload nginx systemctl reload nginx
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
@ -144,7 +159,6 @@ ynh_replace_string "__db_name__" "$app" "$final_path/config/production.yaml"
ynh_replace_string "__db_pwd__" "$db_pwd" "$final_path/config/production.yaml" ynh_replace_string "__db_pwd__" "$db_pwd" "$final_path/config/production.yaml"
ynh_replace_string "__email__" "$admin_email" "$final_path/config/production.yaml" ynh_replace_string "__email__" "$admin_email" "$final_path/config/production.yaml"
#================================================= #=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE # STORE THE CHECKSUM OF THE CONFIG FILE
#================================================= #=================================================
@ -162,7 +176,6 @@ ynh_store_file_checksum "$final_path/config/production.yaml"
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
@ -186,6 +199,13 @@ fi
ynh_add_systemd_config ynh_add_systemd_config
sudo systemctl start peertube sudo systemctl start peertube
#=================================================
# CHANGE PEERTUBE ADMIN PASSWORD AFTER INITIAL GEN
#=================================================
# we need to wait for the service to init peertube's database
(cd /var/www/peertube && sleep 5 && exec /bin/sh -c "echo $admin_pass | NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production PATH=/opt/node_n/bin:$PATH npm run reset-password -- -u root")
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================