Skip to content

Commit 4a4ad20

Browse files
committed
Added HEALTHCHECK_LISTEN
1 parent f259603 commit 4a4ad20

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ The above will get the password from AWS Secret Manager secret named `staging`,
4646
- `STATS_PORT=8080` port the stats endpoint listens at. Defaults to 8080.
4747
- `HEALTHCHECK=/health` enables simple healthcheck endpoint at the defined path, accessible from 127.0.0.1 only. Think Docker healthcheck-cmd `curl -sSf 127.0.0.1:8080/health`
4848
- `HEALTHCHECK_PORT=8080` port the healthcheck listens at. Defaults to 8080.
49+
- `HEALTHCHECK_LISTEN=127.0.0.1` IP address the healthcheck listens on. Defaults to 127.0.0.1.
4950

5051
...and some others. See the code.

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ services:
2020
- MICROCACHE=true
2121
- DEBUG=true
2222
- HEALTHCHECK=/health
23+
- HEALTHCHECK_LISTEN=0.0.0.0
2324
- STATS=/stats
2425

2526
service_a:

templates/site.conf.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ limit_req_zone $binary_remote_addr zone=flood:10m rate={{ env('FLOOD_RATE', "5")
1212
{%- if STATS or HEALTHCHECK %}
1313
server {
1414
{%- if STATS_PORT %}
15-
listen 127.0.0.1:{{ env('STATS_PORT', '8080') }};
15+
listen {{ env('HEALTHCHECK_LISTEN', '127.0.0.1') }}:{{ env('STATS_PORT', '8080') }};
1616
{%- elif HEALTHCHECK_PORT %}
17-
listen 127.0.0.1:{{ env('HEALTHCHECK_PORT', '8080') }};
17+
listen {{ env('HEALTHCHECK_LISTEN', '127.0.0.1') }}:{{ env('HEALTHCHECK_PORT', '8080') }};
1818
{%- else %}
19-
listen 127.0.0.1:8080;
19+
listen {{ env('HEALTHCHECK_LISTEN', '127.0.0.1') }}:8080;
2020
{% endif %}
2121
access_log off;
2222
{% if STATS %}

0 commit comments

Comments
 (0)