Skip to content

Commit

Permalink
Expose healthcheck endpoint (#269)
Browse files Browse the repository at this point in the history
* Expose healthcheck endpoint

* Wait for service to be live before running tests
  • Loading branch information
c-w authored Dec 26, 2019
1 parent e86d9cf commit c12370d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docker/integtest/0-wait-for-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ wait_for_appinsights() {
log "Appinsights is running"
}

wait_for_api() {
while ! curl -fs "http://nginx:8888/healthcheck/ping" >/dev/null; do
log "Waiting for api"
sleep "${polling_interval_seconds}s"
done

log "Api is running"
}

wait_for_rabbitmq
wait_for_postgres
wait_for_appinsights
wait_for_api
12 changes: 12 additions & 0 deletions docker/nginx/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ http {

keepalive_timeout 65;

upstream healthcheck_hosts {
server ${HOSTNAME_EMAIL_RECEIVE};
server ${HOSTNAME_CLIENT_METRICS};
server ${HOSTNAME_CLIENT_WRITE};
server ${HOSTNAME_CLIENT_READ};
server ${HOSTNAME_CLIENT_REGISTER};
}

server {
listen ${PORT};

Expand All @@ -37,6 +45,10 @@ http {
root /static;
}

location /healthcheck {
proxy_pass http://healthcheck_hosts;
}

location /api/email/sendgrid {
proxy_pass http://${HOSTNAME_EMAIL_RECEIVE};
}
Expand Down

0 comments on commit c12370d

Please sign in to comment.