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_USERNAME=kibana_system
- ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD}
# - ELASTICSEARCH_SSL_VERIFICATIONMODE=none
# - ELASTICSEARCH_SSL_VERIFICATIONMODE=none
ports:
- "5601:5601"
depends_on:
@ -141,6 +141,15 @@ services:
- novel-mysql
networks:
- 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:
build: ./novel-gateway
@ -153,10 +162,20 @@ services:
ports:
- "8888:8888"
depends_on:
- novel-nacos-server
novel-nacos-server:
condition: service_healthy
networks:
- 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:
build: ./novel-home-service
image: novel-home-service:${NOVEL_CLOUD_VERSION}
@ -168,9 +187,19 @@ services:
ports:
- "9001:9001"
depends_on:
- novel-nacos-server
novel-nacos-server:
condition: service_healthy
networks:
- 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:
build: ./novel-news-service
@ -183,10 +212,20 @@ services:
ports:
- "9030:9030"
depends_on:
- novel-nacos-server
novel-nacos-server:
condition: service_healthy
networks:
- 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:
build: ./novel-book-service
image: novel-book-service:${NOVEL_CLOUD_VERSION}
@ -198,9 +237,19 @@ services:
ports:
- "9020:9020"
depends_on:
- novel-nacos-server
novel-nacos-server:
condition: service_healthy
networks:
- 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:
build: ./novel-user-service
@ -213,9 +262,19 @@ services:
ports:
- "9060:9060"
depends_on:
- novel-nacos-server
novel-nacos-server:
condition: service_healthy
networks:
- 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:
build: ./novel-search-service
@ -228,9 +287,19 @@ services:
ports:
- "9050:9050"
depends_on:
- novel-nacos-server
novel-nacos-server:
condition: service_healthy
networks:
- 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:
build: ./novel-resource-service
@ -243,9 +312,19 @@ services:
ports:
- "9040:9040"
depends_on:
- novel-nacos-server
novel-nacos-server:
condition: service_healthy
networks:
- 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:
build: ./novel-author-service
@ -258,9 +337,19 @@ services:
ports:
- "9010:9010"
depends_on:
- novel-nacos-server
novel-nacos-server:
condition: service_healthy
networks:
- 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:
build: ./novel-monitor
@ -273,14 +362,22 @@ services:
ports:
- "8898:8898"
depends_on:
- novel-gateway
- novel-home-service
- novel-author-service
- novel-book-service
- novel-search-service
- novel-user-service
- novel-resource-service
- novel-news-service
novel-gateway:
condition: service_healthy
novel-home-service:
condition: service_healthy
novel-author-service:
condition: service_healthy
novel-book-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:
- novelnet