thojkooi / terraform-digitalocean-docker-swarm-mode

Terraform module for provisioning a Docker Swarm mode cluster on DigitalOcean
https://registry.terraform.io/modules/thojkooi/docker-swarm-mode/digitalocean
MIT License
63 stars 27 forks source link

Leave a swarm if re-provisioning #28

Closed jamesprior closed 6 years ago

jamesprior commented 6 years ago

In the event of a re-run after failure, leave the swarm before trying to re-join.

I was getting docker info output that looked like this:

root@manager-02:~# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 4
Server Version: 17.12.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: error
 NodeID: 
 Error: rpc error: code = DeadlineExceeded desc = context deadline exceeded
 Is Manager: false
 Node Address: 10.136.117.77

The actual problem seems to be something else but this is a small change at least to try re-joining.

thojkooi commented 6 years ago

Thanks for the pr. I will try out this change shortly, but it looks ok.

jamesprior commented 5 years ago

Hey, thanks for reviewing this and pulling it in! I hope it saves someone some time