Skip to content

Commit f259227

Browse files
authored
Merge pull request #412 from os2display/feature/5402-align-nginx-env-vars
5402: Align nginx image env-var contract
2 parents 795d70c + 4baeed2 commit f259227

6 files changed

Lines changed: 39 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ All notable changes to this project will be documented in this file.
4141
- Annotated `.env` so it serves as the canonical, self-documenting Symfony
4242
env example, with a CI check that enforces it stays in sync with `config/`.
4343
- Switched image build pipeline to GHCR with multi-arch layer caching.
44+
- Aligned the nginx image env-var contract: split `NGINX_FPM_SERVICE` and
45+
`NGINX_FPM_PORT`, raised upload cap and trusted-proxy CIDR defaults.
4446

4547
### NB! Prior to 3.x the project was split into separate repositories
4648

docker-compose.override.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ services:
4141
networks:
4242
- app
4343
depends_on:
44-
- nginx
44+
nginx:
45+
condition: service_healthy
4546
volumes:
4647
- .:/app
4748
- /tmp/.X11-unix:/tmp/.X11-unix

docker-compose.server.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,25 @@ services:
3333
- ./infrastructure/nginx/etc/nginx.conf:/etc/nginx/nginx.conf:ro
3434
- .:/app
3535
environment:
36-
NGINX_FPM_SERVICE: ${COMPOSE_PROJECT_NAME}-phpfpm-1:9000
36+
NGINX_FPM_SERVICE: ${COMPOSE_PROJECT_NAME}-phpfpm-1
37+
NGINX_FPM_PORT: 9000
3738
NGINX_WEB_ROOT: /app/public
3839
NGINX_PORT: 8080
3940
NGINX_MAX_BODY_SIZE: 5M
4041
NGINX_SET_REAL_IP_FROM: 172.16.0.0/12
42+
healthcheck:
43+
# $$NGINX_PORT escapes compose-time interpolation; the variable is
44+
# expanded by the shell inside the container against the service's
45+
# environment.
46+
test:
47+
[
48+
"CMD-SHELL",
49+
'wget --quiet --tries=1 --spider "http://localhost:$$NGINX_PORT/health"',
50+
]
51+
interval: 5s
52+
timeout: 3s
53+
retries: 6
54+
start_period: 5s
4155
labels:
4256
- "traefik.enable=true"
4357
- "traefik.docker.network=frontend"

docker-compose.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,25 @@ services:
6161
- ./infrastructure/nginx/etc/nginx.conf:/etc/nginx/nginx.conf:ro
6262
- .:/app
6363
environment:
64-
NGINX_FPM_SERVICE: ${COMPOSE_PROJECT_NAME}-phpfpm-1:9000
64+
NGINX_FPM_SERVICE: ${COMPOSE_PROJECT_NAME}-phpfpm-1
65+
NGINX_FPM_PORT: 9000
6566
NGINX_WEB_ROOT: /app/public
6667
NGINX_PORT: 8080
6768
NGINX_MAX_BODY_SIZE: 5M
6869
NGINX_SET_REAL_IP_FROM: 172.16.0.0/12
70+
healthcheck:
71+
# $$NGINX_PORT escapes compose-time interpolation; the variable is
72+
# expanded by the shell inside the container against the service's
73+
# environment.
74+
test:
75+
[
76+
"CMD-SHELL",
77+
'wget --quiet --tries=1 --spider "http://localhost:$$NGINX_PORT/health"',
78+
]
79+
interval: 5s
80+
timeout: 3s
81+
retries: 6
82+
start_period: 5s
6983
labels:
7084
- "traefik.enable=true"
7185
- "traefik.docker.network=frontend"

infrastructure/nginx/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ ARG GID=101
7171
ENV APP_CLIENT_PATH=/app \
7272
APP_API_PATH=/var/www/html \
7373
NGINX_PORT=8080 \
74-
NGINX_SET_REAL_IP_FROM=172.17.0.0/16 \
75-
NGINX_MAX_BODY_SIZE=10m \
74+
NGINX_FPM_SERVICE=os2display \
75+
NGINX_FPM_PORT=9000 \
76+
NGINX_MAX_BODY_SIZE=140m \
77+
NGINX_SET_REAL_IP_FROM=172.16.0.0/12 \
7678
NGINX_WEB_ROOT=/var/www/html/public
7779

7880
WORKDIR ${APP_API_PATH}

infrastructure/nginx/etc/templates/default.conf.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
upstream api_backend {
2-
server ${NGINX_FPM_SERVICE};
2+
server ${NGINX_FPM_SERVICE}:${NGINX_FPM_PORT};
33
keepalive 16;
44
}
55

0 commit comments

Comments
 (0)