From a2816201789542306eae4fa418a6673a6bbcaf17 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 14 May 2026 07:42:36 -0400 Subject: [PATCH] feat: add docker-compose stack (web/worker/scheduler/ml-worker + postgres + redis) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prod compose references the Forgejo registry; dev compose builds locally and exposes DB/Redis ports. Volume layout: ./images, ./import, ./downloads, ./models (all gitignored, anchored to repo root). Plain HTTP only — no TLS in-app (spec §2.1). Co-Authored-By: Claude Opus 4.7 (1M context) --- docker-compose.dev.yml | 45 +++++++++++++++++++++ docker-compose.yml | 91 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 docker-compose.dev.yml create mode 100644 docker-compose.yml diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..5baecb7 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,45 @@ +services: + postgres: + ports: + - "5432:5432" + + redis: + ports: + - "6379:6379" + + web: + build: + context: . + dockerfile: Dockerfile + environment: + LOG_LEVEL: DEBUG + volumes: + - ./backend:/app/backend + - ./alembic:/app/alembic + + worker: + build: + context: . + dockerfile: Dockerfile + environment: + LOG_LEVEL: DEBUG + volumes: + - ./backend:/app/backend + + scheduler: + build: + context: . + dockerfile: Dockerfile + environment: + LOG_LEVEL: DEBUG + volumes: + - ./backend:/app/backend + + ml-worker: + build: + context: . + dockerfile: Dockerfile.ml + environment: + LOG_LEVEL: DEBUG + volumes: + - ./backend:/app/backend diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7b5c7ca --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,91 @@ +services: + redis: + image: redis:7-alpine + volumes: + - redis_data:/data + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + + postgres: + image: pgvector/pgvector:pg16 + environment: + POSTGRES_USER: ${DB_USER:-fabledcurator} + POSTGRES_PASSWORD: ${DB_PASSWORD} + POSTGRES_DB: ${DB_NAME:-fabledcurator} + volumes: + - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-fabledcurator}"] + interval: 10s + timeout: 5s + retries: 5 + + web: + image: git.fabledsword.com/bvandeusen/fabledcurator:dev + command: ["web"] + ports: + - "${PORT:-8080}:8080" + env_file: .env + environment: &app_env + DB_HOST: postgres + DB_PORT: "5432" + CELERY_BROKER_URL: redis://redis:6379/0 + CELERY_RESULT_BACKEND: redis://redis:6379/0 + volumes: + - ./images:/images + - ./import:/import + - ./downloads:/downloads + depends_on: + postgres: { condition: service_healthy } + redis: { condition: service_healthy } + + worker: + image: git.fabledsword.com/bvandeusen/fabledcurator:dev + command: ["worker"] + environment: + <<: *app_env + CELERY_QUEUES: default,import,thumbnail,download + CELERY_CONCURRENCY: "2" + env_file: .env + volumes: + - ./images:/images + - ./import:/import + - ./downloads:/downloads + depends_on: + postgres: { condition: service_healthy } + redis: { condition: service_healthy } + + scheduler: + image: git.fabledsword.com/bvandeusen/fabledcurator:dev + command: ["scheduler"] + environment: + <<: *app_env + CELERY_QUEUES: maintenance,scan + env_file: .env + volumes: + - ./images:/images + - ./import:/import + - ./downloads:/downloads + depends_on: + postgres: { condition: service_healthy } + redis: { condition: service_healthy } + + ml-worker: + image: git.fabledsword.com/bvandeusen/fabledcurator-ml:dev + command: ["ml-worker"] + environment: + <<: *app_env + env_file: .env + volumes: + - ./images:/images:ro + - ./models:/models + depends_on: + postgres: { condition: service_healthy } + redis: { condition: service_healthy } + +volumes: + redis_data: + postgres_data: