Files
LegacyHUB/docker-compose.yml
Vadim Malanov c2c9e02695
Some checks failed
CI / Backend (lint + tests + compose) (push) Has been cancelled
CI / Frontend (lint + type-check + build) (push) Has been cancelled
fix(compose): pass quarantine/tmp/exports bucket and region env into containers
MINIO_BUCKET_QUARANTINE/TMP/EXPORTS and MINIO_REGION were set in .env but
never reached the containers, so the pipeline fell back to the legacy
teamhub-legacyhub-quarantine name and died with S3 AccessDenied on the
shared platform MinIO (documents stuck at CHUNKING_COMPLETED).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 10:45:26 +03:00

230 lines
7.2 KiB
YAML

name: legacyhub
x-common-env: &common-env
POSTGRES_HOST: ${POSTGRES_HOST:-postgres}
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
POSTGRES_DB: ${POSTGRES_DB:-legacyhub}
POSTGRES_USER: ${POSTGRES_USER:-legacyhub}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-legacyhub}
MINIO_ENDPOINT: ${MINIO_ENDPOINT:-minio:9000}
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-legacyhub}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-legacyhub-secret}
MINIO_BUCKET_ORIGINALS: ${MINIO_BUCKET_ORIGINALS:-teamhub-legacyhub-originals}
MINIO_BUCKET_DERIVED: ${MINIO_BUCKET_DERIVED:-teamhub-legacyhub-derived}
MINIO_BUCKET_QUARANTINE: ${MINIO_BUCKET_QUARANTINE:-teamhub-legacyhub-quarantine}
MINIO_BUCKET_TMP: ${MINIO_BUCKET_TMP:-teamhub-legacyhub-tmp}
MINIO_BUCKET_EXPORTS: ${MINIO_BUCKET_EXPORTS:-teamhub-legacyhub-exports}
MINIO_REGION: ${MINIO_REGION:-us-east-1}
MINIO_SECURE: ${MINIO_SECURE:-false}
OPENSEARCH_HOST: ${OPENSEARCH_HOST:-opensearch}
OPENSEARCH_PORT: ${OPENSEARCH_PORT:-9200}
OPENSEARCH_USE_SSL: ${OPENSEARCH_USE_SSL:-false}
OPENSEARCH_VERIFY_CERTS: ${OPENSEARCH_VERIFY_CERTS:-false}
OPENSEARCH_INDEX_CHUNKS: ${OPENSEARCH_INDEX_CHUNKS:-legacy_chunks}
QDRANT_HOST: ${QDRANT_HOST:-qdrant}
QDRANT_PORT: ${QDRANT_PORT:-6333}
QDRANT_COLLECTION_CHUNKS: ${QDRANT_COLLECTION_CHUNKS:-legacy_chunks}
REDIS_URL: ${REDIS_URL:-redis://redis:6379/0}
OCR_LANGUAGES: ${OCR_LANGUAGES:-rus+eng}
OCR_ENABLED: ${OCR_ENABLED:-true}
DOCLING_OCR_ENABLED: ${DOCLING_OCR_ENABLED:-false}
MAX_DOCUMENT_TIMEOUT_SECONDS: ${MAX_DOCUMENT_TIMEOUT_SECONDS:-180}
EMBEDDING_MODEL: ${EMBEDDING_MODEL:-BAAI/bge-m3}
EMBEDDING_DEVICE: ${EMBEDDING_DEVICE:-cpu}
RERANKER_MODEL: ${RERANKER_MODEL:-BAAI/bge-reranker-v2-m3}
RERANKER_DEVICE: ${RERANKER_DEVICE:-cpu}
RERANKER_ENABLED: ${RERANKER_ENABLED:-true}
APP_ENV: ${APP_ENV:-dev}
APP_LOG_LEVEL: ${APP_LOG_LEVEL:-INFO}
APP_INPUT_DIR: /data/input
APP_WORK_DIR: /data/work
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:5273,http://localhost:4173}
API_KEY: ${API_KEY:-}
INGEST_API_KEY: ${INGEST_API_KEY:-}
# Dispatch participant (D4 bus): values come from the gitignored .env.
DISPATCH_ENABLED: ${DISPATCH_ENABLED:-false}
DISPATCH_API_URL: ${DISPATCH_API_URL:-}
DISPATCH_API_KEY: ${DISPATCH_API_KEY:-}
DISPATCH_PARTICIPANT_CODE: ${DISPATCH_PARTICIPANT_CODE:-legacyhub}
DISPATCH_TIMEOUT_SECONDS: ${DISPATCH_TIMEOUT_SECONDS:-5}
# Module-contract isolation: data services live on the internal-only
# legacyhub_db network (the same name docker-compose.teamhub.yml uses, so the
# federation overlay composes without a parallel network). In dev they also
# join edge so host-published ports keep working; the prod overlay pins them
# to legacyhub_db only. api/worker need edge for the published API port and
# HuggingFace model downloads.
networks:
legacyhub_db:
internal: true
edge: {}
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
networks: [legacyhub_db, edge]
environment:
POSTGRES_DB: ${POSTGRES_DB:-legacyhub}
POSTGRES_USER: ${POSTGRES_USER:-legacyhub}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-legacyhub}
ports:
- "5440:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-legacyhub} -d ${POSTGRES_DB:-legacyhub}"]
interval: 10s
timeout: 5s
retries: 10
minio:
image: minio/minio:RELEASE.2024-08-29T01-40-52Z
restart: unless-stopped
networks: [legacyhub_db, edge]
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-legacyhub}
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:-legacyhub-secret}
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 10
opensearch:
image: opensearchproject/opensearch:2.15.0
restart: unless-stopped
networks: [legacyhub_db, edge]
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g"
- DISABLE_SECURITY_PLUGIN=true
- DISABLE_INSTALL_DEMO_CONFIG=true
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
ports:
- "9200:9200"
- "9600:9600"
volumes:
- opensearch_data:/usr/share/opensearch/data
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:9200/_cluster/health | grep -q '\"status\":\"\\(green\\|yellow\\)\"'"]
interval: 15s
timeout: 10s
retries: 20
qdrant:
image: qdrant/qdrant:v1.11.3
restart: unless-stopped
networks: [legacyhub_db, edge]
ports:
- "6333:6333"
- "6334:6334"
volumes:
- qdrant_data:/qdrant/storage
healthcheck:
test: ["CMD-SHELL", "bash -c '</dev/tcp/127.0.0.1/6333'"]
interval: 15s
timeout: 5s
retries: 10
redis:
image: redis:7-alpine
restart: unless-stopped
networks: [legacyhub_db, edge]
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 10
api:
build:
context: .
dockerfile: docker/Dockerfile
image: legacyhub/api:latest
restart: unless-stopped
networks: [legacyhub_db, edge]
environment:
<<: *common-env
APP_HOST: 0.0.0.0
APP_PORT: 8000
command: ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
healthcheck:
# /api/v1/health is liveness: it answers HTTP 200 even when a dependency
# is degraded, so the container is not restart-looped on data-store issues.
test: ["CMD", "curl", "-fsS", "http://localhost:8000/api/v1/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
ports:
# Host port 8050 avoids the 8000 collision (SalesHUB / old dispatch dev).
# Container still listens on 8000. Overridden by ${API_HOST_PORT}.
- "${API_HOST_PORT:-8050}:8000"
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
opensearch:
condition: service_healthy
qdrant:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./data/input:/data/input
- ./data/work:/data/work
- hf_cache:/root/.cache/huggingface
worker:
build:
context: .
dockerfile: docker/Dockerfile
image: legacyhub/api:latest
restart: unless-stopped
networks: [legacyhub_db, edge]
environment:
<<: *common-env
command: ["celery", "-A", "app.workers.celery_app", "worker", "--loglevel=INFO", "--concurrency=2"]
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
opensearch:
condition: service_healthy
qdrant:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./data/input:/data/input
- ./data/work:/data/work
- hf_cache:/root/.cache/huggingface
volumes:
postgres_data:
minio_data:
opensearch_data:
qdrant_data:
redis_data:
hf_cache: