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

Add explicit (separate) "docker-swarm" and "triton" docker-compose files #9

Closed
wants to merge 1 commit into from

Conversation

tianon
Copy link

@tianon tianon commented Apr 12, 2016

Since Triton does not yet support docker network, this is the best solution for making sure this repository can function appropriately in both environments (uses docker network for Swarm and --link for Triton).

Without this, Swarm will see --link and co-schedule all the containers, which defeats the whole purpose of the demonstration.

Since Triton does not yet support `docker network`, this is the best solution for making sure this repository can function appropriately in both environments (uses `docker network` for Swarm and `--link` for Triton).

Without this, Swarm will see `--link` and co-schedule all the containers, which defeats the whole purpose of the demonstration.
restart: always
env_file: _env
environment:
- CONTAINERBUDDY=file:///etc/containerbuddy.json
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason we don't just embed CONTAINERBUDDY=file:///etc/containerbuddy.json directly in the image itself?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right to ask. That's what we've started doing since this one. Example: https://github.com/autopilotpattern/couchbase/blob/master/Dockerfile#L12

@tianon
Copy link
Author

tianon commented Apr 14, 2016

cc @misterbisson

@misterbisson
Copy link
Contributor

@tianon if this repo implemented the DNS discovery of Consul as it's demonstrated in https://github.com/autopilotpattern/jenkins and https://github.com/autopilotpattern/couchbase (and discussed in #10), how would that change this PR?

Related: I just ticketed the task of adding setup and demo scripts, #12 and explained it in more detail in autopilotpattern/wordpress#1 (comment)

@@ -1,35 +1,39 @@
# MySQL designed for container-native deployment on Joyent's Triton platform.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we'd eliminate the common-compose.yml entirely. We dropped it in our more recent blueprints because eliminating the use of --link for Consul meant that the main docker-compose.yml could be the common parent. https://github.com/autopilotpattern/couchbase is a good example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I've started work on fixing up this repo in #14

@tianon
Copy link
Author

tianon commented Apr 14, 2016

I think some of the Triton vs Swarm issues might make more sense in the context of a diff between the two:

diff --git a/docker-swarm/docker-compose.yml b/triton/docker-compose.yml
index d282c07..89130e7 100644
--- a/docker-swarm/docker-compose.yml
+++ b/triton/docker-compose.yml
@@ -6,8 +6,12 @@ services:
         extends:
             file: ../common-compose.yml
             service: mysql
+        network_mode: bridge
+        links:
+            - consul:consul

     consul:
         extends:
             file: ../common-compose.yml
             service: consul
+        network_mode: bridge

The addition of links is to combat the fact that Triton doesn't have DNS (which could use CNS given #11, but I'm honestly not convinced that's actually simpler since now my _env needs even more account-specific information in it that it didn't need before), and the addition of network_mode is to stop docker-compose from trying to create an overlay network (which fails outright on Triton).

Even with that other approach, I don't see a simple way to get back to a single docker-compose.yml that works for both unless Triton implements some bits of the new Docker networking features. 😞

@tianon
Copy link
Author

tianon commented Apr 14, 2016

(If you'd rather, I'm happy to move the discussion of --links over to #12, but it sounds like the goal of doing so is to remove the need for two docker-compose.yml files, which won't actually be doable AFAICT 😢)

@tianon
Copy link
Author

tianon commented Apr 14, 2016

Just verified -- with a version 1 docker-compose.yml, docker-compose does not create an overlay network, and thus doesn't give us DNS to access consul for free. 😞 (which is the reason we had to move to version 2 in the first place)

@misterbisson
Copy link
Contributor

I don't see a simple way to get back to a single docker-compose.yml that works for both unless Triton implements some bits of the new Docker networking features

We've got good news on that coming. So, it'll be two files for now, but one in the future. At the same time, we're also looking at moving the local development to Swarm environments to make it easier to test multi-host environments on our laptops.

My biggest concern isn't really about this PR, but with how much we've learned about other things that I'd want to implement here before we enshrine the historical practice. Thanks for your patience and insight as we try to work through both problems at once.

@misterbisson
Copy link
Contributor

Triton doesn't have DNS

Say more about what you're expecting that isn't covered by https://www.joyent.com/blog/introducing-triton-container-name-service? Is it just that the search domain isn't automatically set?

@misterbisson
Copy link
Contributor

FYI, I've started work on fixing up this repo in #14

@tianon
Copy link
Author

tianon commented Apr 18, 2016

Is it just that the search domain isn't automatically set?

That's the one! 😄 👍

Happy to have helped spur so much interesting discussion. 😄

@misterbisson
Copy link
Contributor

Regarding Triton support for Docker Compose file format v2 and Docker network syntax, I should share the following tickets:

@tianon
Copy link
Author

tianon commented Apr 18, 2016

Re: DOCKER-585, I can't seem to find a --publish-service flag, but the flag Compose uses is --net-alias, which does allow multiple aliases, so seems like an OK candidate for TCNS (just tested myself with --net-alias a --net-alias b --net-alias c, which was successful).

$ docker run -dit --name test --net-alias a --net-alias b --net-alias c --net some-network debian:sid
...
$ docker inspect test
...
            "Networks": {
                "some-network": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "a",
                        "b",
                        "c"
                    ],
                    "NetworkID": "e76b7deb5c688dcf4829acc02ffff84bdbde9e3ba2fe98b3dc1068c7fb1e98a7",
                    "EndpointID": "6592a9634170458ac9ce98b23f0db8c01dba016281bf9bf1707fd408a4b41705",
                    "Gateway": "172.19.0.1",
                    "IPAddress": "172.19.0.3",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:13:00:03"
                }
            }
...

(but worth pointing out that the aliases are network-specific)

@tianon
Copy link
Author

tianon commented Apr 18, 2016

(is there any way I could subscribe to these bugs without doing something hacky like page2rss?)

@misterbisson
Copy link
Contributor

I can't seem to find a --publish-service flag

Right. That was from an earlier, proposed Docker syntax back in 2015. I need to add a note there about --net-alias. Thank you for highlighting it.

is there any way I could subscribe to these bugs without doing something hacky like page2rss?

That's my goal, but I'm not aware of a better plan today.

@tianon
Copy link
Author

tianon commented Apr 18, 2016

Rock on, thanks! 👍 🤘

@misterbisson
Copy link
Contributor

@tianon I've added #19 with what I think is a plan to integrate what you've shown us here in to the rest of the repo. Does that make sense?

@tgross
Copy link
Contributor

tgross commented Jan 30, 2017

I think we can finally close this one because of the work done in #79 for #19

@tgross tgross closed this Jan 30, 2017
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

Successfully merging this pull request may close these issues.

3 participants