hyapp-server/docker-compose.yml
2026-05-02 13:02:38 +08:00

137 lines
4.0 KiB
YAML

services:
gateway-service:
build:
context: .
dockerfile: services/gateway-service/Dockerfile
container_name: gateway-service
ports:
- "13000:13000"
depends_on:
room-service:
condition: service_healthy
user-service:
condition: service_healthy
redis:
condition: service_healthy
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
container_name: room-service
ports:
- "13001:13001"
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
wallet-service:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "/app/grpc-health-probe -addr=127.0.0.1:13001 -service=room-service"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
wallet-service:
build:
context: .
dockerfile: services/wallet-service/Dockerfile
container_name: wallet-service
ports:
- "13004:13004"
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "/app/grpc-health-probe -addr=127.0.0.1:13004 -service=wallet-service"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
user-service:
build:
context: .
dockerfile: services/user-service/Dockerfile
container_name: user-service
ports:
- "13005:13005"
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "/app/grpc-health-probe -addr=127.0.0.1:13005 -service=user-service"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
activity-service:
build:
context: .
dockerfile: services/activity-service/Dockerfile
container_name: activity-service
ports:
- "13006:13006"
depends_on:
mysql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "/app/grpc-health-probe -addr=127.0.0.1:13006 -service=activity-service"]
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"
environment:
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
- ./deploy/mysql/initdb/005_utf8mb4_chinese_support.sql:/docker-entrypoint-initdb.d/005_utf8mb4_chinese_support.sql:ro
- ./deploy/mysql/initdb/006_admin_database.sql:/docker-entrypoint-initdb.d/006_admin_database.sql:ro
- ./deploy/mysql/initdb/007_resource_group_wallet_asset_items.sql:/docker-entrypoint-initdb.d/007_resource_group_wallet_asset_items.sql:ro
- ./deploy/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
ports:
- "13379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 30
volumes:
mysql-data: