- Fix relative imports in memory_read.py to use absolute app paths - Change celery scheduler command from `python app/celery_task_scheduler.py` to `python -m app.celery_task_scheduler`
112 lines
3.0 KiB
YAML
112 lines
3.0 KiB
YAML
services:
|
|
# FastAPI application
|
|
api:
|
|
image: redbear-mem-open:latest
|
|
container_name: api
|
|
ports:
|
|
- "8002:8000"
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- ./files:/files
|
|
- /etc/localtime:/etc/localtime:ro
|
|
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload --log-level debug
|
|
restart: unless-stopped
|
|
networks:
|
|
- default
|
|
- celery
|
|
- sandbox
|
|
depends_on:
|
|
- worker-memory
|
|
- worker-document
|
|
- worker-periodic
|
|
|
|
# Memory worker - Memory read/write tasks (threads pool for asyncio)
|
|
worker-memory:
|
|
image: redbear-mem-open:latest
|
|
container_name: worker-memory
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- ./files:/files
|
|
- /etc/localtime:/etc/localtime:ro
|
|
command: celery -A app.celery_worker.celery_app worker -E --loglevel=info --pool=threads --concurrency=100 --queues=memory_tasks -n memory_worker@%h
|
|
restart: unless-stopped
|
|
networks:
|
|
- celery
|
|
|
|
# Document worker - Document parsing tasks (prefork for CPU-bound)
|
|
worker-document:
|
|
image: redbear-mem-open:latest
|
|
container_name: worker-document
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- ./files:/files
|
|
- /etc/localtime:/etc/localtime:ro
|
|
command: celery -A app.celery_worker.celery_app worker -E --loglevel=info --pool=prefork --concurrency=4 --queues=document_tasks --max-tasks-per-child=100 -n document_worker@%h
|
|
restart: unless-stopped
|
|
networks:
|
|
- celery
|
|
|
|
# Periodic worker - Scheduled/beat tasks + API-triggered tasks (prefork, low concurrency)
|
|
worker-periodic:
|
|
image: redbear-mem-open:latest
|
|
container_name: worker-periodic
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- ./files:/files
|
|
- /etc/localtime:/etc/localtime:ro
|
|
command: celery -A app.celery_worker.celery_app worker -E --loglevel=info --pool=prefork --concurrency=2 --queues=periodic_tasks --max-tasks-per-child=50 -n periodic_worker@%h
|
|
restart: unless-stopped
|
|
networks:
|
|
- celery
|
|
|
|
celery-task-scheduler:
|
|
image: redbear-mem-open:latest
|
|
container_name: celery-task-scheduler
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- /etc/localtime:/etc/localtime:ro
|
|
command: python -m app.celery_task_scheduler
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: CMD curl -f 127.0.0.1:8001 || exit 1
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
networks:
|
|
- celery
|
|
|
|
# Celery Beat - scheduler
|
|
beat:
|
|
image: redbear-mem-open:latest
|
|
container_name: celery-beat
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- ./files:/files
|
|
- /etc/localtime:/etc/localtime:ro
|
|
command: celery -A app.celery_worker.celery_app beat --loglevel=info
|
|
restart: unless-stopped
|
|
networks:
|
|
- celery
|
|
depends_on:
|
|
- worker-memory
|
|
|
|
sandbox:
|
|
image: redbear_sandbox:latest
|
|
container_name: sandbox
|
|
ports:
|
|
- "8194"
|
|
command: /code/.venv/bin/uvicorn main:app --host 0.0.0.0 --port 8194 --log-level debug
|
|
restart: unless-stopped
|
|
networks:
|
|
- sandbox
|
|
|
|
networks:
|
|
celery:
|
|
sandbox:
|