diff --git a/docker/integtest/0-wait-for-services.sh b/docker/integtest/0-wait-for-services.sh index e3ef856d..f3159ce8 100755 --- a/docker/integtest/0-wait-for-services.sh +++ b/docker/integtest/0-wait-for-services.sh @@ -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 diff --git a/docker/nginx/nginx.conf.template b/docker/nginx/nginx.conf.template index 607a94d7..2c26d92d 100644 --- a/docker/nginx/nginx.conf.template +++ b/docker/nginx/nginx.conf.template @@ -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}; @@ -37,6 +45,10 @@ http { root /static; } + location /healthcheck { + proxy_pass http://healthcheck_hosts; + } + location /api/email/sendgrid { proxy_pass http://${HOSTNAME_EMAIL_RECEIVE}; }