Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding docker healthcheck and an unauthenticated port for external healthchecks #5

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ WORKDIR /opt

RUN apk add --no-cache gettext

COPY auth.conf auth.htpasswd launch.sh ./
COPY auth.conf healthcheck.conf auth.htpasswd launch.sh ./

HEALTHCHECK CMD wget -q http://localhost:80/ || exit 1

CMD ["./launch.sh"]
17 changes: 10 additions & 7 deletions auth.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
server {
listen 80 default_server;
listen 80 default_server;

location / {
auth_basic "Restricted";
auth_basic_user_file auth.htpasswd;
location / {
satisfy any;
allow 127.0.0.1;
deny all;
auth_basic "Restricted";
auth_basic_user_file auth.htpasswd;

proxy_pass http://${FORWARD_HOST}:${FORWARD_PORT};
proxy_read_timeout 900;
}
proxy_pass http://${FORWARD_HOST}:${FORWARD_PORT};
proxy_read_timeout 900;
}
}
8 changes: 8 additions & 0 deletions healthcheck.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
listen 9999 default_server;

location / {
proxy_pass http://${FORWARD_HOST}:${FORWARD_PORT};
proxy_read_timeout 900;
}
}
1 change: 1 addition & 0 deletions launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

rm /etc/nginx/conf.d/default.conf || :
envsubst < auth.conf > /etc/nginx/conf.d/auth.conf
envsubst < healthcheck.conf > /etc/nginx/conf.d/healthcheck.conf
envsubst < auth.htpasswd > /etc/nginx/auth.htpasswd

nginx -g "daemon off;"