nginx: Serve the segments directly from the segments dir

instead of proxying through restreamer.

This should improve performance when serving the (large) segment files,
and free up restreamer for things like generating the playlist.
pull/118/head
Mike Lang 5 years ago
parent 095e391b60
commit 3c20a9aece

@ -68,6 +68,8 @@
thrimbletrimmer:: true, // set to false to not have nginx serve thrimbletrimmer pages. thrimbletrimmer:: true, // set to false to not have nginx serve thrimbletrimmer pages.
nginx_serve_segments:: true, // set to false to not have nginx serve segments directly, letting restreamer do it instead.
// Connection args for the database. // Connection args for the database.
// If database is defined in this config, host and port should be postgres:5432. // If database is defined in this config, host and port should be postgres:5432.
db_args:: { db_args:: {
@ -280,7 +282,9 @@
if service in $.enabled && $.enabled[service] if service in $.enabled && $.enabled[service]
]), ]),
THRIMBLETRIMMER: if $.thrimbletrimmer then "true" else "", THRIMBLETRIMMER: if $.thrimbletrimmer then "true" else "",
SEGMENTS: if $.nginx_serve_segments then "/mnt" else "",
}, },
volumes: if $.nginx_serve_segments then ["%s:/mnt" % $.segments_path] else [],
}, },
[if $.enabled.postgres then "postgres"]: { [if $.enabled.postgres then "postgres"]: {

@ -3,6 +3,10 @@
# This script expects a mapping of services and ports in the SERVICES env var, # This script expects a mapping of services and ports in the SERVICES env var,
# with one line per service containing "NAME PORT". # with one line per service containing "NAME PORT".
# Other vars:
# THRIMBLETRIMMER: Set non-empty to also serve thrimbletrimmer on /thrimbletrimmer
# SEGMENTS: Set to path to segments dir to also serve segments dir on /segments
generate_location() { generate_location() {
# generate_location PATH URL # generate_location PATH URL
echo -e "\t\tlocation $1 { proxy_pass $2; }" echo -e "\t\tlocation $1 { proxy_pass $2; }"
@ -20,6 +24,8 @@ LOCATIONS=$(
[ -n "$THRIMBLETRIMMER" ] && [ -n "$THRIMBLETRIMMER" ] &&
echo -e "\t\tlocation = / { return 301 /thrimbletrimmer/dashboard.html; }" && echo -e "\t\tlocation = / { return 301 /thrimbletrimmer/dashboard.html; }" &&
echo -e "\t\tlocation /thrimbletrimmer { }" echo -e "\t\tlocation /thrimbletrimmer { }"
[ -n "$SEGMENTS" ] &&
echo -e "\t\tlocation /segments/ { alias $SEGMENTS/; }"
) )
cat > /etc/nginx/nginx.conf <<EOF cat > /etc/nginx/nginx.conf <<EOF

Loading…
Cancel
Save