Add config options for choosing a webseed backend
Send webseed data from the peertube_data docker volume using sendfile by default The proxy and CDN backends require that videos are uploaded to the backend (through fuse mounting for example)
This commit is contained in:
parent
f7762ed1b9
commit
0c4a90b78d
17
.env.sample
17
.env.sample
@ -11,6 +11,23 @@ PEERTUBE_ADMIN_EMAIL=admin@example.com
|
|||||||
PEERTUBE_SIGNUP_ENABLED=false
|
PEERTUBE_SIGNUP_ENABLED=false
|
||||||
PEERTUBE_TRANSCODING_ENABLED=true
|
PEERTUBE_TRANSCODING_ENABLED=true
|
||||||
|
|
||||||
|
## Webseed backend
|
||||||
|
#
|
||||||
|
# If no NGINX_WEBSEED option is enabled, videos will be served
|
||||||
|
# via sendfile, from the the app_data docker volume.
|
||||||
|
|
||||||
|
# If the proxy backend is enabled, nginx will proxy requests to
|
||||||
|
# NGINX_WEBSEED_PROXY_URI and cache video data locally
|
||||||
|
#
|
||||||
|
#NGINX_WEBSEED_PROXY_ENABLE=true
|
||||||
|
#NGINX_WEBSEED_PROXY_URI=https://some-bucket.s3.api-endpoint.net
|
||||||
|
|
||||||
|
# If the CDN backend is enabled, nginx will respond to webseed requests
|
||||||
|
# with redirects to NGINX_WEBSEED_CDN_URI instead of sending video data
|
||||||
|
#
|
||||||
|
#NGINX_WEBSEED_CDN_ENABLE=true
|
||||||
|
#NGINX_WEBSEED_CDN_URI=https://some-bucket.some-cdn.net
|
||||||
|
|
||||||
## E-mail settings
|
## E-mail settings
|
||||||
#PEERTUBE_SMTP_HOSTNAME=postfix_relay_app
|
#PEERTUBE_SMTP_HOSTNAME=postfix_relay_app
|
||||||
#PEERTUBE_SMTP_PORT=25
|
#PEERTUBE_SMTP_PORT=25
|
||||||
|
@ -195,12 +195,15 @@ server {
|
|||||||
access_log off;
|
access_log off;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aio threads;
|
||||||
|
|
||||||
# Enabling the sendfile directive eliminates the step of copying the data into the buffer
|
# Enabling the sendfile directive eliminates the step of copying the data into the buffer
|
||||||
# and enables direct copying data from one file descriptor to another.
|
# and enables direct copying data from one file descriptor to another.
|
||||||
sendfile on;
|
sendfile on;
|
||||||
sendfile_max_chunk 1M; # prevent one fast connection from entirely occupying the worker process. should be > 800k.
|
sendfile_max_chunk 1M; # prevent one fast connection from entirely occupying the worker process.
|
||||||
aio threads;
|
# should be > 800k.
|
||||||
|
|
||||||
|
{{ if (env "NGINX_WEBSEED_PROXY_ENABLE") }}
|
||||||
proxy_connect_timeout 70;
|
proxy_connect_timeout 70;
|
||||||
proxy_read_timeout 1200;
|
proxy_read_timeout 1200;
|
||||||
proxy_send_timeout 1200;
|
proxy_send_timeout 1200;
|
||||||
@ -218,17 +221,23 @@ server {
|
|||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
|
|
||||||
|
proxy_pass {{ env "NGINX_WEBSEED_PROXY_URI" }};
|
||||||
|
{{ else }}
|
||||||
|
|
||||||
|
{{ if (env "NGINX_WEBSEED_CDN_ENABLE") }}
|
||||||
# Use this in tandem with fuse-mounting i.e. https://docs.joinpeertube.org/admin-remote-storage
|
# Use this in tandem with fuse-mounting i.e. https://docs.joinpeertube.org/admin-remote-storage
|
||||||
# to serve files directly from a public bucket without proxying.
|
# to serve files directly from a public bucket without proxying.
|
||||||
# Assumes you have buckets named after the storage subdirectories, i.e. 'videos', 'redundancy', etc.
|
# Assumes you have buckets named after the storage subdirectories, i.e. 'videos', 'redundancy', etc.
|
||||||
#set $cdn https://bucket-name.cdn.cloud;
|
set $cdn {{ env "NGINX_WEBSEED_CDN_URI" }};
|
||||||
#rewrite ^/static/webseed/(.*)$ $cdn/videos/$1 redirect;
|
rewrite ^/static/webseed/(.*)$ $cdn/videos/$1 redirect;
|
||||||
#rewrite ^/static/(.*)$ $cdn/$1 redirect;
|
rewrite ^/static/(.*)$ $cdn/$1 redirect;
|
||||||
|
|
||||||
|
{{ else }}
|
||||||
rewrite ^/static/webseed/(.*)$ /videos/$1 break;
|
rewrite ^/static/webseed/(.*)$ /videos/$1 break;
|
||||||
rewrite ^/static/(.*)$ /$1 break;
|
rewrite ^/static/(.*)$ /$1 break;
|
||||||
|
|
||||||
try_files $uri @api;
|
try_files $uri @api;
|
||||||
#proxy_pass https://bucket-name.s3.api-endpoint.cloud;
|
{{ end }}
|
||||||
|
|
||||||
|
{{ end }}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user