Files
baiyue-firstleg/deploy/docker-compose.rocketmq.yml
T

64 lines
2.6 KiB
YAML

name: firstleg-${DEPLOY_ENV:-test}-rocketmq
x-bounded-logging: &bounded-logging
driver: ${DOCKER_LOG_DRIVER:-json-file}
options:
max-size: ${DOCKER_LOG_MAX_SIZE:-50m}
max-file: "${DOCKER_LOG_MAX_FILE:-3}"
services:
rocketmq-namesrv:
image: apache/rocketmq:5.3.1
restart: unless-stopped
command: sh mqnamesrv
logging: *bounded-logging
networks: [infra-network]
rocketmq-broker:
image: apache/rocketmq:5.3.1
restart: unless-stopped
depends_on: [rocketmq-namesrv]
environment:
ROCKETMQ_BROKER_IP: ${ROCKETMQ_BROKER_IP:?ROCKETMQ_BROKER_IP is required}
volumes:
- ./rocketmq:/config:ro
- ${ROCKETMQ_DATA_DIR:-/data/firstleg/rocketmq/store}:/home/rocketmq/store
command: sh /config/render-broker-config.sh
logging: *bounded-logging
networks: [infra-network]
rocketmq-topic-init:
image: apache/rocketmq:5.3.1
depends_on: [rocketmq-broker]
environment:
# 必须与 File Service 完全一致;允许生产环境显式传入空字符串。
MQ_TOPIC_PREFIX: ${MQ_TOPIC_PREFIX?MQ_TOPIC_PREFIX must be set; use test- for test and an empty value for production}
command: >-
sh -eu -c 'until sh mqadmin clusterList -n rocketmq-namesrv:9876 2>/dev/null
| grep -q "BaiyueCluster"; do sleep 2; done;
sh mqadmin updateTopic -n rocketmq-namesrv:9876 -c BaiyueCluster
-t "$${MQ_TOPIC_PREFIX}baiyue-file-export-command-v1" -r 4 -w 4;
sh mqadmin updateSubGroup -n rocketmq-namesrv:9876 -c BaiyueCluster
-g "$${MQ_TOPIC_PREFIX}baiyue-file-export-worker-v1";
sh mqadmin updateSubGroup -n rocketmq-namesrv:9876 -c BaiyueCluster
-g "$${MQ_TOPIC_PREFIX}baiyue-file-export-dlq-handler-v1";
sh mqadmin updateTopic -n rocketmq-namesrv:9876 -c BaiyueCluster
-t "%DLQ%$${MQ_TOPIC_PREFIX}baiyue-file-export-worker-v1" -r 1 -w 1 -p 6;
sh mqadmin updateTopic -n rocketmq-namesrv:9876 -c BaiyueCluster
-t "$${MQ_TOPIC_PREFIX}baiyue-audit-event-v1" -r 4 -w 4;
sh mqadmin updateSubGroup -n rocketmq-namesrv:9876 -c BaiyueCluster
-g "$${MQ_TOPIC_PREFIX}baiyue-audit-consumer-v1";
sh mqadmin updateSubGroup -n rocketmq-namesrv:9876 -c BaiyueCluster
-g "$${MQ_TOPIC_PREFIX}baiyue-audit-dlq-handler-v1";
sh mqadmin updateTopic -n rocketmq-namesrv:9876 -c BaiyueCluster
-t "%DLQ%$${MQ_TOPIC_PREFIX}baiyue-audit-consumer-v1" -r 1 -w 1 -p 6'
# Broker 注册较慢或任一初始化命令失败时整组重试;所有命令均幂等。
restart: on-failure
logging: *bounded-logging
networks: [infra-network]
networks:
infra-network:
external: true
name: ${INFRA_NETWORK:-firstleg-test-infra-network}