mediadepot / chef-depot

DEPRECATED: Replaced by mediadepot/ignition
https://github.com/mediadepot/ignition
28 stars 2 forks source link

[events] use rancher websocket api to listen/subscribe to events, rather than the docker events api/gem #19

Closed AnalogJ closed 8 years ago

AnalogJ commented 8 years ago

I don't think the /v1/subscribe?eventNames=resource.change WebSocket works with this kind of key to give you change events for all the projects/environments. You can try it but may end up having to poll for changes to balancers, or open a WebSocket per-project by adding &projectId=.

http://forums.rancher.com/t/api-key-for-all-environments/279/3?u=analogj

The UI also uses websockets to dynamically update. Can you check whether the UI is successfully making websocket connections?

To do so:
1. Open up rancher in your browser
2. Open up the developer tools for your browser and go to the network tab,
3. Refresh the browser.
You should see a request to /v1/subscribe. Was it made successfully and is the response code to that request 101 "Switch Protocols"?

http://forums.rancher.com/t/aws-elb-ws-problems/1202/2?u=analogj

var url = 'ws://'+accessKey+':'+secretKey+'@'+host+'/v1/subscribe?eventNames=resource.change'; var socket = new WebSocket(url); https://gist.github.com/vincent99/491afed2306ba448dd89

AnalogJ commented 8 years ago

use https://github.com/rancher/python-agent/blob/master/cattle/agent/ to handle websocket events, rather than ruby?

AnalogJ commented 8 years ago

working event handler as of 10-12-2015. https://github.com/mediadepot/docker-rancher-events/commit/22c8141389e44ed2aa01b01fa87334ef29023f46