feat: add initial Docker Compose infrastructure

This commit is contained in:
2026-04-28 11:08:06 +02:00
parent 18ab0a8b99
commit 04f31c5105
15 changed files with 279 additions and 14 deletions

View File

@@ -5,10 +5,12 @@ AzioneLab should deploy with a simple Docker Compose topology:
- `nginx`: public reverse proxy and static frontend server;
- `frontend`: Angular build source or build stage for static assets;
- `backend`: Django 5.2 LTS application served by gunicorn;
- `db`: PostgreSQL database.
- `postgres`: PostgreSQL database.
Only nginx should expose public ports. The backend and database should stay on the internal Compose network.
The initial Compose setup is located at `infra/docker/compose.yml`.
## Services
### nginx
@@ -37,6 +39,8 @@ Deployment options:
The first option is preferred for a simple production deployment because nginx can serve immutable built assets without a long-running Node process.
At the infrastructure placeholder stage, the `frontend` service serves a static placeholder page with nginx. The Angular build will replace this placeholder later.
### backend
The backend is a Django application served by gunicorn.
@@ -51,7 +55,9 @@ Responsibilities:
The backend should run database migrations before or during deployment through an explicit operational command, not as hidden startup magic unless that choice is documented later.
### db
At the infrastructure placeholder stage, the `backend` service runs gunicorn against a minimal placeholder WSGI application. The real Django application will replace it later.
### postgres
PostgreSQL is the only database service.
@@ -84,6 +90,8 @@ Generated QR codes may also be generated on demand instead of stored as files. I
## Configuration
Copy `.env.example` to `.env` and replace all placeholder values before running or deploying the stack.
Required backend configuration:
- `DJANGO_SECRET_KEY`;
@@ -129,21 +137,25 @@ The exact commands will be finalized when application code and Compose files are
Expected production-style flow:
```bash
docker compose build
docker compose run --rm backend python manage.py migrate
docker compose run --rm backend python manage.py collectstatic --noinput
docker compose up -d
docker compose --env-file .env -f infra/docker/compose.yml build
docker compose --env-file .env -f infra/docker/compose.yml run --rm backend python manage.py migrate
docker compose --env-file .env -f infra/docker/compose.yml run --rm backend python manage.py collectstatic --noinput
docker compose --env-file .env -f infra/docker/compose.yml up -d
```
Expected validation commands:
```bash
docker compose config
docker compose run --rm backend python manage.py check --deploy
docker compose run --rm backend python manage.py test
docker compose --env-file .env.example -f infra/docker/compose.yml config
docker compose --env-file .env -f infra/docker/compose.yml run --rm backend python manage.py check --deploy
docker compose --env-file .env -f infra/docker/compose.yml run --rm backend python manage.py test
```
The repository does not yet define the canonical Docker-based test command.
The canonical repository check for the current infrastructure stage is:
```bash
docker compose --env-file .env.example -f infra/docker/compose.yml config
```
## Rollback