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

Hook into the docker event stream #38

Open
binocarlos opened this issue Jan 26, 2015 · 4 comments
Open

Hook into the docker event stream #38

binocarlos opened this issue Jan 26, 2015 · 4 comments

Comments

@binocarlos
Copy link
Contributor

If powerstrip listened to the docker event stream - it means adapters could be configured to be told when a container dies (or any other event that is not the result of a docker HTTP api call).

The adapters.yml would need another section - something like events perhaps:

version: 1
endpoints:
  "POST /*/containers/create":
    pre: [weave]
    post: [weave]
events:
   die: [weave]
adapters:
  weave: http://weave/weave-adapter

The payload could be something like:

POST /adapter HTTP/1.1
Content-type: application/json
Content-length: ...

{
    PowerstripProtocolVersion: 1,
    Type: "event",
    Event: {
        Type: "DIE",
        Body: "{ ... }" or null
    }
}

The main point is to allow adapters to know that a container has died on its own rather than as a result of a HTTP request generated by the docker client.

Just something that cropped up in my head - it might be out of the scope of powerstrip not sure?

@binocarlos
Copy link
Contributor Author

Thinking about it - an adapter could hook into the event stream of its own accord (providing the docker socket is mounted into the adapter container).

Probably better than polluting the adapters.yml with another section, not sure - will leave this here for feedback anyway.

@progrium
Copy link

There is a big advantage to effectively turning the event stream into webhooks. My preferred API would be having an adapter endpoint used to POST events to.

@Symmetric
Copy link

It would be nice to have this function in Powerstrip -- I think that in general any plugin that cares about creation events will also have a need to capture deletion events too, and so having the code in Powerstrip will prevent clients from having to re-invent the wheel.

Have you done any more detailed thinking on how to implement this? I might take a look at this in a few weeks.

@progrium
Copy link

It would be reasonable to expose them as their own hook request, but I
think for now it's good enough to just use the API and listen to events
yourself.

On Thu, Mar 19, 2015 at 5:08 PM, Paul Tiplady [email protected]
wrote:

It would be nice to have this function in Powerstrip -- I think that in
general any plugin that cares about creation events will also have a need
to capture deletion events too, and so having the code in Powerstrip will
prevent clients from having to re-invent the wheel.

Have you done any more detailed thinking on how to implement this? I might
take a look at this in a few weeks.


Reply to this email directly or view it on GitHub
#38 (comment).

Jeff Lindsay
http://progrium.com

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

No branches or pull requests

3 participants