mirror of
https://github.com/YunoHost-Apps/peertube_ynh.git
synced 2024-09-03 19:56:29 +02:00
commit
666f021efb
9 changed files with 103 additions and 7988 deletions
41
README.md
41
README.md
|
@ -1,17 +1,24 @@
|
|||
# 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>
|
||||
|
||||
## Installation(Read it)
|
||||
## Installation
|
||||
1. Require dedicated domain like **peertube.domain.tld**.
|
||||
2. No LDAP support
|
||||
3. No Multi-instance
|
||||
4. No change-url possible.
|
||||
5. Peertube is under development stage,don't use it for production
|
||||
6. **Install the app by following command:**
|
||||
1. No LDAP support (blocked until upstream implements it)
|
||||
1. No Multi-instance
|
||||
1. No url change possible
|
||||
1. Peertube is under development stage, **don't use it for production**
|
||||
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
|
||||
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:**
|
||||
1. **Install the app by following 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
|
||||
|
||||
|
@ -29,14 +36,15 @@ Decentralized video streaming platform using P2P (BitTorrent) directly in the we
|
|||
|
||||
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.valvin.fr/videos/watch/e510b421-92f3-4153-aaf9-baf5166f43e8) showcasing A2HS
|
||||
|
||||
## Why
|
||||
## Why
|
||||
|
||||
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 (as [Hubzilla](https://project.hubzilla.org/page/hubzilla/hubzilla-project)([Hubzilla YunoHost](https://github.com/YunoHost-Apps/hubzilla_ynh)),[Friendica](http://friendi.ca/)([Friendica YunoHost](https://github.com/YunoHost-Apps/friendica_ynh)),[Mastodon](https://github.com/tootsuite/mastodon)([Mastodon YunoHost](https://github.com/YunoHost-Apps/mastodon_ynh)),[Diaspora](https://github.com/diaspora/diaspora)([Diaspora YunoHost](https://github.com/YunoHost-Apps/diaspora_ynh))).
|
||||
So we need to have a decentralized network (as [Hubzilla](https://project.hubzilla.org/page/hubzilla/hubzilla-project) ([Hubzilla YunoHost](https://github.com/YunoHost-Apps/hubzilla_ynh)), [Friendica](http://friendi.ca/) ([Friendica YunoHost](https://github.com/YunoHost-Apps/friendica_ynh)), [Mastodon](https://github.com/tootsuite/mastodon) ([Mastodon YunoHost](https://github.com/YunoHost-Apps/mastodon_ynh)), [Diaspora](https://github.com/diaspora/diaspora) ([Diaspora YunoHost](https://github.com/YunoHost-Apps/diaspora_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 right now.
|
||||
|
@ -50,11 +58,6 @@ Thanks to [WebTorrent](https://github.com/feross/webtorrent), we can make P2P (t
|
|||
* PostgreSQL
|
||||
* FFmpeg
|
||||
|
||||
## LICENSE
|
||||
|
||||
## Features
|
||||
|
||||
- [X] Install
|
||||
- [X] Remove
|
||||
- [ ] Upgrade
|
||||
- [ ] Backup
|
||||
- [ ] Restore
|
||||
PeerTube is licensed under the GNU Affero General Public License v3.0.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SOURCE_URL=https://github.com/Chocobozzz/PeerTube/archive/develop.zip
|
||||
SOURCE_SUM=f7266fc1cb2a127902707ccc0978b4ae5f7a08c1e089feb479a78e3410872ec0
|
||||
SOURCE_URL=https://github.com/Chocobozzz/PeerTube/releases/download/v1.0.0-beta.1/peertube-v1.0.0-beta.1.zip
|
||||
SOURCE_SUM=8e80aaa503de0d28be209375b48dd9242abec16a3bde473b684286c67e19af13
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
|
|
1
conf/backports.list
Normal file
1
conf/backports.list
Normal file
|
@ -0,0 +1 @@
|
|||
deb http://httpredir.debian.org/debian jessie-backports main
|
|
@ -8,7 +8,7 @@ location / {
|
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
# For the video upload
|
||||
client_max_body_size 2G;
|
||||
client_max_body_size 4G;
|
||||
}
|
||||
|
||||
# Bypass PeerTube webseed route for better performances
|
||||
|
|
|
@ -15,9 +15,15 @@ database:
|
|||
username: 'peertube'
|
||||
password: '__db_pwd__'
|
||||
|
||||
# Your object store
|
||||
redis:
|
||||
hostname: 'localhost'
|
||||
port: 6379
|
||||
auth: null
|
||||
|
||||
# From the project root directory
|
||||
storage:
|
||||
certs: 'certs/'
|
||||
avatars: 'avatars/'
|
||||
videos: 'videos/'
|
||||
logs: 'logs/'
|
||||
previews: 'previews/'
|
||||
|
@ -25,9 +31,12 @@ storage:
|
|||
torrents: 'torrents/'
|
||||
cache: 'cache/'
|
||||
|
||||
log:
|
||||
level: 'info' # debug/info/warning/error
|
||||
|
||||
cache:
|
||||
previews:
|
||||
size: 100 # Max number of previews you want to cache
|
||||
size: 1 # Max number of previews you want to cache
|
||||
|
||||
admin:
|
||||
email: '__email__'
|
||||
|
@ -52,3 +61,11 @@ transcoding:
|
|||
480p: true
|
||||
720p: 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
|
||||
|
|
|
@ -6,7 +6,7 @@ Type=simple
|
|||
Environment=NODE_ENV=production
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
ExecStart=/usr/bin/npm start
|
||||
ExecStart=/bin/sh -c 'PATH=/opt/node_n/bin:$PATH exec npm start'
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
|
7927
conf/yarn.lock
7927
conf/yarn.lock
File diff suppressed because it is too large
Load diff
|
@ -3,11 +3,11 @@
|
|||
"id": "peertube",
|
||||
"packaging_format": 1,
|
||||
"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",
|
||||
"license": "AGPL",
|
||||
"license": "free",
|
||||
"maintainer": {
|
||||
"name": "Anmol Sharma",
|
||||
"email": "anmol@datamol.org"
|
||||
|
@ -17,9 +17,7 @@
|
|||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"nodejs",
|
||||
"postgresql"
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
|
@ -38,6 +36,15 @@
|
|||
},
|
||||
"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",
|
||||
"type": "boolean",
|
||||
|
|
|
@ -17,6 +17,9 @@ source /usr/share/yunohost/helpers
|
|||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
#ynh_clean_setup () {
|
||||
#
|
||||
#}
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
|
@ -25,6 +28,7 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
admin_email=$YNH_APP_ARG_EMAIL
|
||||
admin_pass=$YNH_APP_ARG_PASS
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
||||
# 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 admin_email $admin_email
|
||||
ynh_app_setting_set $app admin_pass $admin_pass
|
||||
ynh_app_setting_set $app is_public $is_public
|
||||
|
||||
#=================================================
|
||||
|
@ -75,9 +80,25 @@ ynh_app_setting_set $app port $port
|
|||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_install_app_dependencies postgresql-9.4 yarn ffmpeg
|
||||
# install yarn
|
||||
wget https://github.com/yarnpkg/yarn/releases/download/v1.5.1/yarn_1.5.1_all.deb
|
||||
echo "a4770cd8dcb13dc9a9218940dbd24b510ddf5eec78adb4e0da9ef3760b55a76e yarn_1.5.1_all.deb" | sha256sum -c || ynh_die
|
||||
sudo dpkg -i yarn_1.5.1_all.deb
|
||||
|
||||
# add backports (required to install ffmpeg)
|
||||
echo "deb http://httpredir.debian.org/debian jessie-backports main" | sudo tee /etc/apt/sources.list.d/jessie-backports.list
|
||||
ynh_package_update
|
||||
|
||||
# install postgresql, ffmpeg, redis
|
||||
ynh_install_app_dependencies postgresql-9.4 ffmpeg redis-server redis-tools
|
||||
|
||||
# install nodejs
|
||||
ynh_install_nodejs 8
|
||||
|
||||
#=================================================
|
||||
# DATABASE SETUP
|
||||
#=================================================
|
||||
|
||||
# Create postgresql database
|
||||
db_name="peertube_prod"
|
||||
db_pwd=$(ynh_string_random 30)
|
||||
|
@ -88,27 +109,6 @@ ynh_psql_create_user $app $db_pwd
|
|||
ynh_psql_execute_as_root \
|
||||
"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
|
||||
#=================================================
|
||||
|
@ -116,13 +116,24 @@ ynh_add_nginx_config
|
|||
# Create a system user
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK PEERTUBE 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 ../conf/production.yaml $final_path/config/production.yaml
|
||||
(cd $final_path && yarn install --production --pure-lockfile)
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# ...
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Create a dedicated nginx config
|
||||
sudo mkdir -p "/etc/nginx/conf.d/${domain}.d"
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
|
@ -130,11 +141,9 @@ ynh_system_user_create $app
|
|||
# Set right permissions for curl install
|
||||
chown -R $app:$app $final_path
|
||||
|
||||
|
||||
# Reload Nginx
|
||||
systemctl reload nginx
|
||||
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
|
@ -144,7 +153,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 "__email__" "$admin_email" "$final_path/config/production.yaml"
|
||||
|
||||
|
||||
#=================================================
|
||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
||||
#=================================================
|
||||
|
@ -162,7 +170,6 @@ ynh_store_file_checksum "$final_path/config/production.yaml"
|
|||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
@ -186,6 +193,13 @@ fi
|
|||
ynh_add_systemd_config
|
||||
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
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue