Merge pull request #118 from ekimekim/mike/nginx/serve-segments

nginx: Serve the segments directly from the segments dir
pull/128/head
Mike Lang 5 years ago committed by GitHub
commit eaf69fac1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -70,6 +70,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:: {
@ -300,7 +302,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