Unverified Commit cc5277e9 authored by Ben Cordero's avatar Ben Cordero Committed by GitHub
Browse files

Merge pull request #4 from deliveroo/wait_for_app_healthcheck

Wait for the application to pass healthchecks
parents 55b25786 ecb33b77
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
# `nginx-sidecar` changelog

## 0.2.1

- Wait for the application to pass healthchecks before listening
  (and accepting) downstream healthchecks.

## 0.2.0

- Pass original request scheme to consuming application
+2 −0
Original line number Diff line number Diff line
FROM nginx:stable

RUN apt update && apt install -y curl

COPY nginx.conf.template /etc/nginx/nginx.conf.template
COPY start.sh /usr/bin/start.sh
RUN chmod a+x /usr/bin/start.sh
+1 −1
Original line number Diff line number Diff line
0.2.0
0.2.1
+5 −0
Original line number Diff line number Diff line
@@ -6,5 +6,10 @@ set -ex
# so we substitute at run time
/bin/sed -e "s/<NGINX_PORT>/${NGINX_PORT}/g" -e "s/<APP_PORT>/${APP_PORT}/g" /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf

# Wait for the application to start before accepting ALB requests.
while sleep 2; do
  curl http://app:${APP_PORT}${HEALTHCHECK_PATH:-/health} && break
done

# run in foreground as pid 1
exec /usr/sbin/nginx -g 'daemon off;' -c /etc/nginx/nginx.conf