add: 本地开发 compose 编排、构建脚本与数据库初始化
This commit is contained in:
@@ -0,0 +1,306 @@
|
||||
services:
|
||||
# ==================== 基础设施 ====================
|
||||
postgres:
|
||||
image: postgres:17-bookworm
|
||||
container_name: juwan-postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: ${PD_USERNAME}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
POSTGRES_DB: ${DB_NAME}
|
||||
ports:
|
||||
- "15432:5432"
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
- ./init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro
|
||||
- ../../desc/sql:/docker-entrypoint-initdb.d/sql:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${PD_USERNAME} -d ${DB_NAME}"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
redis:
|
||||
image: redis:8-alpine
|
||||
container_name: juwan-redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "16379:6379"
|
||||
volumes:
|
||||
- redisdata:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
kafka:
|
||||
image: apache/kafka:4.0.1
|
||||
container_name: juwan-kafka
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
KAFKA_NODE_ID: 1
|
||||
KAFKA_PROCESS_ROLES: broker,controller
|
||||
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
|
||||
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
|
||||
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
|
||||
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
|
||||
CLUSTER_ID: juwan-dev-kafka-cluster-id
|
||||
ports:
|
||||
- "19092:9092"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "/opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server localhost:9092"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
# ==================== 共享服务 ====================
|
||||
snowflake:
|
||||
image: juwan/snowflake-rpc:dev
|
||||
container_name: juwan-snowflake
|
||||
restart: unless-stopped
|
||||
|
||||
# ==================== RPC 层 ====================
|
||||
user-rpc:
|
||||
image: juwan/users-rpc:dev
|
||||
container_name: juwan-user-rpc
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
snowflake:
|
||||
condition: service_started
|
||||
|
||||
user-verifications-rpc:
|
||||
image: juwan/user_verifications-rpc:dev
|
||||
container_name: juwan-user-verifications-rpc
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
snowflake:
|
||||
condition: service_started
|
||||
user-rpc:
|
||||
condition: service_started
|
||||
|
||||
player-rpc:
|
||||
image: juwan/player-rpc:dev
|
||||
container_name: juwan-player-rpc
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
snowflake:
|
||||
condition: service_started
|
||||
|
||||
game-rpc:
|
||||
image: juwan/game-rpc:dev
|
||||
container_name: juwan-game-rpc
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
snowflake:
|
||||
condition: service_started
|
||||
|
||||
shop-rpc:
|
||||
image: juwan/shop-rpc:dev
|
||||
container_name: juwan-shop-rpc
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
snowflake:
|
||||
condition: service_started
|
||||
user-rpc:
|
||||
condition: service_started
|
||||
|
||||
order-rpc:
|
||||
image: juwan/order-rpc:dev
|
||||
container_name: juwan-order-rpc
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
snowflake:
|
||||
condition: service_started
|
||||
|
||||
wallet-rpc:
|
||||
image: juwan/wallet-rpc:dev
|
||||
container_name: juwan-wallet-rpc
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
snowflake:
|
||||
condition: service_started
|
||||
|
||||
community-rpc:
|
||||
image: juwan/community-rpc:dev
|
||||
container_name: juwan-community-rpc
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
snowflake:
|
||||
condition: service_started
|
||||
|
||||
objectstory-rpc:
|
||||
image: juwan/objectstory-rpc:dev
|
||||
container_name: juwan-objectstory-rpc
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
|
||||
# ==================== API 层 ====================
|
||||
users-api:
|
||||
image: juwan/users-api:dev
|
||||
container_name: juwan-users-api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "18801:8888"
|
||||
depends_on:
|
||||
user-rpc:
|
||||
condition: service_started
|
||||
user-verifications-rpc:
|
||||
condition: service_started
|
||||
|
||||
player-api:
|
||||
image: juwan/player-api:dev
|
||||
container_name: juwan-player-api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "18802:8888"
|
||||
depends_on:
|
||||
player-rpc:
|
||||
condition: service_started
|
||||
|
||||
game-api:
|
||||
image: juwan/game-api:dev
|
||||
container_name: juwan-game-api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "18803:8888"
|
||||
depends_on:
|
||||
game-rpc:
|
||||
condition: service_started
|
||||
|
||||
shop-api:
|
||||
image: juwan/shop-api:dev
|
||||
container_name: juwan-shop-api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "18804:8888"
|
||||
depends_on:
|
||||
shop-rpc:
|
||||
condition: service_started
|
||||
|
||||
order-api:
|
||||
image: juwan/order-api:dev
|
||||
container_name: juwan-order-api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "18805:8888"
|
||||
depends_on:
|
||||
order-rpc:
|
||||
condition: service_started
|
||||
player-rpc:
|
||||
condition: service_started
|
||||
shop-rpc:
|
||||
condition: service_started
|
||||
|
||||
wallet-api:
|
||||
image: juwan/wallet-api:dev
|
||||
container_name: juwan-wallet-api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "18806:8888"
|
||||
depends_on:
|
||||
wallet-rpc:
|
||||
condition: service_started
|
||||
|
||||
community-api:
|
||||
image: juwan/community-api:dev
|
||||
container_name: juwan-community-api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "18807:8888"
|
||||
depends_on:
|
||||
community-rpc:
|
||||
condition: service_started
|
||||
user-rpc:
|
||||
condition: service_started
|
||||
|
||||
objectstory-api:
|
||||
image: juwan/objectstory-api:dev
|
||||
container_name: juwan-objectstory-api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "18808:8888"
|
||||
depends_on:
|
||||
objectstory-rpc:
|
||||
condition: service_started
|
||||
|
||||
email-api:
|
||||
image: juwan/email-api:dev
|
||||
container_name: juwan-email-api
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
ports:
|
||||
- "18809:8888"
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
kafka:
|
||||
condition: service_healthy
|
||||
|
||||
# ==================== MQ ====================
|
||||
email-mq:
|
||||
image: juwan/email-mq:dev
|
||||
container_name: juwan-email-mq
|
||||
restart: unless-stopped
|
||||
env_file: .env
|
||||
depends_on:
|
||||
kafka:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
name: juwan-pgdata
|
||||
redisdata:
|
||||
name: juwan-redisdata
|
||||
Reference in New Issue
Block a user