Giter VIP home page Giter VIP logo

docker-discover's People

Contributors

jwilder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-discover's Issues

Error in starting

docker run -d --net host --name docker-discover -e ETCD_HOST=192.168.56.102:4001 -p 1936:1936 -t jwilder/docker-discover

docker logs docker-discover

Error: 'Key not found : /backends'
Error: 'Key not found : /backends'
Error: 'Key not found : /backends'
Error: 'Key not found : /backends'

service on 1936 is unreacheable. Also whoami servers is unreacheable.
If I try to connect directly to a single whoami serv it works fine.

Reap child processes/Avoid zombies

The python script should handle its child processes (reload-haproxy.sh) properly to avoid zombies.

signal.signal(signal.SIGCHLD, signal.SIG_IGN)

works for me.

HAProxy doesn't register private registries.

First of all, these set of scripts, and your blog post, are awesome. I've got everything running as described and it's great. I did run into issues however when using this with private registries.

I'm about 100% sure it has to do with the section of code that looks for 2 / marks to verify if it's a valid registry. With a private registry there will also be a full url. For example:

my.private-registry.com/my/image

connect to x.x.x.1 port 8000: Connection refused

Hi,
Thanks for this great job!

I am trying the demo 'whoami', and haproxy works fine. I was able to see backend container id.

But when I deployed my own services on one backend server x.x.x.2

  • Container 2600516615c7 from Image service1 exposed port 0.0.0.0:8080->5001/tcp
  • Container a6fc817cbca3 from Image service2 exposed port 0.0.0.0:443->5000/tcp
    Same containers are running on another backend server x.x.x.3
  • Container 814d49616255 from Image service1 exposed port 0.0.0.0:8080->5001/tcp
  • Container 31eb936f2e59 from Image service1 exposed port 0.0.0.0:8080->5001/tcp

docker-discover is deployed on server x.x.x.1

But when call service1 api from address x.x.x.1:8080, I got

connect to x.x.x.1 port 8080: Connection refused

I curl etcd for key 'backends/service1', it showed me 3 sub nodes 'backends/service1/2600516615c7',
'backends/service2/814d49616255', 'backends/service1/port'

And for haproxy config, I see

listen service1
    bind *:5001

    server 814d49616255 x.x.x.2:8080 check inter 2s rise 3 fall 2
    server 2600516615c7 x.x.x.3:8080 check inter 2s rise 3 fall 2

Reloading config all the time

Hello,

First, thanks for all your projects around docker - they are great help.
One issue that I've been noticing is that when I have more than one container of the same service, the haproxy config would start reloading every 10-15 seconds even tho there were no change.

The issue is that etcd doesn't send back the nodes in the same order every time, and docker-discover would detect a change even tho it was just the same nodes, not in the same order.

A way to avoid this would be to have get_services() sort its results so that no change would be detected when nodes are swapped in the etcd response

I wrote a workaround, but I'm no python expert and it's too dirty to put in a pull request, but here it is anyway:

if name == "main":
current_services = {}
while True:
changed = False
try:
services = get_services()

        if not services or services == current_services:
            time.sleep(POLL_TIMEOUT)
            continue
        else:
            numberServices = len(services.items())
            current_numberServices = len(current_services.items())
            # print "numberServices = " + str(numberServices)
            # print "current_numberServices = " + str(current_numberServices)

            if numberServices == current_numberServices:
                #  "No new services... lets check them"
                for i in range(numberServices):
                    if services.items()[i][0] == current_services.items()[i][0]:
                        #  "Same services... Same values?"
                        regex = re.compile('[0-9]+.[0-9]+.[0-9]+.[0-9]+\:[0-9]+')
                        ipServices = sorted(re.findall(regex, str(services.items()[i])))
                        current_ipServices = sorted(re.findall(regex, str(current_services.items()[i])))
                        if ipServices == current_ipServices:
                        else:
                            changed = True
                            break;
                    else:
                        changed = True
                        break;
        if changed == True:
            print "config changed. reload haproxy"
            generate_config(services)
            ret = call(["./reload-haproxy.sh"])
            if ret != 0:
                print "reloading haproxy returned: ", ret
                time.sleep(POLL_TIMEOUT)
                continue
            current_services = services

    except Exception, e:
        print "Error:", e

    time.sleep(POLL_TIMEOUT)

I'm sure all of this could be done with a one liner sorting in get_services tho

Regards,

Haproxy not exposed by defaults as documentation states

Exposing ports using -p option is not valid when using the host network stack. When attaching to the host network stack, it's meaningless to ask docker to bind a container port on a host port. The haxproy stats interface is thus not exposed by default

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.