Add nginx service that provides a frontend to all the other services

This allows us to run all the different services and expose all their metrics,
all on one port.
pull/57/head
Mike Lang 6 years ago
parent a7a54db726
commit 63eb324ba5

@ -8,7 +8,7 @@ set -eu
# Pass PUSH=true to also push the resulting images, or PUSH=latest to push them as :latest tag # Pass PUSH=true to also push the resulting images, or PUSH=latest to push them as :latest tag
# The different images we can build # The different images we can build
COMPONENTS=(downloader restreamer backfiller thrimshim cutter sheetsync) COMPONENTS=(downloader restreamer backfiller thrimshim cutter sheetsync nginx)
# Define push if not already defined # Define push if not already defined
PUSH=${PUSH:-} PUSH=${PUSH:-}

@ -19,6 +19,7 @@
cutter: false, cutter: false,
sheetsync: false, sheetsync: false,
thrimshim: false, thrimshim: false,
nginx: true,
}, },
// Twitch channel to capture // Twitch channel to capture
@ -34,12 +35,13 @@
// The host's port to expose each service on. // The host's port to expose each service on.
// Only the restreamer needs to be externally accessible - the others are just for monitoring. // Only the restreamer needs to be externally accessible - the others are just for monitoring.
ports:: { ports:: {
restreamer: 8080, restreamer: 8000,
thrimshim: 8081, thrimshim: 8004,
downloader: 8001, downloader: 8001,
backfiller: 8002, backfiller: 8002,
cutter: 8003, cutter: 8003,
sheetsync: 8005, sheetsync: 8005,
nginx: 80,
}, },
// The local port within each container to bind the backdoor server on. // The local port within each container to bind the backdoor server on.
@ -199,6 +201,12 @@
[if "sheetsync" in $.ports then "ports"]: ["%s:8005" % $.ports.sheetsync] [if "sheetsync" in $.ports then "ports"]: ["%s:8005" % $.ports.sheetsync]
}, },
[if $.enabled.nginx then "nginx"]: {
image: "quay.io/ekimekim/wubloader-nginx:%s" % image_tag,
restart: "on-failure",
[if "nginx" in $.ports then "ports"]: ["%s:80" % $.ports.nginx],
},
}, },
} }

@ -0,0 +1,3 @@
# nginx container contains config that exposes all the various services metrics
FROM nginx:latest
ADD nginx/nginx.conf /etc/nginx/nginx.conf

@ -0,0 +1,37 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
location / {
proxy_pass http://restreamer:8000;
}
location /thrimshim {
proxy_pass http://thrimshim:8004;
}
# Restreamer metrics would be available regardless, this is just for consistency
location /metrics/restreamer {
proxy_pass http://restreamer:8000/metrics;
}
location /metrics/downloader {
proxy_pass http://downloader:8001/metrics;
}
location /metrics/backfiller {
proxy_pass http://backfiller:8002/metrics;
}
location /metrics/cutter {
proxy_pass http://cutter:8003/metrics;
}
location /metrics/thrimshim {
proxy_pass http://thrimshim:8004/metrics;
}
location /metrics/sheetsync {
proxy_pass http://sheetsync:8005/metrics;
}
}
}
Loading…
Cancel
Save