After many weeks of frustration, digging, poking around I have finally found a configuration that works in the following scenario:
- Docker (Swarm Mode)
- Deployed as a service with
docker stack deploy
There are some known issues with Load Balancers with Drone server<->agent communications
and this apparently also includes Docker’s Overlay networking; but I suspect this has more to do with VIPs.
This is my working configuration:
version: "3.3" services: drone-server: image: drone/drone:latest ports: - target: 9000 published: 9000 protocol: tcp mode: host environment: - DRONE_DEBUG=true - DRONE_OPEN=true - DRONE_HOST=https://ci.mydomain.com - DRONE_GOGS=true - DRONE_GOGS_PRIVATE_MODE=true - DRONE_GOGS_URL=https://git.mydomain.com - DRONE_SECRET=XXXX - DRONE_ADMIN=admin networks: - traefik volumes: - dronedata:/var/lib/drone deploy: placement: constraints: - "node.hostname == node1.mydomain.com" endpoint_mode: dnsrr labels: - "traefik.enable=true" - "traefik.port=8000" - "traefik.backend=ci" - "traefik.docker.network=traefik" - "traefik.frontend.rule=Host:ci.mydomain.com" restart_policy: condition: on-failure replicas: 1 drone-agent: image: drone/agent:latest command: agent networks: - bridge volumes: - /var/run/docker.sock:/var/run/docker.sock environment: - DRONE_DEBUG=true - DRONE_SERVER=10.0.0.10:9000 - DRONE_SECRET=XXX deploy: placement: constraints: - "node.role != manager" restart_policy: condition: on-failure replicas: 3 networks: bridge: external: true traefik: external: true volumes: dronedata: external: true
$ docker stack deploy -c ci.yml ci
I believe the main thing that got this working correctly and reliably was publishing the port to the host.
- I run the server on node1 (
- I run the agents on all other nodes