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 #1 from anmol26s/testing

Testing
This commit is contained in:
anmol26s 2018-03-26 01:17:37 +05:30 committed by GitHub
commit 666f021efb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 103 additions and 7988 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,14 +36,15 @@ 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
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. 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. 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. 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. 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 * 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/v1.0.0-beta.1/peertube-v1.0.0-beta.1.zip
SOURCE_SUM=f7266fc1cb2a127902707ccc0978b4ae5f7a08c1e089feb479a78e3410872ec0 SOURCE_SUM=8e80aaa503de0d28be209375b48dd9242abec16a3bde473b684286c67e19af13
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

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,9 +80,25 @@ ynh_app_setting_set $app port $port
# INSTALL DEPENDENCIES # 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 ynh_install_nodejs 8
#=================================================
# DATABASE SETUP
#=================================================
# Create postgresql database # Create postgresql database
db_name="peertube_prod" db_name="peertube_prod"
db_pwd=$(ynh_string_random 30) db_pwd=$(ynh_string_random 30)
@ -88,27 +109,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,13 +116,24 @@ 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 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 # SETUP APPLICATION WITH CURL
#================================================= #=================================================
@ -130,11 +141,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 +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 "__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 +170,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 +193,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
#================================================= #=================================================