Open-Generative-AI/docker-compose.yml
Anuragp22 47dd61f33a feat(batch): add Prisma schema and Postgres wiring for batch feature
First slice of the CSV-driven batch video-generation feature. Introduces
the four-table schema (trainers, studios, batches, jobs) that the worker
and new /batch UI will operate on, plus the infrastructure glue so the
schema can be applied locally and in the docker-compose stack.

- prisma/schema.prisma: Trainer, Studio, Batch, Job models with the
  indexes the worker's claim query will need
  ([batchId, status] and [status, nextAttemptAt]).
- prisma/migrations/20260423011041_init_batch_schema: initial migration
  generated and applied against the compose Postgres.
- lib/prisma.js: standard Next.js PrismaClient singleton, reused across
  the web API routes and the worker process.
- docker-compose.yml: map Postgres to host port 5433 to avoid colliding
  with a pre-existing local Postgres on 5432; wire MUAPI_API_KEY env
  through web and worker; add uploads_data volume mounted at
  /data/uploads for slice-2 trainer/studio image backups.
- .env.example: documented DATABASE_URL (5433 for host, 5432 for
  in-compose) and MUAPI_API_KEY placeholders.
- .gitignore: ignore /data/uploads/ now so future runtime uploads
  don't end up tracked.

Also downgraded prisma from 7.x to ^6 since 7 moved datasource config
out of schema.prisma into a separate prisma.config.ts (breaking change
we don't need to absorb yet).

No API routes, worker, or UI in this slice — those land in the next
branches (feat/trainers-studios-crud, feat/batch-create-csv, etc).
2026-04-23 06:41:31 +05:30

61 lines
1.5 KiB
YAML

services:
postgres:
image: postgres:16-alpine
container_name: ogai-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ogai
POSTGRES_PASSWORD: ogai_dev_pw
POSTGRES_DB: ogai
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5433:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ogai -d ogai"]
interval: 10s
timeout: 5s
retries: 5
web:
build: .
image: open-generative-ai:latest
container_name: open-gen-ai
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- DATABASE_URL=postgresql://ogai:ogai_dev_pw@postgres:5432/ogai
- MUAPI_API_KEY=${MUAPI_API_KEY:-}
volumes:
- uploads_data:/data/uploads
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000"]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
worker:
build: .
image: open-generative-ai:latest
container_name: ogai-worker
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
- NODE_ENV=production
- DATABASE_URL=postgresql://ogai:ogai_dev_pw@postgres:5432/ogai
- MUAPI_API_KEY=${MUAPI_API_KEY:-}
volumes:
- uploads_data:/data/uploads
command: ["node", "worker/index.js"]
volumes:
postgres_data:
uploads_data: