chore: 优化容器编排

设置容器的健康检查
This commit is contained in:
xiongxiaoyang 2023-04-04 11:11:57 +08:00
parent 434062392c
commit 60de010723

View File

@ -86,7 +86,7 @@ services:
- ELASTICSEARCH_HOSTS=http://novel-elasticsearch:9200 - ELASTICSEARCH_HOSTS=http://novel-elasticsearch:9200
- ELASTICSEARCH_USERNAME=kibana_system - ELASTICSEARCH_USERNAME=kibana_system
- ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD} - ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD}
# - ELASTICSEARCH_SSL_VERIFICATIONMODE=none # - ELASTICSEARCH_SSL_VERIFICATIONMODE=none
ports: ports:
- "5601:5601" - "5601:5601"
depends_on: depends_on:
@ -141,6 +141,15 @@ services:
- novel-mysql - novel-mysql
networks: networks:
- novelnet - novelnet
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:8848 | grep -q 'HTTP/1.1 404'",
]
interval: 30s
timeout: 2s
retries: 120
novel-gateway: novel-gateway:
build: ./novel-gateway build: ./novel-gateway
@ -153,9 +162,19 @@ services:
ports: ports:
- "8888:8888" - "8888:8888"
depends_on: depends_on:
- novel-nacos-server novel-nacos-server:
condition: service_healthy
networks: networks:
- novelnet - novelnet
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:8888 | grep -q 'HTTP/1.1 404 Not Found'",
]
interval: 10s
timeout: 2s
retries: 120
novel-home-service: novel-home-service:
build: ./novel-home-service build: ./novel-home-service
@ -168,9 +187,19 @@ services:
ports: ports:
- "9001:9001" - "9001:9001"
depends_on: depends_on:
- novel-nacos-server novel-nacos-server:
condition: service_healthy
networks: networks:
- novelnet - novelnet
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:9001 | grep -q 'HTTP/1.1 404 Not Found'",
]
interval: 10s
timeout: 2s
retries: 120
novel-news-service: novel-news-service:
build: ./novel-news-service build: ./novel-news-service
@ -183,9 +212,19 @@ services:
ports: ports:
- "9030:9030" - "9030:9030"
depends_on: depends_on:
- novel-nacos-server novel-nacos-server:
condition: service_healthy
networks: networks:
- novelnet - novelnet
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:9030 | grep -q 'HTTP/1.1 404 Not Found'",
]
interval: 10s
timeout: 2s
retries: 120
novel-book-service: novel-book-service:
build: ./novel-book-service build: ./novel-book-service
@ -198,9 +237,19 @@ services:
ports: ports:
- "9020:9020" - "9020:9020"
depends_on: depends_on:
- novel-nacos-server novel-nacos-server:
condition: service_healthy
networks: networks:
- novelnet - novelnet
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:9020 | grep -q 'HTTP/1.1 404 Not Found'",
]
interval: 10s
timeout: 2s
retries: 120
novel-user-service: novel-user-service:
build: ./novel-user-service build: ./novel-user-service
@ -213,9 +262,19 @@ services:
ports: ports:
- "9060:9060" - "9060:9060"
depends_on: depends_on:
- novel-nacos-server novel-nacos-server:
condition: service_healthy
networks: networks:
- novelnet - novelnet
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:9060 | grep -q 'HTTP/1.1 404 Not Found'",
]
interval: 10s
timeout: 2s
retries: 120
novel-search-service: novel-search-service:
build: ./novel-search-service build: ./novel-search-service
@ -228,9 +287,19 @@ services:
ports: ports:
- "9050:9050" - "9050:9050"
depends_on: depends_on:
- novel-nacos-server novel-nacos-server:
condition: service_healthy
networks: networks:
- novelnet - novelnet
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:9050 | grep -q 'HTTP/1.1 404 Not Found'",
]
interval: 10s
timeout: 2s
retries: 120
novel-resource-service: novel-resource-service:
build: ./novel-resource-service build: ./novel-resource-service
@ -243,9 +312,19 @@ services:
ports: ports:
- "9040:9040" - "9040:9040"
depends_on: depends_on:
- novel-nacos-server novel-nacos-server:
condition: service_healthy
networks: networks:
- novelnet - novelnet
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:9040 | grep -q 'HTTP/1.1 404 Not Found'",
]
interval: 10s
timeout: 2s
retries: 120
novel-author-service: novel-author-service:
build: ./novel-author-service build: ./novel-author-service
@ -258,9 +337,19 @@ services:
ports: ports:
- "9010:9010" - "9010:9010"
depends_on: depends_on:
- novel-nacos-server novel-nacos-server:
condition: service_healthy
networks: networks:
- novelnet - novelnet
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:9010 | grep -q 'HTTP/1.1 404 Not Found'",
]
interval: 10s
timeout: 2s
retries: 120
novel-monitor: novel-monitor:
build: ./novel-monitor build: ./novel-monitor
@ -273,14 +362,22 @@ services:
ports: ports:
- "8898:8898" - "8898:8898"
depends_on: depends_on:
- novel-gateway novel-gateway:
- novel-home-service condition: service_healthy
- novel-author-service novel-home-service:
- novel-book-service condition: service_healthy
- novel-search-service novel-author-service:
- novel-user-service condition: service_healthy
- novel-resource-service novel-book-service:
- novel-news-service condition: service_healthy
novel-search-service:
condition: service_healthy
novel-user-service:
condition: service_healthy
novel-resource-service:
condition: service_healthy
novel-news-service:
condition: service_healthy
networks: networks:
- novelnet - novelnet