Skip to content

Commit 12a879c

Browse files
committed
Make the load balancer configurable via env vars
[refs #006627177dc6]
1 parent 1a675ed commit 12a879c

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

load_balancer/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
FROM jfahrer/nginx:latest
22

3-
COPY proxy.conf /etc/nginx/sites-available/default
3+
RUN apt-get update && apt-get install gettext-base
4+
5+
ENV PROXY_PROTOCOL=http PROXY_UPSTREAM=example.com
6+
7+
COPY proxy.conf /etc/nginx/sites-available/default.template
8+
COPY start.sh /
9+
10+
CMD ["/start.sh"]

load_balancer/proxy.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ server {
33

44
resolver 127.0.0.11;
55

6-
set $protocol http;
7-
set $upstream example.com;
6+
set $protocol $PROXY_PROTOCOL;
7+
set $upstream $PROXY_UPSTREAM;
88

99
location / {
1010
proxy_pass $protocol://$upstream$request_uri;

load_balancer/start.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
envsubst '$PROXY_PROTOCOL,$PROXY_UPSTREAM' < /etc/nginx/sites-available/default.template > /etc/nginx/sites-available/default
4+
nginx -g 'daemon off;'

0 commit comments

Comments
 (0)