From 4933e89d74a9c46b0993fc3a70b6e0b35958c30e Mon Sep 17 00:00:00 2001 From: ebrahimmfadae Date: Sun, 26 Jun 2022 14:44:12 +0430 Subject: [PATCH 1/2] Expose health checks in a separate config file --- Dockerfile | 1 + health-check.conf | 6 ++++++ nginx.conf | 2 ++ 3 files changed, 9 insertions(+) create mode 100644 health-check.conf diff --git a/Dockerfile b/Dockerfile index 3e5fb3d..a2bc0a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ FROM nginx:1.20.2 COPY nginx.conf /etc/nginx/nginx.conf.org +COPY health-check.conf /etc/nginx/ ENV EXPOSED_PORT 443 ENTRYPOINT sh -c 'envsubst \$EXPOSED_PORT < /etc/nginx/nginx.conf.org | tee /etc/nginx/nginx.conf && nginx -g "daemon off;"' EXPOSE 443 diff --git a/health-check.conf b/health-check.conf new file mode 100644 index 0000000..7560892 --- /dev/null +++ b/health-check.conf @@ -0,0 +1,6 @@ +location ~ ^\/(auth|wallet|gateway|matching-engine|storage|referral|stream|ipg|admin|api|captcha|bitcoin-scanner|ethereum-scanner|bsc-scanner|tron-scanner|scanner-scheduler|binance):8080\/actuator\/health$ { + rewrite ^\/(.*)\/actuator\/health$ $1; + set $backend http://$uri; + proxy_pass $backend; + rewrite .* /actuator/health break; +} diff --git a/nginx.conf b/nginx.conf index 9cd9f25..7ec6ac6 100644 --- a/nginx.conf +++ b/nginx.conf @@ -110,6 +110,8 @@ http { return 204; } + include /etc/nginx/health-check.conf; + location /wallet/transfer { return 403; } From b6ab9abee09af34d7212b6eda1c4a0ccbb795d4b Mon Sep 17 00:00:00 2001 From: ebrahimmfadae Date: Sun, 26 Jun 2022 14:44:53 +0430 Subject: [PATCH 2/2] Improve EXPOSED_PORT implementation --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 6658dd9..f17834e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,5 +3,7 @@ services: nginx: image: ghcr.io/opexdev/nginx:$TAG build: . + ports: + - "$EXPOSED_PORT:443" environment: - EXPOSED_PORT=$EXPOSED_PORT