hyapp-server/docker-compose.yml
2026-07-16 18:51:58 +08:00

404 lines
12 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

x-go-build-args: &go-build-args
GOPROXY: "${GOPROXY:-https://goproxy.cn|https://proxy.golang.org|direct}"
GOSUMDB: "${GOSUMDB:-sum.golang.org}"
services:
rocketmq-namesrv:
image: apache/rocketmq:5.3.1
container_name: rocketmq-namesrv
environment:
TZ: UTC
JAVA_OPT_EXT: "-Xms256m -Xmx256m -Xmn128m"
command: ["sh", "mqnamesrv"]
ports:
- "19876:9876"
rocketmq-broker:
image: apache/rocketmq:5.3.1
container_name: rocketmq-broker
user: root
environment:
TZ: UTC
NAMESRV_ADDR: "rocketmq-namesrv:9876"
JAVA_OPT_EXT: "-Xms512m -Xmx512m -Xmn256m"
command: ["sh", "mqbroker", "-n", "rocketmq-namesrv:9876", "-c", "/home/rocketmq/broker.conf"]
ports:
- "19009:10909"
- "10911:10911"
- "19011:10911"
volumes:
- ${ROCKETMQ_BROKER_CONFIG:-./deploy/rocketmq/broker.local.conf}:/home/rocketmq/broker.conf:ro
- rocketmq-store:/home/rocketmq/store
depends_on:
- rocketmq-namesrv
gateway-service:
build:
context: .
dockerfile: services/gateway-service/Dockerfile
args: *go-build-args
container_name: gateway-service
environment:
TZ: UTC
ports:
- "13000:13000"
depends_on:
room-service:
condition: service_healthy
user-service:
condition: service_healthy
game-service:
condition: service_healthy
lucky-gift-service:
condition: service_healthy
redis:
condition: service_healthy
rocketmq-broker:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13000/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
room-service:
build:
context: .
dockerfile: services/room-service/Dockerfile
args: *go-build-args
container_name: room-service
environment:
TZ: UTC
ports:
- "13001:13001"
- "13101:13101"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
wallet-service:
condition: service_healthy
rocketmq-broker:
condition: service_started
lucky-gift-service:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13101/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
wallet-service:
build:
context: .
dockerfile: services/wallet-service/Dockerfile
args: *go-build-args
container_name: wallet-service
environment:
TZ: UTC
ports:
- "13004:13004"
- "13104:13104"
depends_on:
mysql:
condition: service_healthy
rocketmq-broker:
condition: service_started
user-service:
condition: service_healthy
activity-service:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13104/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
user-service:
build:
context: .
dockerfile: services/user-service/Dockerfile
args: *go-build-args
container_name: user-service
environment:
TZ: UTC
ports:
- "13005:13005"
- "13105:13105"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
rocketmq-broker:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13105/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
activity-service:
build:
context: .
dockerfile: services/activity-service/Dockerfile
args: *go-build-args
container_name: activity-service
environment:
TZ: UTC
ports:
- "13006:13006"
- "13106:13106"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
rocketmq-broker:
condition: service_started
user-service:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13106/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
lucky-gift-service:
build:
context: .
dockerfile: services/lucky-gift-service/Dockerfile
args: *go-build-args
container_name: lucky-gift-service
environment:
TZ: UTC
ports:
- "13013:13013"
- "13113:13113"
depends_on:
mysql:
condition: service_healthy
wallet-service:
condition: service_healthy
rocketmq-broker:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13113/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
luck-gateway:
build:
context: .
dockerfile: server/luck-gateway/Dockerfile
args: *go-build-args
container_name: luck-gateway
environment:
TZ: UTC
LUCKY_GIFT_GRPC_ADDR: "lucky-gift-service:13013"
LUCK_GATEWAY_ALLOWED_APPS: "aslan,yumi"
ports:
- "13014:13014"
depends_on:
lucky-gift-service:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13014/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
cron-service:
build:
context: .
dockerfile: services/cron-service/Dockerfile
args: *go-build-args
container_name: cron-service
environment:
TZ: UTC
ports:
- "13007:13007"
- "13107:13107"
depends_on:
mysql:
condition: service_healthy
user-service:
condition: service_healthy
activity-service:
condition: service_healthy
rocketmq-broker:
condition: service_started
game-service:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13107/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
robot-service:
build:
context: .
dockerfile: services/robot-service/Dockerfile
args: *go-build-args
container_name: robot-service
environment:
TZ: UTC
ports:
- "13011:13011"
- "13111:13111"
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13111/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
game-service:
build:
context: .
dockerfile: services/game-service/Dockerfile
args: *go-build-args
container_name: game-service
environment:
TZ: UTC
ports:
- "13008:13008"
- "13108:13108"
depends_on:
mysql:
condition: service_healthy
rocketmq-broker:
condition: service_started
wallet-service:
condition: service_healthy
user-service:
condition: service_healthy
activity-service:
condition: service_healthy
robot-service:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13108/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
notice-service:
build:
context: .
dockerfile: services/notice-service/Dockerfile
args: *go-build-args
container_name: notice-service
environment:
TZ: UTC
ports:
- "13009:13009"
- "13109:13109"
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13109/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
statistics-service:
build:
context: .
dockerfile: services/statistics-service/Dockerfile
args: *go-build-args
container_name: statistics-service
environment:
TZ: UTC
ports:
- "13010:13010"
- "13110:13110"
depends_on:
mysql:
condition: service_healthy
rocketmq-broker:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:13110/healthz/ready >/dev/null"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
mysql:
image: mysql:8.4
container_name: hyapp-mysql
command:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
- "--default-time-zone=+00:00"
environment:
TZ: UTC
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: hyapp_room
MYSQL_USER: hyapp
MYSQL_PASSWORD: hyapp
ports:
- "23306:3306"
volumes:
- mysql-data:/var/lib/mysql
- ./services/room-service/deploy/mysql/initdb/001_room_service.sql:/docker-entrypoint-initdb.d/001_room_service.sql:ro
- ./services/user-service/deploy/mysql/initdb/001_user_service.sql:/docker-entrypoint-initdb.d/002_user_service.sql:ro
- ./services/wallet-service/deploy/mysql/initdb/001_wallet_service.sql:/docker-entrypoint-initdb.d/003_wallet_service.sql:ro
- ./services/activity-service/deploy/mysql/initdb/001_activity_service.sql:/docker-entrypoint-initdb.d/004_activity_service.sql:ro
- ./tmp/mysql/initdb/005_utf8mb4_chinese_support.sql:/docker-entrypoint-initdb.d/005_utf8mb4_chinese_support.sql:ro
- ./tmp/mysql/initdb/006_admin_database.sql:/docker-entrypoint-initdb.d/006_admin_database.sql:ro
- ./tmp/mysql/initdb/007_resource_group_wallet_asset_items.sql:/docker-entrypoint-initdb.d/007_resource_group_wallet_asset_items.sql:ro
- ./services/lucky-gift-service/deploy/mysql/initdb/001_lucky_gift_service.sql:/docker-entrypoint-initdb.d/008_lucky_gift_service.sql:ro
- ./services/cron-service/deploy/mysql/initdb/001_cron_service.sql:/docker-entrypoint-initdb.d/009_cron_service.sql:ro
- ./services/game-service/deploy/mysql/initdb/001_game_service.sql:/docker-entrypoint-initdb.d/010_game_service.sql:ro
- ./services/game-service/deploy/mysql/initdata/001_self_games.sql:/docker-entrypoint-initdb.d/010_game_service_data.sql:ro
- ./services/robot-service/deploy/mysql/initdb/001_robot_service.sql:/docker-entrypoint-initdb.d/011_robot_service.sql:ro
- ./services/notice-service/deploy/mysql/initdb/001_notice_service.sql:/docker-entrypoint-initdb.d/011_notice_service.sql:ro
- ./services/statistics-service/deploy/mysql/initdb/001_statistics_service.sql:/docker-entrypoint-initdb.d/012_statistics_service.sql:ro
- ./tmp/mysql/initdb/999_local_grants.sql:/docker-entrypoint-initdb.d/999_local_grants.sql:ro
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -uroot -proot --silent"]
interval: 5s
timeout: 3s
retries: 30
redis:
image: redis:7.4-alpine
container_name: hyapp-redis
# Session denylist 不能被内存淘汰AOF + volume 保证正常重启时先恢复撤销事实再接受连接。
command: ["redis-server", "--appendonly", "yes", "--appendfsync", "everysec", "--maxmemory-policy", "noeviction"]
environment:
TZ: UTC
ports:
- "13379:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 30
volumes:
mysql-data:
redis-data:
rocketmq-store: