Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to watch a key in Consul and trigger jobs based on changes to the value for that key #506

Open
misterbisson opened this issue Sep 6, 2017 · 6 comments

Comments

@misterbisson
Copy link
Contributor

I need to be able to make changes to a configuration template outside of the Docker image. I'd typically argue that the config file is code and needs to be versioned with code, but that's not exactly the same as saying it needs to be deployed as an update to the image.

So, I'm looking for a way to keep the config template in Consul (in the k/v store) and have ContainerPilot watch watch the key for any changes, then trigger a job if it detects changes. I can write a job that will fetch that config template and poke my app with the update when it's complete, but I'd prefer to use the watch mechanism in ContainerPilot to do so.

@misterbisson misterbisson changed the title Add ability to watch a key in Consul and trigger jobs based on changes to that key Add ability to watch a key in Consul and trigger jobs based on changes to the value for that key Sep 6, 2017
@jwreagor
Copy link
Contributor

jwreagor commented Sep 7, 2017

I think this is another reasonable solution to use cases similar to #504. It's also nice that it doesn't rely on UNIX signal processing which can be a headache at times.

@tgross
Copy link
Contributor

tgross commented Sep 7, 2017

I think this is another reasonable solution to use cases similar to #504.

It's also useful in much more general cases. IIRC this was in discussion when we made the switch to Consul-only anyways. So 👍 on this feature.

@misterbisson
Copy link
Contributor Author

Two issues that I can think of are that the CP config for watches assumes only services, so we'll have to figure out a path through that. I also can't remember if CP is now updated to use true Consul watches or if it's still polling (which was definitely something we had in mind in the switch to Consul only).

@tgross
Copy link
Contributor

tgross commented Sep 7, 2017

Two issues that I can think of are that the CP config for watches assumes only services, so we'll have to figure out a path through that.

I'm pretty sure @geek had a good proposed config for that, it just never made it into an issue and I can't remember it (or go back through Slack now! 😀 )

I also can't remember if CP is now updated to use true Consul watches or if it's still polling (which was definitely something we had in mind in the switch to Consul only).

Not yet. See #461

@jwreagor
Copy link
Contributor

jwreagor commented Nov 14, 2017

Starting to sketch out the order of operations for this task. Looks something like...

  • Expand upon the definition that watches are only tied to services (remove serviceName from CP's Watch type)
  • Add a new watchType field to watches that pairs with the existing Consul Watch API.
  • If not specified otherwise, default watchType will be service for backwards compat.
  • Implement Blocking Queries for the existing Discovery backend.
  • Implement a handful of new Event types or enhance what we have for watching keys, keyprefix, nodes (?), etc.
  • ???
  • Profit

I'll flesh this out a bit more in the coming days.

@Smithx10
Copy link

Smithx10 commented Apr 27, 2018

This is an excellent idea. @cheapRoc That seems like a profitable avenue to go down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants