feat: add nginx reverse proxy

This commit is contained in:
bisco
2026-06-24 08:59:35 +02:00
parent 8155d94fee
commit b36cd2a754
14 changed files with 228 additions and 37 deletions
+15 -8
View File
@@ -14,22 +14,29 @@ docker compose exec backend python manage.py seed_demo
The backend applies migrations and collects static files before starting Gunicorn.
All services have health checks; wait for healthy status before opening the site.
Compose exposes the Astro site on loopback port `4321` and Django/Wagtail on loopback
port `8000`. PostgreSQL is available only on the Compose network. `postgres_data` and
`media_data` are persistent named volumes.
Add `127.0.0.1 azionelab.org` to the local hosts file, then use
`http://azionelab.org:8080`. NGINX binds to loopback port `8080` by default and routes
the domain to Astro or Wagtail. Their direct loopback ports `4321` and `8000` remain
available for diagnostics. PostgreSQL is available only on the Compose network.
`postgres_data` and `media_data` are persistent named volumes.
The stack uses explicit PostgreSQL 16.9, Python 3.12.12, and Node.js 22.20 image
versions. Containers are not privileged and use `no-new-privileges`.
The stack uses explicit PostgreSQL 16.9, Python 3.12.12, Node.js 22.20, and NGINX 1.30.0
image versions. Containers are not privileged and use `no-new-privileges`.
Required runtime variables are `DATABASE_URL`, `DJANGO_SECRET_KEY`, `DJANGO_DEBUG`,
`DJANGO_ALLOWED_HOSTS`, `WAGTAILADMIN_BASE_URL`, and `PUBLIC_CMS_API_URL`. PostgreSQL
bootstrap variables are also documented in `.env.example`. Do not use the example
credentials outside local development.
`DJANGO_ALLOWED_HOSTS`, `WAGTAILADMIN_BASE_URL`, `PUBLIC_CMS_API_URL`,
`NGINX_BIND_ADDRESS`, and `NGINX_HTTP_PORT`. PostgreSQL bootstrap variables are also
documented in `.env.example`. Do not use the example credentials outside local
development.
`WAGTAILADMIN_BASE_URL` must be browser-reachable because it is used for media URLs.
`PUBLIC_CMS_API_URL` must be reachable by Astro; within Compose it is
`http://backend:8000`.
The local virtual host is HTTP-only. Production must publish NGINX through the intended
network interface, configure DNS for `azionelab.org`, terminate TLS, and prevent direct
external access to application ports.
## Production boundary
The Compose stack is a local development deployment. A public environment still needs