增加celery任务队列,任务持久化(服务重启不丢)、支持多 Worker 水平扩展、失败自动重试

This commit is contained in:
2026-05-28 17:59:39 +08:00
parent 6ad22e4466
commit 44902207c9
9 changed files with 133 additions and 47 deletions
+28
View File
@@ -80,6 +80,34 @@ services:
networks:
- moldinsight_network
celery-worker:
build: .
container_name: moldinsight_celery
command: >
/bin/bash -c "source /opt/conda/etc/profile.d/conda.sh && conda activate moldinsight && cd /app/src && celery -A celery_app worker --concurrency=2 --loglevel=info"
volumes:
- ./uploads:/app/uploads
- ./html_output:/app/html_output
- ./logs:/app/logs
- ./.env:/app/.env:ro
environment:
- DB_HOST=postgres
- DB_PORT=5432
- DB_NAME=${DB_NAME:-moldinsight}
- DB_USER=${DB_USER:-moldinsight_user}
- DB_PASSWORD=${DB_PASSWORD:-moldinsight_password}
- RUSTFS_ENDPOINT=http://minio:9000
- RUSTFS_ACCESS_KEY=${MINIO_ACCESS_KEY:-minioadmin}
- RUSTFS_SECRET_KEY=${MINIO_SECRET_KEY:-minioadmin}
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
restart: unless-stopped
networks:
- moldinsight_network
volumes:
postgres_data:
driver: local