Nginx-ingress-config inline via compose configs.content

Coolify materialiseert bij een git-compose alleen de compose + .env, niet losse
repo-bestanden -> een ./docker/nginx.conf bind-mount wordt een lege map (default
nginx). Config nu inline (configs.content, $ als $$). docker/nginx.conf verwijderd.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
claude-macmini 2026-09-08 19:22:40 +02:00
parent 817a7cdf77
commit 492dbfa478
3 changed files with 74 additions and 69 deletions

View file

@ -16,9 +16,12 @@ gedraaid, met **exact gepinde image-tags**:
- **Geen** registry-image, **geen** Forgejo Actions/CI (er wordt niets gebouwd).
- **Geen** host-watcher-entry — voeg OpnForm dus **niet** toe aan `deploy-watcher/watch.sh`.
- Coolify klont deze repo en draait `docker compose up`. De losse `docker/nginx.conf`
wordt door Coolify **niet** geïnterpoleerd (bevat nginx-`$`-variabelen) — dáárom
git-based i.p.v. een raw compose-blok.
- Coolify klont deze repo en draait `docker compose up`.
- **Nginx-ingress-config staat INLINE in de compose** (top-level `configs:` →
`content:`), niet als los bestand: Coolify materialiseert bij een git-compose
alleen de compose + `.env` in de app-map, niet de overige repo-bestanden — een
`./docker/nginx.conf`-bind-mount wordt dan een lege map. Inline is self-contained.
De nginx-`$`-variabelen zijn als `$$` geschreven (docker compose zet `$$`→`$`).
Zie ook de infra-skill `forgejo-coolify-pipeline` (§ OpnForm) en runbook
`runbooks/opnform-cx33.md`.

View file

@ -160,12 +160,16 @@ services:
restart: unless-stopped
environment:
# Coolify: expose service 'ingress' op container-poort 80 achter het
# toegewezen domein (Traefik + Let's Encrypt). Leeg = auto (sslip);
# zet dit op https://forms.doc-gen.eu voor de cutover.
# toegewezen domein (Traefik + Let's Encrypt). Het echte domein zet je
# in Coolify (docker_compose_domains), niet hier.
SERVICE_FQDN_INGRESS_80: ""
NGINX_MAX_BODY_SIZE: 64m
volumes:
- ./docker/nginx.conf:/etc/nginx/templates/default.conf.template:ro
# De nginx-config staat INLINE (zie 'configs' onderaan) i.p.v. als
# bind-mount: Coolify materialiseert bij een git-compose alleen de
# compose + .env in de app-map, niet losse repo-bestanden — een
# ./docker/nginx.conf-mount wordt dan een lege map. Inline is self-contained.
configs:
- source: nginx_conf
target: /etc/nginx/conf.d/default.conf
depends_on:
api:
condition: service_started
@ -182,3 +186,62 @@ volumes:
postgres-data:
opnform_storage:
redis-data:
# Nginx-ingress-config inline. Alle nginx-$-variabelen zijn als $$ geschreven
# zodat docker compose ze NIET interpoleert (compose zet $$ -> $ terug); pas de
# gerenderde config bevat de juiste nginx-variabelen. client_max_body_size is
# hardgecodeerd (64m). Upstreams via de compose SERVICE-namen api/ui.
configs:
nginx_conf:
content: |
map $$request_uri $$api_uri {
~^/api(/.*$$) $$1;
default $$request_uri;
}
server {
listen 80;
server_name opnform;
root /usr/share/nginx/html/public;
client_max_body_size 64m;
access_log /dev/stdout;
error_log /dev/stderr error;
index index.html index.htm index.php;
location / {
proxy_http_version 1.1;
proxy_pass http://ui:3000;
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $$host;
proxy_set_header X-Forwarded-Port $$server_port;
proxy_set_header X-Forwarded-Proto $$http_x_forwarded_proto;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "Upgrade";
}
location ~/(api|open|local\/temp|forms\/assets)/ {
set $$original_uri $$uri;
try_files $$uri $$uri/ /index.php$$is_args$$args;
}
location ~ \.php$$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$$;
fastcgi_pass api:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $$document_root/index.php;
fastcgi_param REQUEST_URI $$api_uri;
fastcgi_param HTTP_X_FORWARDED_FOR $$proxy_add_x_forwarded_for;
fastcgi_param HTTP_X_FORWARDED_HOST $$http_x_forwarded_host;
fastcgi_param HTTP_X_FORWARDED_PORT $$http_x_forwarded_port;
fastcgi_param HTTP_X_FORWARDED_PROTO $$http_x_forwarded_proto;
}
location ~ /\. {
deny all;
}
}

View file

@ -1,61 +0,0 @@
# OpnForm ingress — HTTP<->FastCGI + routing.
# Upstreams via docker-compose SERVICE-namen (api/ui): die zijn altijd
# resolvbaar op het compose-netwerk, ook als Coolify de container-namen wijzigt.
# Dit bestand wordt als nginx-TEMPLATE gemount; alleen ${NGINX_MAX_BODY_SIZE}
# wordt door de nginx-entrypoint (envsubst) ingevuld. Alle andere $-tokens zijn
# nginx-variabelen en blijven ongemoeid (staan niet in de container-env).
map $request_uri $api_uri {
~^/api(/.*$) $1;
default $request_uri;
}
server {
listen 80;
server_name opnform;
root /usr/share/nginx/html/public;
client_max_body_size ${NGINX_MAX_BODY_SIZE};
access_log /dev/stdout;
error_log /dev/stderr error;
index index.html index.htm index.php;
location / {
proxy_http_version 1.1;
proxy_pass http://ui:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location ~/(api|open|local\/temp|forms\/assets)/ {
set $original_uri $uri;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass api:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param REQUEST_URI $api_uri;
# Laravel accepteert deze headers alleen van IP's in TRUSTED_PROXIES.
# Zo blijft het echte client-IP + het https-schema achter Traefik/nginx behouden.
fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
fastcgi_param HTTP_X_FORWARDED_HOST $http_x_forwarded_host;
fastcgi_param HTTP_X_FORWARDED_PORT $http_x_forwarded_port;
fastcgi_param HTTP_X_FORWARDED_PROTO $http_x_forwarded_proto;
}
# Weiger toegang tot .-bestanden
location ~ /\. {
deny all;
}
}