Add release compose override without source bind mounts

This commit is contained in:
Alfredo Di Stasio
2026-03-10 16:13:37 +01:00
parent dd09b71eb4
commit 1ba1a8eebd
2 changed files with 64 additions and 0 deletions

View File

@ -72,6 +72,8 @@ cp .env.example .env
docker compose up --build
```
This starts the development-oriented topology (source bind mounts enabled).
3. If `AUTO_APPLY_MIGRATIONS=0`, run migrations manually:
```bash
@ -91,6 +93,32 @@ docker compose exec web python manage.py createsuperuser
- Health: http://localhost/health/
- API root endpoints: `/api/players/`, `/api/competitions/`, `/api/teams/`, `/api/seasons/`
## Development vs Release Compose
Development startup (mutable source, HTMX/Tailwind workflow):
```bash
docker compose up --build
```
Release-style startup (immutable runtime containers, no source bind mount in web/celery runtime):
```bash
docker compose -f docker-compose.yml -f docker-compose.release.yml up -d --build
```
Optional release-style stop:
```bash
docker compose -f docker-compose.yml -f docker-compose.release.yml down
```
Notes:
- In release-style mode, `web`, `celery_worker`, and `celery_beat` run from the built image filesystem.
- `tailwind` is marked as `dev` profile in release override and is not started unless `--profile dev` is used.
- `nginx`, `postgres`, and `redis` service naming remains unchanged.
## Setup and Run Notes
- `web` service starts through `entrypoint.sh` and waits for PostgreSQL readiness.
@ -120,6 +148,14 @@ docker compose exec web python manage.py createsuperuser
This keeps persistent state outside container lifecycles.
In release-style mode, these volumes remain the persistence layer:
- `postgres_data` for database state
- `static_data` for collected static assets served by nginx
- `media_data` for uploaded/provider media
- `runtime_data` for Celery beat schedule/runtime files
- `redis_data` for Redis persistence
## Migrations
Create migration files:

View File

@ -0,0 +1,28 @@
services:
web:
volumes:
- static_data:/app/staticfiles
- media_data:/app/media
- runtime_data:/app/runtime
environment:
DJANGO_SETTINGS_MODULE: config.settings.production
DJANGO_DEBUG: "0"
celery_worker:
volumes:
- runtime_data:/app/runtime
environment:
DJANGO_SETTINGS_MODULE: config.settings.production
DJANGO_DEBUG: "0"
celery_beat:
volumes:
- runtime_data:/app/runtime
environment:
DJANGO_SETTINGS_MODULE: config.settings.production
DJANGO_DEBUG: "0"
tailwind:
profiles:
- dev