Files
livegraphs-django/docker-compose.yml
Kaj Kowalski 2236eeb9a5 feat: Add uv Docker, Postgres, and company linking
Introduces uv-based Docker workflow with non-root runtime, cached installs, and uv-run for web and Celery. Updates docker-compose to Postgres + Redis, loads .env, and removes source bind mount for reproducible builds.

Switches settings to use Postgres when env is present with SQLite fallback; broadens allowed hosts for containerized development. Adds psycopg2-binary and updates sample env for Redis in Docker.

Adds company scoping to external data models and links sessions during ingestion; provides management commands to seed a Jumbo company/users and sync external chat data into the dashboard.

Includes .dockerignore, TypeScript config and typings, and minor template/docs tweaks.

Requires database migration.
2025-11-05 20:22:07 +01:00

102 lines
2.5 KiB
YAML

# docker-compose.yml
services:
web:
build: .
command: uv run gunicorn dashboard_project.wsgi:application --bind 0.0.0.0:8000 --chdir dashboard_project
volumes:
- static_volume:/app/staticfiles
- media_volume:/app/media
ports:
- 8000:8000
env_file:
- .env
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/dashboard_db
- POSTGRES_DB=dashboard_db
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_HOST=db
- POSTGRES_PORT=5432
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
depends_on:
- db
- redis
db:
image: postgres:alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=dashboard_db
ports:
- 5432:5432
redis:
image: redis:alpine
ports:
- 6379:6379
volumes:
- redis_data:/data
healthcheck:
test: [CMD, redis-cli, ping]
interval: 30s
timeout: 10s
retries: 3
celery:
build: .
command: uv run celery -A dashboard_project worker --loglevel=info --workdir dashboard_project
env_file:
- .env
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/dashboard_db
- POSTGRES_DB=dashboard_db
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_HOST=db
- POSTGRES_PORT=5432
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
depends_on:
- redis
- web
celery-beat:
build: .
command: uv run celery -A dashboard_project beat --scheduler django_celery_beat.schedulers:DatabaseScheduler --workdir dashboard_project
env_file:
- .env
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/dashboard_db
- POSTGRES_DB=dashboard_db
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_HOST=db
- POSTGRES_PORT=5432
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
depends_on:
- redis
- web
nginx:
image: nginx:latest
ports:
- 80:80
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- static_volume:/app/staticfiles
- media_volume:/app/media
depends_on:
- web
volumes:
postgres_data:
redis_data:
static_volume:
media_volume: