Skip to content

Commit 6716810

Browse files
Merge pull request #13 from Lotto24/health-check
Add health-check
2 parents 78a509b + afca9f6 commit 6716810

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN apk add -v --no-cache bind-tools python py-pip supervisor \
99
&& pip install --upgrade pip awscli==1.11.183 \
1010
&& apk -v --purge del py-pip
1111

12-
COPY files/startup.sh files/renew_token.sh /
12+
COPY files/startup.sh files/renew_token.sh files/health-check.sh /
1313
COPY files/ecr.ini /etc/supervisor.d/ecr.ini
1414
COPY files/root /etc/crontabs/root
1515

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

22+
HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD /health-check.sh
23+
2224
ENTRYPOINT ["/startup.sh"]
2325
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]

files/health-check.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
wget localhost:PORT/healthz -q -O - > /dev/null 2>&1

files/nginx.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ http {
5454
add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always;
5555
add_header "Access-Control-Allow-Origin" "*";
5656

57+
# health check
58+
location /healthz {
59+
return 200;
60+
}
61+
5762
location / {
5863
set $url UPSTREAM;
5964
proxy_pass $url;

files/startup.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ sed -i -e s!SCHEME!"$SCHEME"!g $CONFIG
6161
sed -i -e s!SSL_INCLUDE!"$SSL_INCLUDE"!g $CONFIG
6262
sed -i -e s!SSL_LISTEN!"$SSL_LISTEN"!g $CONFIG
6363

64+
# Update health-check
65+
sed -i -e s!PORT!"$PORT"!g /health-check.sh
66+
6467
# setup ~/.aws directory
6568
AWS_FOLDER='/root/.aws'
6669
mkdir -p ${AWS_FOLDER}

0 commit comments

Comments
 (0)