refactor(consul): 更新服务配置和docker-compose设置

- 修改data-service的consul检查端口为8000
- 将whoami服务的traefik配置从tags迁移到meta
- 简化docker-compose.yml,注释掉未使用的服务
This commit is contained in:
fanfpy 2025-06-30 18:16:57 +08:00
parent caef728619
commit 470d69d073
3 changed files with 76 additions and 77 deletions

View File

@ -2,7 +2,7 @@
"service": { "service": {
"address": "data-service", "address": "data-service",
"check": { "check": {
"http": "http://aktools:8080/api/public/stock_bid_ask_em?symbol=000001", "http": "http://aktools:8000/api/public/stock_bid_ask_em?symbol=000001",
"interval": "10s", "interval": "10s",
"timeout": "5s" "timeout": "5s"
}, },

View File

@ -2,7 +2,11 @@
"service": { "service": {
"name": "whoami", "name": "whoami",
"port": 80, "port": 80,
"tags": ["traefik.enable=true", "traefik.http.routers.whoami.rule=Host(`whoami.localhost`)", "traefik.http.routers.whoami.entrypoints=web"], "meta": {
"traefik_enable": "true",
"traefik_http_routers_whoami_rule": "PathPrefix(`/whoami`)",
"traefik_http_routers_whoami_entrypoints": "web"
},
"check": { "check": {
"http": "http://whoami:80", "http": "http://whoami:80",
"interval": "10s" "interval": "10s"

View File

@ -38,90 +38,85 @@ services:
build: ./services/data-service build: ./services/data-service
container_name: ari-data-service container_name: ari-data-service
restart: always restart: always
depends_on: ports:
consul: - "8000:8000" # Traefik dashboard
condition: service_healthy
expose:
- "8000"
networks: networks:
- microservice-network - microservice-network
environment: environment:
- SERVICE_NAME=data-service - SERVICE_NAME=data-service
quant-service: # quant-service:
build: ./services/quant-service # build: ./services/quant-service
container_name: ari-quant-service # container_name: ari-quant-service
restart: always # restart: always
depends_on: # depends_on:
consul: # consul:
condition: service_healthy # condition: service_healthy
expose: # expose:
- "8001" # - "8001"
networks: # networks:
- microservice-network # - microservice-network
environment: # environment:
- SERVICE_NAME=quant-service # - SERVICE_NAME=quant-service
emotion-service: # emotion-service:
build: ./services/emotion-service # build: ./services/emotion-service
container_name: ari-emotion-service # container_name: ari-emotion-service
restart: always # restart: always
depends_on: # depends_on:
consul: # consul:
condition: service_healthy # condition: service_healthy
expose: # expose:
- "8002" # - "8002"
networks: # networks:
- microservice-network # - microservice-network
environment: # environment:
- SERVICE_NAME=emotion-service # - SERVICE_NAME=emotion-service
recommend-service: # recommend-service:
build: ./services/recommend-service # build: ./services/recommend-service
container_name: ari-recommend-service # container_name: ari-recommend-service
restart: always # restart: always
depends_on: # depends_on:
consul: # consul:
condition: service_healthy # condition: service_healthy
expose: # expose:
- "8003" # - "8003"
networks: # networks:
- microservice-network # - microservice-network
environment: # environment:
- SERVICE_NAME=recommend-service # - SERVICE_NAME=recommend-service
user-service: # user-service:
build: ./services/user-service # build: ./services/user-service
container_name: ari-user-service # container_name: ari-user-service
restart: always # restart: always
depends_on: # depends_on:
consul: # consul:
condition: service_healthy # condition: service_healthy
expose: # expose:
- "8004" # - "8004"
networks: # networks:
- microservice-network # - microservice-network
environment: # environment:
- SERVICE_NAME=user-service # - SERVICE_NAME=user-service
frontend: # frontend:
build: ./services/frontend # build: ./services/frontend
container_name: ari-frontend # container_name: ari-frontend
restart: always # restart: always
depends_on: # depends_on:
- data-service # - data-service
- quant-service # - quant-service
- emotion-service # - emotion-service
- recommend-service # - recommend-service
- user-service # - user-service
expose: # expose:
- "80" # - "80"
networks: # networks:
- microservice-network # - microservice-network
environment: # environment:
- SERVICE_NAME=frontend # - SERVICE_NAME=frontend
whoami: whoami:
image: traefik/whoami image: traefik/whoami
expose:
- "80" # 可选Traefik 可以自动发现,不暴露到宿主机