AriStockAI/docker-compose.yml
fanfpy a44ac35f39 feat(traefik): 添加HTTPS支持并更新服务路由配置
- 在traefik配置中添加TLS证书支持
- 开放443端口用于HTTPS通信
- 更新各微服务的路由规则,使用PathPrefix代替Host匹配
- 为API路由添加路径前缀剥离中间件
- 添加SSL证书文件到项目
2025-07-17 09:56:02 +08:00

131 lines
2.9 KiB
YAML

version: '3.8'
networks:
microservice-network:
driver: bridge
services:
consul:
image: consul:1.15
container_name: ari-consul
restart: always
ports:
- "8500:8500" # Consul Web UI
- "8600:8600/udp" # DNS服务
volumes:
- ./consul/config/${ENV_CONFIG_DIR}:/consul/config
command: "consul agent ${CONSUL_DEV_MODE} -config-dir=/consul/config -client=0.0.0.0"
networks:
- microservice-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8500/v1/status/leader"]
interval: 10s
timeout: 5s
retries: 3
traefik:
image: traefik:v2.11
container_name: ari-traefik
command:
- --configFile=/etc/traefik/traefik.yml
ports:
- "80:80"
- "443:443"
- "8080:8080" # Traefik dashboard
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik/config/${TRAEFIK_CONFIG_DIR}/traefik.yml:/etc/traefik/traefik.yml
- ./traefik/certs:/etc/traefik/certs
networks:
- microservice-network
data-service:
build: ./services/data-service
container_name: ari-data-service
restart: always
ports:
- "8000:8000"
networks:
- microservice-network
environment:
- SERVICE_NAME=data-service
quant-service:
build: ./services/quant-service
container_name: ari-quant-service
restart: always
depends_on:
consul:
condition: service_healthy
expose:
- "8001"
networks:
- microservice-network
environment:
- SERVICE_NAME=quant-service
emotion-service:
build: ./services/emotion-service
container_name: ari-emotion-service
restart: always
depends_on:
consul:
condition: service_healthy
expose:
- "8002"
networks:
- microservice-network
environment:
- SERVICE_NAME=emotion-service
# recommend-service:
# build: ./services/recommend-service
# container_name: ari-recommend-service
# restart: always
# depends_on:
# consul:
# condition: service_healthy
# expose:
# - "8003"
# networks:
# - microservice-network
# environment:
# - SERVICE_NAME=recommend-service
# user-service:
# build: ./services/user-service
# container_name: ari-user-service
# restart: always
# depends_on:
# consul:
# condition: service_healthy
# expose:
# - "8004"
# networks:
# - microservice-network
# environment:
# - SERVICE_NAME=user-service
frontend:
build: ./services/frontend
container_name: ari-frontend
restart: always
depends_on:
- data-service
- quant-service
- emotion-service
# - recommend-service
# - user-service
expose:
- "80"
networks:
- microservice-network
environment:
- SERVICE_NAME=frontend
whoami:
image: traefik/whoami
container_name: whoami
networks:
- microservice-network