|
|
@@ -1,94 +1,50 @@
|
|
|
-# ~/work/my_project_root/docker-compose.prod.yml (Production)
|
|
|
version: "3.8"
|
|
|
|
|
|
services:
|
|
|
# MongoDB Database Service
|
|
|
mongodb:
|
|
|
image: mongo:latest
|
|
|
- container_name: mongodb
|
|
|
+ container_name: oms-mongodb
|
|
|
+ ports:
|
|
|
+ - "27717:27017"
|
|
|
volumes:
|
|
|
- - mongodb_data:/data/db
|
|
|
- restart: always
|
|
|
-
|
|
|
- # Redis Cache Service
|
|
|
- redis:
|
|
|
- image: redis:latest
|
|
|
- container_name: redis
|
|
|
- restart: always
|
|
|
+ - /mnt/volume_sfo2_04/oms/mongodb:/data/db # 使用主机挂载卷用于生产环境
|
|
|
+ environment:
|
|
|
+ MONGO_INITDB_ROOT_USERNAME: oms
|
|
|
+ MONGO_INITDB_ROOT_PASSWORD: "oms123."
|
|
|
+ restart: "always"
|
|
|
+
|
|
|
+ # # Redis Cache Service
|
|
|
+ # redis:
|
|
|
+ # image: redis:latest
|
|
|
+ # container_name: oms-redis
|
|
|
+ # ports:
|
|
|
+ # - "6379:6379"
|
|
|
+ # restart: "always"
|
|
|
|
|
|
# RabbitMQ Message Broker
|
|
|
rabbitmq:
|
|
|
image: rabbitmq:3-management-alpine
|
|
|
- container_name: rabbitmq
|
|
|
+ container_name: oms-rabbitmq
|
|
|
+ ports:
|
|
|
+ - "5672:5672" # AMQP 端口
|
|
|
+ - "15672:15672" # 管理界面端口
|
|
|
environment:
|
|
|
RABBITMQ_DEFAULT_USER: coloring
|
|
|
RABBITMQ_DEFAULT_PASS: coloring123.
|
|
|
- restart: always
|
|
|
+ restart: "always"
|
|
|
|
|
|
# ClickHouse Columnar Database for Analytics
|
|
|
clickhouse:
|
|
|
image: clickhouse/clickhouse-server:latest
|
|
|
container_name: clickhouse
|
|
|
+ ports:
|
|
|
+ - "8123:8123" # HTTP 接口
|
|
|
+ # - "9000:9000" # 原生 TCP 接口
|
|
|
volumes:
|
|
|
- - clickhouse_data:/var/lib/clickhouse
|
|
|
+ - /mnt/volume_sfo2_04/oms/clickhouse:/var/lib/clickhouse # 使用主机挂载卷用于生产环境
|
|
|
environment:
|
|
|
CLICKHOUSE_DB: omsdb
|
|
|
CLICKHOUSE_USER: ckuser
|
|
|
CLICKHOUSE_PASSWORD: ckpassword
|
|
|
- restart: always
|
|
|
-
|
|
|
- # Backend Service (OMS)
|
|
|
- oms:
|
|
|
- build:
|
|
|
- context: ./oms
|
|
|
- dockerfile: Dockerfile
|
|
|
- container_name: oms
|
|
|
- ports:
|
|
|
- - "3000:3000"
|
|
|
- environment:
|
|
|
- NODE_ENV: production
|
|
|
- PORT: 3000
|
|
|
- MONGO_URI: mongodb://mongodb:27017/omsdb
|
|
|
- REDIS_URI: redis://redis:6379
|
|
|
- # !!! 生产环境请添加敏感环境变量 !!!
|
|
|
- # 生产环境不挂载代码,依赖 Dockerfile 复制
|
|
|
- # volumes:
|
|
|
- # - ./oms:/usr/src/app
|
|
|
- restart: always
|
|
|
- depends_on:
|
|
|
- - mongodb
|
|
|
- - redis
|
|
|
-
|
|
|
- # Data Ingestor Service (独立服务)
|
|
|
- data-ingestor:
|
|
|
- build:
|
|
|
- context: ./data-ingestor
|
|
|
- dockerfile: Dockerfile
|
|
|
- container_name: data-ingestor
|
|
|
- environment:
|
|
|
- RABBITMQ_URL: amqp://rabbitmq:5672
|
|
|
- RABBITMQ_QUEUE: user_events
|
|
|
- CLICKHOUSE_HOST: http://clickhouse:8123
|
|
|
- CLICKHOUSE_DATABASE: omsdb
|
|
|
- MONGODB_URI: mongodb://mongodb:27017/omsdb
|
|
|
- restart: always
|
|
|
- depends_on:
|
|
|
- - rabbitmq
|
|
|
- - clickhouse
|
|
|
- - mongodb
|
|
|
-
|
|
|
- # Frontend Nginx Service (OMSApp)
|
|
|
- omsapp-nginx:
|
|
|
- build:
|
|
|
- context: ./omsapp # *** 关键变更:构建上下文是 ./omsapp
|
|
|
- dockerfile: Dockerfile
|
|
|
- container_name: omsapp-nginx
|
|
|
- ports:
|
|
|
- - "80:80"
|
|
|
- restart: always
|
|
|
- depends_on:
|
|
|
- - oms
|
|
|
-
|
|
|
-volumes:
|
|
|
- mongodb_data:
|
|
|
- clickhouse_data:
|
|
|
+ restart: "always"
|