Enable services to use different Docker Hosts #607

Closed
wants to merge 10 commits into
from

Projects

None yet

10 participants

@waitingkuo

This is inspired by #527
The proposal for this pull request is #608

@nathanleclaire nathanleclaire commented on an outdated diff Nov 3, 2014
fig/project.py
@@ -188,12 +212,15 @@ def remove_stopped(self, service_names=None, **options):
for service in self.get_services(service_names):
service.remove_stopped(**options)
+ #FIXME
@nathanleclaire
nathanleclaire Nov 3, 2014

Heh. I'd go ahead and break this out into smaller local variables

@nathanleclaire

Looks pretty cool. I'd recommend changing docker_client.py to docker_client_maker.py if you're going to rename the class (same for the test file).

How about docs?

@waitingkuo

That's a good idea to rename it. Let me commit again.

By the way, it's also inspired by your talk in the Docker Global Hack Day. That feature is awesome, I'm looking forward to it! And this pull request is the hack during the hack day.

@nathanleclaire

👍 👍 👍 🐳 🐋 🐳 🐋

@waitingkuo

I've rename it and update docs!

@waitingkuo

Hi

I just modify how fig get the configuration and pass those parameters such like base_url to the docker client ( from docker-py ) . Do we need to something more for docker-py?

Thank you

Sent from my iPhone

On 2014Äê11ÔÂ3ÈÕ, at ÏÂÎç5:40, Ben Firshman notifications@github.com wrote:

Thanks @waitingkuo, this is brilliant! Something we absolutely need to get in Fig.

Have you thought about how this could go upstream in docker-py?

¡ª
Reply to this email directly or view it on GitHub.

@bfirsh
Collaborator
bfirsh commented Nov 3, 2014

Sorry – I misunderstood what this pull request was for. I'll review it soon for you. Thanks for your contribution!

@bfirsh
Collaborator
bfirsh commented Nov 3, 2014

We're also working on getting some of these features directly into Docker. Here is some context: docker/docker#8859 docker/docker#8681

@waitingkuo

Hi @bfirsh ,
Thank you for your time and your sharing. Honestly, this pull request is inspired the host management proposal. It's awesome! Look forward to that feature!

@hughdbrown
return service_dict.get('docker_host', os.environ.get('DOCKER_HOST'))
@hughdbrown
return service_dict.get('docker_cert_path', os.environ.get('DOCKER_CERT_PATH', '')) or os.path.join(os.environ.get('HOME', ''), '.docker')
@bfirsh
Collaborator
bfirsh commented Nov 13, 2014

@waitingkuo 🎉 Congrats on winning the hack day! 🎉

Hope to see you at DockerCon EU and we can talk about this some more. :)

@inthecloud247 inthecloud247 referenced this pull request in docker/docker Nov 14, 2014
Closed

Proposal: Host management #8681

@cpuguy83

What if instead of defining a host within a service you have an entirely different definition for hosts and call them by name in your service definition?

@anarcher

Congrats~!
I am an author of #527
I am glad to that my pull request inspired it :-)

@inthecloud247

This pull request has now been open for almost 2 weeks without review by fig maintainers. The current merge conflicts are seemingly due to other work being merged in as this pull request languishes. (Even though this feature led to the author winning the most recent Docker Hack Day competition...)

Per discussion from recent DGAB meeting, escalating this by pinging @VanL as DGAB chair and @dnephin as fig maintainer.

@waitingkuo

Hi @bfirsh , Look forward to meet you in Dockercon Europe
Hi @anarcher , thanks. I rebased your pull request in the very beginning. But it seems the docker client part changed a lot. So I rewrote it.

@waitingkuo

Hi @cpuguy83 , do you mean add a top layer for the configure file?

host1:
  docker_host: 192.168.0.1
  services:
    web1:
      build: .
      command: python app.py

host2:
  docker_host: 192.168.0.2
  services:
    web2:
      build: .
      command: python app.py
    web3:
      build: .
      command: python app.py
@cpuguy83

@waitingkuo for like

hosts:
    host1:
        address: tcp://192.168.0.2
        tlsverify: true
        cacert: /path/to/cacert.pem
        tlscert: /path/to/cert.pem
        tlskey: /path/to/key.pem

web1:
    image: web
    hosts:
        - host1

Or something close to that, anyway.

@waitingkuo

@cpuguy83
Yours is more clear. It's good to me! At your case, we need to prevent from naming our service as hosts

How about this? is it verbose for you?

hosts:
    host1:
        address: tcp://192.168.0.2
        tlsverify: true
        cacert: /path/to/cacert.pem
        tlscert: /path/to/cert.pem
        tlskey: /path/to/key.pem

services:
  web1:
    image: web
    hosts:
        - host1
@docteurklein

just for you information @waitingkuo , I've played a bit with your branch and added automatic ambassador creation for remote links.

docteurklein/fig@63fd6ed

Please take a look.
It's very raw, and just a POC, based on ctlc/ambassador container.

@waitingkuo

Hi @docteurklein . It's awesome!! Sorry for the late reply. I'm in a travel. I'll play more and reply you soon!

@xiaods xiaods referenced this pull request in docker/docker Dec 17, 2014
Closed

Proposal: Docker Compose #9694

@dnephin
Member
dnephin commented Aug 25, 2015

First off, sorry it's taken us so long to respond to this PR. When this PR was first opened there were a few competing implementations for multi-host docker. At the time, it wasn't clear what was going to happen. After a while it became clear that swarm would be the way forward.

Thank you very much for the contribution, but unfortunately this is not the direction we'll be going with compose.

@dnephin dnephin closed this Aug 25, 2015
@waitingkuo

Glad to see that swarm does a job now!

@midnightconman

I know this issue is old and closed, but it would be nice to be able to either run services locally or use multiple swarm clusters from a single compose file.

As a feature request, can we have a host parameter for services... which would act exactly like the environment variable DOCKER_HOST. Being required to run all services in a single compose file on a single docker host is very limiting for future patterns.

Here is an example:

version: '2'
services:
  web:
    build: .
    depends_on:
      - db
      - redis
    host: unix:///var/run/docker.sock
  redis:
    image: redis
    host: tcp://10.0.0.5:2376
  db:
    image: postgres
    host: tcp://127.0.0.1:2376
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment