bellycard / docker-loadbalancer

121 stars 29 forks source link

Registrator not picking up docker events (Mac OS X) #8

Open davidadale opened 9 years ago

davidadale commented 9 years ago

So I have this fig.yml

app: image: globalvcard/gps:latest environment: SERVICE_80_NAME: http SERVICE_NAME: app SERVICE_TAGS: production ports:

lb: build: ./ links:

consul: command: -server -bootstrap -advertise 10.0.2.15 image: progrium/consul:latest ports:

registrator: command: -internal consul://consul:8500 image: gliderlabs/registrator:latest links:

and i do a "fig up -d"

the registrator has been updated as the author has made updates this morning. I contacted him first to figure this out. There was an issue listed on the project #94 was the issue number. He updated the registrator repo just about an hour ago and closed that ticket.

When the containers come up and I can see all the containers in the consul web app. I tail the logs on the registrator container and then try starting a new docker container and nothing happens on the registrator. I have verified that the events are occurring by "docker events".

I am wondering if this has to do with the boot2docker stuff? Do you see any problems with this? It's a slightly modified version of what you have published.

shanesveller commented 9 years ago

I made a similar change against our fig.yml here:

https://github.com/bellycard/docker-loadbalancer/commit/a487ea05ad594e87ea9cbc31624f7f4b512fbc1a

I can't seem to reproduce your issue - scaling the app containers via fig works as expected, and outputs Register events in the log:

registrator_1 | 2015/02/18 19:40:27 registrator: added: 0774a89c3e26 0774a89c3e26:web_app_2:80
registrator_1 | 2015/02/18 19:40:27 registrator: added: 733a07074550 733a07074550:web_app_3:80
registrator_1 | 2015/02/18 19:40:28 registrator: added: 7911fbc52545 7911fbc52545:web_app_4:80
registrator_1 | 2015/02/18 19:40:30 registrator: removed: 7911fbc52545 7911fbc52545:web_app_4:80
registrator_1 | 2015/02/18 19:40:30 registrator: removed: 733a07074550 733a07074550:web_app_3:80
registrator_1 | 2015/02/18 19:40:30 registrator: removed: 0774a89c3e26 0774a89c3e26:web_app_2:80

I have the following app/image versions installed:

Boot2Docker-cli version: v1.3.2
Git commit: e41a9ae
Client version: 1.3.2
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 39fa2fa
OS/Arch (client): darwin/amd64
Server version: 1.4.1
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 5bc2ff8
REPOSITORY                   TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
[...]
gliderlabs/registrator       latest              520dc126afc7        About an hour ago   13.75 MB
tutum/hello-world            latest              8d4811f76c4f        5 days ago          244.3 MB
progrium/consul              latest              53a7b829dd6f        2 weeks ago         54.34 MB
[...]

boot2docker is installed via brew-cask and running in VirtualBox 4.3.18 on OSX 10.10.2. The only modification was to disable TLS support via these steps

...if you have tools that cannot be easily switched, you can disable it by adding DOCKER_TLS=no to your /var/lib/boot2docker/profile file on the persistent partition inside the Boot2Docker virtual machine...

Do you notice anything in your environment differing significantly from the above?

shanesveller commented 9 years ago

I also tried this with Boot2docker/Docker versions 1.5.0 and seem to be successful.

davidadale commented 9 years ago

Great, maybe my problem is that i am using the docker run command instead of fig scale. I was under the impression that i could use either.

On Wed, Feb 18, 2015 at 2:55 PM, Shane Sveller notifications@github.com wrote:

I also tried this with Boot2docker/Docker versions 1.5.0 and seem to be successful.

— Reply to this email directly or view it on GitHub https://github.com/bellycard/docker-loadbalancer/issues/8#issuecomment-74935643 .

shanesveller commented 9 years ago

docker run can also work but needs certain environment vars to be set for Registrator to act on, which are the SERVICE_* entries in the fig.yml.

davidadale commented 9 years ago

Oh, okay.

Here is the docker command that I use.

docker run -d -P -e site_home=http://test.api.globalvcard.com -e database_username=root -e database_password=root -e database_url=jdbc:mysql://192.168.59.3:3306/csi -e SERVICE_80_NAME=http -e SERVICE_NAME=api -e SERVICE_TAGS=test -e system_flavor=api globalvcard/gps

On Wed, Feb 18, 2015 at 3:00 PM, Shane Sveller notifications@github.com wrote:

docker run can also work but needs certain environment vars https://github.com/gliderlabs/registrator#single-service-with-metadata to be set for Registrator to act on, which are the SERVICE_* entries in the fig.yml.

— Reply to this email directly or view it on GitHub https://github.com/bellycard/docker-loadbalancer/issues/8#issuecomment-74936592 .

davidadale commented 9 years ago

Hmm... I do see fig scale works. Its the boot2docker thing that is confusing me. Are there more then one docker daemon running?

On Wed, Feb 18, 2015 at 3:01 PM, David Dale davidadale@gmail.com wrote:

Oh, okay.

Here is the docker command that I use.

docker run -d -P -e site_home=http://test.api.globalvcard.com -e database_username=root -e database_password=root -e database_url=jdbc:mysql://192.168.59.3:3306/csi -e SERVICE_80_NAME=http -e SERVICE_NAME=api -e SERVICE_TAGS=test -e system_flavor=api globalvcard/gps

On Wed, Feb 18, 2015 at 3:00 PM, Shane Sveller notifications@github.com wrote:

docker run can also work but needs certain environment vars https://github.com/gliderlabs/registrator#single-service-with-metadata to be set for Registrator to act on, which are the SERVICE_* entries in the fig.yml.

— Reply to this email directly or view it on GitHub https://github.com/bellycard/docker-loadbalancer/issues/8#issuecomment-74936592 .

davidadale commented 9 years ago

Sorry for the naive questions. All this is new to me. I will continue trying to figure out the difference between fig scale and docker run. Both should be talking to the docker instance that is running in the VM created by boot2docker. I am able to see the events that get created from both.

On Wed, Feb 18, 2015 at 3:10 PM, David Dale davidadale@gmail.com wrote:

Hmm... I do see fig scale works. Its the boot2docker thing that is confusing me. Are there more then one docker daemon running?

On Wed, Feb 18, 2015 at 3:01 PM, David Dale davidadale@gmail.com wrote:

Oh, okay.

Here is the docker command that I use.

docker run -d -P -e site_home=http://test.api.globalvcard.com -e database_username=root -e database_password=root -e database_url=jdbc:mysql://192.168.59.3:3306/csi -e SERVICE_80_NAME=http -e SERVICE_NAME=api -e SERVICE_TAGS=test -e system_flavor=api globalvcard/gps

On Wed, Feb 18, 2015 at 3:00 PM, Shane Sveller notifications@github.com wrote:

docker run can also work but needs certain environment vars https://github.com/gliderlabs/registrator#single-service-with-metadata to be set for Registrator to act on, which are the SERVICE_* entries in the fig.yml.

— Reply to this email directly or view it on GitHub https://github.com/bellycard/docker-loadbalancer/issues/8#issuecomment-74936592 .

davidadale commented 9 years ago

I think i figured it out. I wasn't explicitly mapping the ports like -p 9000:8080....

Thanks for the help today.

On Wed, Feb 18, 2015 at 3:37 PM, David Dale davidadale@gmail.com wrote:

Sorry for the naive questions. All this is new to me. I will continue trying to figure out the difference between fig scale and docker run. Both should be talking to the docker instance that is running in the VM created by boot2docker. I am able to see the events that get created from both.

On Wed, Feb 18, 2015 at 3:10 PM, David Dale davidadale@gmail.com wrote:

Hmm... I do see fig scale works. Its the boot2docker thing that is confusing me. Are there more then one docker daemon running?

On Wed, Feb 18, 2015 at 3:01 PM, David Dale davidadale@gmail.com wrote:

Oh, okay.

Here is the docker command that I use.

docker run -d -P -e site_home=http://test.api.globalvcard.com -e database_username=root -e database_password=root -e database_url=jdbc:mysql://192.168.59.3:3306/csi -e SERVICE_80_NAME=http -e SERVICE_NAME=api -e SERVICE_TAGS=test -e system_flavor=api globalvcard/gps

On Wed, Feb 18, 2015 at 3:00 PM, Shane Sveller <notifications@github.com

wrote:

docker run can also work but needs certain environment vars https://github.com/gliderlabs/registrator#single-service-with-metadata to be set for Registrator to act on, which are the SERVICE_* entries in the fig.yml.

— Reply to this email directly or view it on GitHub https://github.com/bellycard/docker-loadbalancer/issues/8#issuecomment-74936592 .