autopilotpattern / nginx

An Nginx container for container-native deployment and automatic backend discovery
Mozilla Public License 2.0
57 stars 25 forks source link

Implement leave_on_terminate for Consul co-process #27

Open misterbisson opened 8 years ago

misterbisson commented 8 years ago

Following from https://github.com/joyent/containerpilot/issues/218: When a Consul agent running as a co-process in a ContainerPiloted application exits, it is not de-registered from the Consul cluster.

@fitz123 suggests the leave_on_terminate Consul option will fix that. This ticket proposes implementing that option in this repo and for others in https://github.com/autopilotpattern.

fitz123 commented 8 years ago

I'm usually running 1 consul agent per node, using "--net host" in my environment, but I think it should work the same way for consul as a coprocess. You can enable this passing the option as an env variable during container build or creation: -e 'CONSUL_LOCAL_CONFIG={"leave_on_terminate": true}'

(https://hub.docker.com/_/consul/) Just a suggestion

tgross commented 7 years ago

In ContainerPilot 2.6.0 we provided support for this via updated Consul bindings, as well as the deregisterCriticalServiceAfter field in the client. We've updated ContainerPilot in https://github.com/autopilotpattern/nginx/pull/42.

Should we include deregisterCriticalServiceAfter in this issue? If so, what's a reasonable default value?

gbmeuk commented 7 years ago

Hi guys,

I was just wondering if anyone could quickly answer whether you guys are moving towards only running Consul as a coprocessor dropping the use of the API in the containerpilot code?

EDIT: never mind. I found the answer in https://github.com/joyent/containerpilot/issues/162 and will look to update our base images to use coprocesses going forward.