docker swarm

This commit is contained in:
marsal
2024-06-05 13:13:44 +08:00
parent d6dca2b585
commit 70f90c1d03
8912 changed files with 1269849 additions and 560260 deletions

View File

@ -0,0 +1,38 @@
version: '3.8'
networks:
default:
name: ${NAMESPACE}
external: true
services:
server:
hostname: ${NAMESPACE}_nacos_server
image: nacos/nacos-server:${NACOS_VERSION}
environment:
- PREFER_HOST_MODE=hostname
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
- MODE=standalone
- NACOS_AUTH_ENABLE=true
- NACOS_AUTH_IDENTITY_KEY=bndmsdsad
- NACOS_AUTH_IDENTITY_VALUE=wepqweq#dasld
- NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456587012345678901234567890123456789
ports:
- target: 8848
published: ${NODE_PORT}
protocol: tcp
mode: host # 解析默认是ingress就是通过swarm的负载均衡模式无论通过集群节点的映射端口都能访问到业务容器此种方式类似于k8s的NodePort的svc服务暴露方式而host则属于业务容器运行在哪个节点则就通过节点地址+映射端口访问对应的业务容器。
- target: 9848
published: ${NODE_PORT_2}
protocol: tcp
mode: host
volumes:
- data_server:/home/nacos/
deploy:
update_config:
order: stop-first
placement:
constraints:
- node.labels.${NAMESPACE}_nacos_server==1
volumes:
data_server:
driver: local