Skip to content

Commit

Permalink
Merge pull request #13 from Lotto24/health-check
Browse files Browse the repository at this point in the history
Add health-check
  • Loading branch information
mqasimsarfraz authored Jun 25, 2020
2 parents 78a509b + afca9f6 commit 6716810
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apk add -v --no-cache bind-tools python py-pip supervisor \
&& pip install --upgrade pip awscli==1.11.183 \
&& apk -v --purge del py-pip

COPY files/startup.sh files/renew_token.sh /
COPY files/startup.sh files/renew_token.sh files/health-check.sh /
COPY files/ecr.ini /etc/supervisor.d/ecr.ini
COPY files/root /etc/crontabs/root

Expand All @@ -19,5 +19,7 @@ COPY files/ssl.conf /usr/local/openresty/nginx/conf/ssl.conf
ENV PORT 5000
RUN chmod a+x /startup.sh /renew_token.sh

HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD /health-check.sh

ENTRYPOINT ["/startup.sh"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
2 changes: 2 additions & 0 deletions files/health-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
wget localhost:PORT/healthz -q -O - > /dev/null 2>&1
5 changes: 5 additions & 0 deletions files/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ http {
add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always;
add_header "Access-Control-Allow-Origin" "*";

# health check
location /healthz {
return 200;
}

location / {
set $url UPSTREAM;
proxy_pass $url;
Expand Down
3 changes: 3 additions & 0 deletions files/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ sed -i -e s!SCHEME!"$SCHEME"!g $CONFIG
sed -i -e s!SSL_INCLUDE!"$SSL_INCLUDE"!g $CONFIG
sed -i -e s!SSL_LISTEN!"$SSL_LISTEN"!g $CONFIG

# Update health-check
sed -i -e s!PORT!"$PORT"!g /health-check.sh

# setup ~/.aws directory
AWS_FOLDER='/root/.aws'
mkdir -p ${AWS_FOLDER}
Expand Down

0 comments on commit 6716810

Please sign in to comment.