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 #383 from YunoHost-Apps/fixes

Fixes
This commit is contained in:
yalh76 2023-08-04 22:40:44 +02:00 committed by GitHub
commit cfb5d36dc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 28 deletions

View file

@ -22,6 +22,7 @@ location @api {
location = /api/v1/videos/upload-resumable {
client_max_body_size 0;
proxy_request_buffering off;
try_files /dev/null @api;
}
@ -44,6 +45,13 @@ location ~ ^/api/v1/videos/(upload|([^/]+/studio/edit))$ {
try_files /dev/null @api;
}
location ~ ^/api/v1/runners/jobs/[^/]+/(update|success)$ {
client_max_body_size 12G; # default is 1M
more_set_headers "X-File-Maximum-Size : 8G always"; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
try_files /dev/null @api;
}
location ~ ^/api/v1/(videos|video-playlists|video-channels|users/me) {
client_max_body_size 6M; # default is 1M
more_set_headers "X-File-Maximum-Size : 4M always"; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
@ -89,9 +97,10 @@ location ~ ^/plugins/[^/]+(/[^/]+)?/ws/ {
##
root __DATADIR__;
# Enable compression for JS/CSS/HTML, for improved client load times.
# It might be nice to compress JSON/XML as returned by the API, but
# leaving that out to protect against potential BREACH attack.
# Enable compression for JS/CSS/HTML, for improved client load times.
# It might be nice to compress JSON/XML as returned by the API, but
# leaving that out to protect against potential BREACH attack.
# gzip on;
gzip_vary on;
gzip_types # text/html is always compressed by HttpGzipModule
@ -159,7 +168,7 @@ location ~ ^/static/(thumbnails|avatars)/ {
try_files $uri @api;
}
location ~ ^(/static/(webseed|streaming-playlists)/private/)|^/download {
location ~ ^(/static/(webseed|web-videos|streaming-playlists)/private/)|^/download {
# We can't rate limit a try_files directive, so we need to duplicate @api
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -172,20 +181,14 @@ location ~ ^(/static/(webseed|streaming-playlists)/private/)|^/download {
}
# Bypass PeerTube for performance reasons. Optional.
location ~ ^/static/(webseed|redundancy|streaming-playlists)/ {
location ~ ^/static/(webseed|web-videos|redundancy|streaming-playlists)/ {
limit_rate_after 5M;
# Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client
set $peertube_limit_rate 800k;
# Increase rate limit in HLS mode, because we don't have multiple simultaneous connections
if ($request_uri ~ -fragmented.mp4$) {
set $peertube_limit_rate 5M;
}
set $peertube_limit_rate 5M;
# Use this line with nginx >= 1.17.0
limit_rate $peertube_limit_rate;
# Or this line if your nginx < 1.17.0
# Or this line with nginx < 1.17.0
# set $limit_rate $peertube_limit_rate;
if ($request_method = 'OPTIONS') {
@ -213,7 +216,8 @@ location ~ ^/static/(webseed|redundancy|streaming-playlists)/ {
sendfile_max_chunk 1M; # prevent one fast connection from entirely occupying the worker process. should be > 800k.
aio threads;
rewrite ^/static/webseed/(.*)$ /videos/$1 break;
# web-videos is the name of the directory mapped to the `storage.web_videos` key in your PeerTube configuration
rewrite ^/static/webseed/(.*)$ /web-videos/$1 break;
rewrite ^/static/(.*)$ /$1 break;
root __DATADIR__;

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
#=================================================
# COMMON VARIABLES
@ -6,7 +6,6 @@
# dependencies used by the app
pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https"
app_dependencies="prosody"
nodejs_version=16

View file

@ -85,7 +85,6 @@ ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
#=================================================
ynh_script_progression --message="Installing dependencies..."
ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies"
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
@ -199,7 +198,7 @@ ynh_script_progression --message="Starting a systemd service..."
mkdir -p "/var/log/$app"
chown -R $app:$app "/var/log/$app"
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="HTTP server listening on localhost" --timeout=300 --length=200
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started"
#=================================================
# INSTALL LDAP PLUGIN
@ -234,7 +233,7 @@ popd
ynh_script_progression --message="Stopping a systemd service..."
# Stop a systemd service
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped"
#=================================================
# GENERIC FINALIZATION
@ -259,7 +258,7 @@ yunohost service add $app --description="$app daemon for Peertube" --log="/var/l
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="HTTP server listening on localhost"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started"
#=================================================
# SETUP SSOWAT

View file

@ -111,7 +111,6 @@ ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_nodejs
ynh_remove_app_dependencies
ynh_remove_apps
#=================================================
# CLOSE A PORT

View file

@ -86,7 +86,6 @@ chown -R $app:www-data "$datadir"
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies"
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
@ -145,7 +144,7 @@ yunohost service add $app --description="$app daemon for Peertube" --log="/var/l
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="HTTP server listening on localhost"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started"
#=================================================
# GENERIC FINALIZATION

View file

@ -61,7 +61,7 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
@ -150,6 +150,9 @@ ynh_secure_remove --file="$datadir/logs"
mkdir -p "/var/log/$app"
chown -R $app:$app "/var/log/$app"
# Remove Prosody
ynh_remove_apps
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -180,7 +183,6 @@ chown -R $app:www-data "$final_path"
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_exec_warn_less ynh_install_apps --apps="$app_dependencies"
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
@ -258,7 +260,7 @@ ynh_script_progression --message="Starting a systemd service..."
mkdir -p "/var/log/$app"
chown -R $app:$app "/var/log/$app"
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="HTTP server listening on localhost" --timeout=5400 --length=200
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started"
#=================================================
# INSTALL LDAP PLUGIN
@ -303,7 +305,7 @@ fi
ynh_script_progression --message="Stopping a systemd service..."
# Stop a systemd service
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped"
#=================================================
# GENERIC FINALIZATION
@ -327,7 +329,7 @@ yunohost service add $app --description="$app daemon for Peertube" --log="/var/l
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="HTTP server listening on localhost"
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started"
#=================================================
# RELOAD NGINX