From 84a9b23676cb373e50ca7194a769332ec3970886 Mon Sep 17 00:00:00 2001 From: traveler Date: Fri, 13 Feb 2026 08:09:09 -0600 Subject: [PATCH] consul --- swarm/consul.yaml | 72 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 swarm/consul.yaml diff --git a/swarm/consul.yaml b/swarm/consul.yaml new file mode 100644 index 0000000..70aa5d5 --- /dev/null +++ b/swarm/consul.yaml @@ -0,0 +1,72 @@ + +networks: + netgrimoire: + external: true + +services: + consul-server: + image: consul:latest + hostname: "consul-{{.Task.Slot}}" + command: > + agent -server + -bootstrap-expect=3 + -ui + -client=0.0.0.0 + -bind='{{ GetInterfaceIP "eth0" }}' + -retry-join=tasks.consul-server + -datacenter=netgrimoire + ports: + - target: 8500 + published: 8500 + protocol: tcp + mode: host + - target: 8600 + published: 8600 + protocol: udp + mode: host + - target: 8600 + published: 8600 + protocol: tcp + mode: host + networks: + - netgrimoire + volumes: + - consul-data:/consul/data + deploy: + mode: replicated + replicas: 3 # Changed from 1 to 3 + placement: + constraints: + - node.role == manager + max_replicas_per_node: 1 + restart_policy: + condition: any + delay: 5s + max_attempts: 3 + window: 120s + update_config: + parallelism: 1 + delay: 30s + + registrator: + image: gliderlabs/registrator:latest + command: > + -internal + -retry-attempts=10 + -retry-interval=2000 + consul://tasks.consul-server:8500 + volumes: + - /var/run/docker.sock:/tmp/docker.sock + networks: + - netgrimoire + depends_on: + - consul-server + deploy: + mode: global # Runs on ALL 6 nodes + restart_policy: + condition: any + delay: 5s + +volumes: + consul-data: + driver: local \ No newline at end of file