mirror of https://github.com/ekimekim/wubloader
Merge pull request #58 from ekimekim/mike/nginx-dns-hack
Fix nginx when some services are disabledpull/61/head
commit
51efeb1f12
@ -1,3 +1,4 @@
|
||||
# nginx container contains config that exposes all the various services metrics
|
||||
FROM nginx:latest
|
||||
ADD nginx/nginx.conf /etc/nginx/nginx.conf
|
||||
ADD nginx/generate-config /
|
||||
ENTRYPOINT ["/bin/sh", "-c", "/generate-config && nginx -g \"daemon off;\""]
|
||||
|
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script expects a mapping of services and ports in the SERVICES env var,
|
||||
# with one line per service containing "NAME PORT".
|
||||
|
||||
generate_location() {
|
||||
# generate_location PATH URL
|
||||
echo -e "\t\tlocation $1 { proxy_pass $2; }"
|
||||
}
|
||||
|
||||
LOCATIONS=$(
|
||||
echo "$SERVICES" | while read name port; do
|
||||
# restreamer is the catch-all
|
||||
[ "$name" == "restreamer" ] && generate_location / "http://restreamer:$port"
|
||||
# thrimshim takes any calls to thrimshim/
|
||||
[ "$name" == "thrimshim" ] && generate_location /thrimshim "http://thrimshim:$port"
|
||||
# all services have metrics under /metrics/SERVICE
|
||||
generate_location "/metrics/$name" "http://$name:$port/metrics"
|
||||
done
|
||||
)
|
||||
|
||||
cat > /etc/nginx/nginx.conf <<EOF
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 80;
|
||||
$LOCATIONS
|
||||
}
|
||||
}
|
||||
EOF
|
@ -1,37 +0,0 @@
|
||||
|
||||
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…
Reference in New Issue