修复生产部署 flower 容器命名冲突

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-05-03 19:02:56 +08:00
parent c8d443c72e
commit 407ff75587
2 changed files with 16 additions and 19 deletions
+16 -10
View File
@@ -180,12 +180,18 @@ jobs:
if ! docker compose version >/dev/null 2>&1; then
COMPOSE_CMD="docker-compose"
fi
COMPOSE_PROJECT_NAME="$(awk -F= '/^COMPOSE_PROJECT_NAME=/{print $2; exit}' deploy/pro-deploy/.env | tr -d '[:space:]')"
COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-fquiz}"
compose_run() {
${COMPOSE_CMD} -p "${COMPOSE_PROJECT_NAME}" --env-file deploy/pro-deploy/.env --env-file deploy/pro-deploy/.env.prod --env-file .images.env -f deploy/pro-deploy/compose.yml "$@"
}
pull_with_retry() {
local max_retries=3
local attempt=1
while true; do
if ${COMPOSE_CMD} --env-file deploy/pro-deploy/.env --env-file deploy/pro-deploy/.env.prod --env-file .images.env -f deploy/pro-deploy/compose.yml pull; then
if compose_run pull; then
break
fi
if [ "${attempt}" -ge "${max_retries}" ]; then
@@ -200,15 +206,15 @@ jobs:
}
pull_with_retry
if ! ${COMPOSE_CMD} --env-file deploy/pro-deploy/.env --env-file deploy/pro-deploy/.env.prod --env-file .images.env -f deploy/pro-deploy/compose.yml up -d --remove-orphans; then
if ! compose_run up -d --remove-orphans; then
echo "[error] docker compose up failed, collecting container diagnostics..."
${COMPOSE_CMD} --env-file deploy/pro-deploy/.env --env-file deploy/pro-deploy/.env.prod --env-file .images.env -f deploy/pro-deploy/compose.yml ps || true
docker logs --tail 300 fquiz-prod-api || true
docker logs --tail 200 fquiz-prod-db || true
docker logs --tail 200 fquiz-prod-redis || true
docker logs --tail 200 fquiz-prod-celery-worker || true
docker logs --tail 200 fquiz-prod-celery-beat || true
docker logs --tail 200 fquiz-prod-flower || true
compose_run ps || true
compose_run logs --no-color --tail 300 api || true
compose_run logs --no-color --tail 200 db || true
compose_run logs --no-color --tail 200 redis || true
compose_run logs --no-color --tail 200 celery-worker || true
compose_run logs --no-color --tail 200 celery-beat || true
compose_run logs --no-color --tail 200 flower || true
exit 1
fi
${COMPOSE_CMD} --env-file deploy/pro-deploy/.env --env-file deploy/pro-deploy/.env.prod --env-file .images.env -f deploy/pro-deploy/compose.yml ps
compose_run ps
-9
View File
@@ -1,7 +1,6 @@
services:
db:
image: ${POSTGRES_IMAGE}
container_name: ${COMPOSE_PROJECT_NAME}-db
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
@@ -15,7 +14,6 @@ services:
redis:
image: ${REDIS_IMAGE}
container_name: ${COMPOSE_PROJECT_NAME}-redis
command:
- redis-server
- --appendonly
@@ -32,7 +30,6 @@ services:
minio:
image: ${MINIO_IMAGE}
container_name: ${COMPOSE_PROJECT_NAME}-minio
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY}
@@ -46,7 +43,6 @@ services:
minio-init:
image: ${MINIO_MC_IMAGE}
container_name: ${COMPOSE_PROJECT_NAME}-minio-init
depends_on:
- minio
entrypoint: /bin/sh
@@ -66,7 +62,6 @@ services:
api:
image: ${API_IMAGE}
container_name: ${COMPOSE_PROJECT_NAME}-api
depends_on:
- db
- redis
@@ -91,7 +86,6 @@ services:
celery-worker:
image: ${API_IMAGE}
container_name: ${COMPOSE_PROJECT_NAME}-celery-worker
command:
- celery
- -A
@@ -117,7 +111,6 @@ services:
celery-beat:
image: ${API_IMAGE}
container_name: ${COMPOSE_PROJECT_NAME}-celery-beat
command:
- celery
- -A
@@ -141,7 +134,6 @@ services:
flower:
image: ${API_IMAGE}
container_name: ${COMPOSE_PROJECT_NAME}-flower
command:
- celery
- -A
@@ -164,7 +156,6 @@ services:
web:
image: ${WEB_IMAGE}
container_name: ${COMPOSE_PROJECT_NAME}-web
depends_on:
- api
environment: