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.
This commit is contained in:
2025-11-05 20:22:07 +01:00
parent 81d1469e18
commit 2236eeb9a5
21 changed files with 563 additions and 51 deletions

View File

@@ -1,22 +1,23 @@
# docker-compose.yml
version: "3.8"
services:
web:
build: .
command: gunicorn dashboard_project.wsgi:application --bind 0.0.0.0:8000
command: uv run gunicorn dashboard_project.wsgi:application --bind 0.0.0.0:8000 --chdir dashboard_project
volumes:
- .:/app
- static_volume:/app/staticfiles
- media_volume:/app/media
ports:
- 8000:8000
env_file:
- .env
environment:
- DEBUG=0
- SECRET_KEY=your_secret_key_here
- ALLOWED_HOSTS=localhost,127.0.0.1
- DJANGO_SETTINGS_MODULE=dashboard_project.settings
- 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:
@@ -24,7 +25,7 @@ services:
- redis
db:
image: postgres:13
image: postgres:alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
@@ -35,7 +36,7 @@ services:
- 5432:5432
redis:
image: redis:7-alpine
image: redis:alpine
ports:
- 6379:6379
volumes:
@@ -48,12 +49,16 @@ services:
celery:
build: .
command: celery -A dashboard_project worker --loglevel=info
volumes:
- .:/app
command: uv run celery -A dashboard_project worker --loglevel=info --workdir dashboard_project
env_file:
- .env
environment:
- DEBUG=0
- DJANGO_SETTINGS_MODULE=dashboard_project.settings
- 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:
@@ -62,12 +67,16 @@ services:
celery-beat:
build: .
command: celery -A dashboard_project beat --scheduler django_celery_beat.schedulers:DatabaseScheduler
volumes:
- .:/app
command: uv run celery -A dashboard_project beat --scheduler django_celery_beat.schedulers:DatabaseScheduler --workdir dashboard_project
env_file:
- .env
environment:
- DEBUG=0
- DJANGO_SETTINGS_MODULE=dashboard_project.settings
- 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: