rwadurian/backend/services/docker-compose.2.0.yml

211 lines
7.2 KiB
YAML

# =============================================================================
# RWA Mining Ecosystem 2.0 - Docker Compose
# =============================================================================
#
# 2.0 系统完全独立于 1.0,可随时重置
#
# Usage:
# docker-compose -f docker-compose.2.0.yml up -d # 启动所有 2.0 服务
# docker-compose -f docker-compose.2.0.yml down # 停止所有 2.0 服务
# docker-compose -f docker-compose.2.0.yml up -d mining-admin # 启动单个服务
# docker-compose -f docker-compose.2.0.yml logs -f # 查看日志
#
# =============================================================================
services:
# ===========================================================================
# Backend Services (2.0)
# ===========================================================================
contribution-service:
build:
context: ./contribution-service
dockerfile: Dockerfile
container_name: rwa-contribution-service
environment:
NODE_ENV: production
TZ: Asia/Shanghai
PORT: 3020
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@${POSTGRES_HOST:-host.docker.internal}:${POSTGRES_PORT:-5432}/rwa_contribution?schema=public
REDIS_HOST: ${REDIS_HOST:-host.docker.internal}
REDIS_PORT: ${REDIS_PORT:-6379}
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
KAFKA_BROKERS: ${KAFKA_BROKERS:-host.docker.internal:9092}
CDC_TOPIC_ADOPTIONS: ${CDC_TOPIC_ADOPTIONS:-dbserver1.public.adoptions}
CDC_TOPIC_PAYMENTS: ${CDC_TOPIC_PAYMENTS:-dbserver1.public.payment_records}
CDC_CONSUMER_GROUP: contribution-service-cdc-group
ports:
- "3020:3020"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3020/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
networks:
- rwa-2.0-network
mining-service:
build:
context: ./mining-service
dockerfile: Dockerfile
container_name: rwa-mining-service
depends_on:
contribution-service:
condition: service_healthy
environment:
NODE_ENV: production
TZ: Asia/Shanghai
PORT: 3021
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@${POSTGRES_HOST:-host.docker.internal}:${POSTGRES_PORT:-5432}/rwa_mining?schema=public
REDIS_HOST: ${REDIS_HOST:-host.docker.internal}
REDIS_PORT: ${REDIS_PORT:-6379}
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
KAFKA_BROKERS: ${KAFKA_BROKERS:-host.docker.internal:9092}
ports:
- "3021:3021"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3021/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
networks:
- rwa-2.0-network
trading-service:
build:
context: ./trading-service
dockerfile: Dockerfile
container_name: rwa-trading-service
depends_on:
mining-service:
condition: service_healthy
environment:
NODE_ENV: production
TZ: Asia/Shanghai
PORT: 3022
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@${POSTGRES_HOST:-host.docker.internal}:${POSTGRES_PORT:-5432}/rwa_trading?schema=public
REDIS_HOST: ${REDIS_HOST:-host.docker.internal}
REDIS_PORT: ${REDIS_PORT:-6379}
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
KAFKA_BROKERS: ${KAFKA_BROKERS:-host.docker.internal:9092}
MINING_SERVICE_URL: http://mining-service:3021
ports:
- "3022:3022"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3022/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
networks:
- rwa-2.0-network
mining-admin-service:
build:
context: ./mining-admin-service
dockerfile: Dockerfile
container_name: rwa-mining-admin-service
depends_on:
contribution-service:
condition: service_healthy
mining-service:
condition: service_healthy
environment:
NODE_ENV: production
TZ: Asia/Shanghai
PORT: 3023
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@${POSTGRES_HOST:-host.docker.internal}:${POSTGRES_PORT:-5432}/rwa_mining_admin?schema=public
REDIS_HOST: ${REDIS_HOST:-host.docker.internal}
REDIS_PORT: ${REDIS_PORT:-6379}
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
CONTRIBUTION_SERVICE_URL: http://contribution-service:3020
MINING_SERVICE_URL: http://mining-service:3021
TRADING_SERVICE_URL: http://trading-service:3022
JWT_SECRET: ${ADMIN_JWT_SECRET:-your-admin-jwt-secret-change-in-production}
ports:
- "3023:3023"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3023/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
networks:
- rwa-2.0-network
auth-service:
build:
context: ./auth-service
dockerfile: Dockerfile
container_name: rwa-auth-service
environment:
NODE_ENV: production
TZ: Asia/Shanghai
PORT: 3024
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@${POSTGRES_HOST:-host.docker.internal}:${POSTGRES_PORT:-5432}/rwa_auth?schema=public
REDIS_HOST: ${REDIS_HOST:-host.docker.internal}
REDIS_PORT: ${REDIS_PORT:-6379}
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
KAFKA_BROKERS: ${KAFKA_BROKERS:-host.docker.internal:9092}
CDC_TOPIC_USERS: ${CDC_TOPIC_USERS:-dbserver1.public.users}
CDC_CONSUMER_GROUP: auth-service-cdc-group
JWT_SECRET: ${JWT_SECRET:-your-jwt-secret-change-in-production}
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-7d}
JWT_REFRESH_EXPIRES_IN: ${JWT_REFRESH_EXPIRES_IN:-30d}
SMS_ACCESS_KEY_ID: ${SMS_ACCESS_KEY_ID:-}
SMS_ACCESS_KEY_SECRET: ${SMS_ACCESS_KEY_SECRET:-}
SMS_SIGN_NAME: ${SMS_SIGN_NAME:-榴莲生态}
SMS_TEMPLATE_CODE: ${SMS_TEMPLATE_CODE:-}
ports:
- "3024:3024"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3024/api/v2/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
networks:
- rwa-2.0-network
# ===========================================================================
# Frontend Services (2.0)
# ===========================================================================
mining-admin-web:
build:
context: ../../frontend/mining-admin-web
dockerfile: Dockerfile
container_name: rwa-mining-admin-web
depends_on:
mining-admin-service:
condition: service_healthy
environment:
NODE_ENV: production
TZ: Asia/Shanghai
PORT: 3100
NEXT_PUBLIC_API_URL: http://mining-admin-service:3023
NEXT_PUBLIC_APP_NAME: 挖矿管理后台
ports:
- "3100:3100"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3100/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
restart: unless-stopped
networks:
- rwa-2.0-network
networks:
rwa-2.0-network:
driver: bridge
name: rwa-2.0-network