A1: Django skeleton with web and worker processes (ADR-54, ADR-55, WEB-01, WEB-07, ARC-70..74)
Django 5.2 project (config/, apps/accounts with a custom User and case-insensitive usernames, apps/lottery with the run_worker command, apps/web with a placeholder home and /health/live, apps/ops), SQLite in WAL with IMMEDIATE transactions, secrets and hosts from the environment. The compose stack is now web + worker + caddy and serves https://localhost; the old FastAPI service is out of the stack until roadmap D1. The three old infrastructure tests follow the new Dockerfile and compose. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79f7ebe53e
commit
fc23a75c9b
43 files changed
+709
-61
No files matched your search
+24
-3
@@ -5,8 +5,9 @@ Prefisso: `WEB`. Origine: [../TODO.md](../TODO.md). Scelte: [ADR-54](adr/ADR-54-
|
||||
(staff), [ADR-57](adr/ADR-57-due-pause-distinte-dopo-round-e-incidente.md) (pause),
|
||||
[ADR-60](adr/ADR-60-pilota-solo-italiano.md) (lingua).
|
||||
|
||||
Tutti i requisiti di questo documento sono `*Stato:* da implementare`: oggi
|
||||
il sito è `index.html` con backend FastAPI (vedi [architettura.md](architettura.md)).
|
||||
I requisiti sono `*Stato:* da implementare` salvo dove indicato diversamente; la
|
||||
sequenza è in [../roadmap.md](../roadmap.md). Il vecchio sito è `index.html` con
|
||||
backend FastAPI (vedi [architettura.md](architettura.md)).
|
||||
|
||||
## 1 · Struttura
|
||||
|
||||
@@ -26,7 +27,8 @@ il sito è `index.html` con backend FastAPI (vedi [architettura.md](architettura
|
||||
| `/ops/` | staff | supervisione e azioni operative autorizzate |
|
||||
| `/admin/` | staff con permessi sui modelli | utenti e segnalazioni; record di gioco in sola lettura |
|
||||
|
||||
*Codice:* da implementare · *Test:* da implementare
|
||||
*Stato:* scheletro (A1): progetto Django, `/` segnaposto, `/admin/` ·
|
||||
*Codice:* `config/urls.py`, `apps/web/urls.py` · *Test:* `tests/django/test_scaffold.py::test_home_answers_on_localhost`
|
||||
- **[WEB-02]** L'autenticazione usa le sessioni Django; ogni scrittura è
|
||||
protetta da CSRF e il cookie di sessione ha gli attributi `Secure`,
|
||||
`HttpOnly` e `SameSite`.
|
||||
@@ -47,6 +49,9 @@ il sito è `index.html` con backend FastAPI (vedi [architettura.md](architettura
|
||||
dominio definitivo si aggiunge solo con la configurazione (`SITE_ADDRESS`,
|
||||
`ALLOWED_HOSTS`, `CSRF_TRUSTED_ORIGINS`), senza modifiche al codice, e i
|
||||
cookie `Secure` valgono solo dove c'è HTTPS ([WEB-02]).
|
||||
*Stato:* implementato (A1) ·
|
||||
*Codice:* `config/settings.py`, `docker-compose.yml`, `Caddyfile` ·
|
||||
*Test:* `tests/django/test_scaffold.py::test_domain_comes_from_configuration_only`, `test_unknown_host_is_refused`
|
||||
|
||||
## 2 · Area pubblica
|
||||
|
||||
@@ -108,3 +113,19 @@ il sito è `index.html` con backend FastAPI (vedi [architettura.md](architettura
|
||||
- **[WEB-44]** Ogni comando operativo è negato a un giocatore e a uno staff
|
||||
senza il permesso specifico, si riflette sul sito con l'effetto previsto e
|
||||
compare nell'audit.
|
||||
|
||||
## 6 · Avvio in locale
|
||||
|
||||
Per navigare il sito su `https://localhost` (certificato autofirmato: l'avviso del browser alla prima visita è atteso):
|
||||
|
||||
```bash
|
||||
mkdir -p data/db
|
||||
cp .env.example .env # poi impostare DJANGO_SECRET_KEY (almeno 50 caratteri):
|
||||
python3 -c "import secrets; print(secrets.token_urlsafe(64))"
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
Servizi: `web` (Django + gunicorn, applica le migrazioni), `worker` ([ARC-71]) e `caddy`.
|
||||
Con un dominio reale basta `SITE_ADDRESS=lottery.example.com docker compose up -d`
|
||||
([WEB-07]). Il vecchio `docs/setup.md` e `docs/running-the-server.md` descrivono lo stack
|
||||
FastAPI, che non è più nel compose.
|
||||
Reference in new issue
Block a user