我尝试使用nginx来复制运行在docker swarm上的miscoservices,但是nginx不能复制。我使用docker stack deploy -c docker-compose.yml neo。我使用docker service scale neo_profile=3来复制服务配置文件。
docker-compose.yml
version: "3"
services:
frontend:
build: .
image: ${REGISTRY-127.0.0.1:5000}/hotel_app_frontend_single_node_memdb
entrypoint: frontend
ports:
- "8080:8080"
restart: always
profile:
build: .
image: ${REGISTRY-127.0.0.1:5000}/hotel_app_profile_single_node_memdb
entrypoint: profile
ports:
- "8081:8081"
restart: always
search:
build: .
image: ${REGISTRY-127.0.0.1:5000}/hotel_app_search_single_node_memdb
entrypoint: search
ports:
- "8082:8082"
restart: always
geo:
build: .
image: ${REGISTRY-127.0.0.1:5000}/hotel_app_geo_single_node_memdb
entrypoint: geo
ports:
- "8083:8083"
restart: always
rate:
build: .
image: ${REGISTRY-127.0.0.1:5000}/hotel_app_rate_single_node_memdb
entrypoint: rate
ports:
- "8084:8084"
restart: always
jaeger:
image: jaegertracing/all-in-one:latest
ports:
- "14269"
- "5778:5778"
- "14268:14268"
- "14267"
- "16686:16686"
- "5775:5775/udp"
- "6831:6831/udp"
- "6832:6832/udp"
restart: always
nginx:
image: nginx:1.20.0
ports:
- "8581:8581"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
nginx.conf
upstream profile_server {
server profile:8081;
}
server {
listen 8581 http2;
location / {
grpc_pass grpc://profile_server;
}
}
码头服务:
ID NAME MODE REPLICAS IMAGE PORTS
xzpuq5yg5y93 neo_frontend replicated 1/1 xxxx/hotel_app_frontend_single_node_memdb:latest *:8080->8080/tcp
uoygftsgih83 neo_geo replicated 1/1 xxxx/hotel_app_geo_single_node_memdb:latest *:8083->8083/tcp
kr8gf6e9jjtm neo_jaeger replicated 1/1 jaegertracing/all-in-one:latest *:5778->5778/tcp, *:14268->14268/tcp, *:16686->16686/tcp, *:30002->14269/tcp, *:30003->14267/tcp, *:5775->5775/udp, *:6831-6832->6831-6832/udp
uiswjuc9gh0e neo_nginx replicated 0/1 nginx:1.20.0 *:8581->8581/tcp
hgf13q8iu0ub neo_profile replicated 3/3 xxxx/hotel_app_profile_single_node_memdb:latest *:8081->8081/tcp
78jt97fcb55q neo_rate replicated 1/1 xxxx/hotel_app_rate_single_node_memdb:latest *:8084->8084/tcp
fnguxpzn4pfr neo_search replicated 1/1 xxxx/hotel_app_search_single_node_memdb:latest *:8082->8082/tcp
由于某种原因,nginx没有复制。
1条答案
按热度按时间pbgvytdp1#
将nginx配置部署为docker配置: