-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
extends
– Inherit services from other services
#1088
Conversation
Nice! Looks great. |
If we want a simpler example, we could have a I think there should be separate guides for setting up different environments with extends, and how to split up your configuration into multiple files. Perhaps the reference could just link off to those pages. |
image: postgres | ||
``` | ||
|
||
Here, the `web` service in **development.yml** inherits the configuration of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the Here
refers to the example above, or below - need a stronger way to delineate the 2 examples.
Update: done a basic implementation. TODO in the description. |
Also, this now sits atop #1099. |
the config-layout looks reasonable to me. still, i think it's important to clarify the possibilities what can be used in the |
It seems kind of arbitrary that I think this would be a lot more obvious to developers if it raised an error if the service you are trying to extend has any of these options, instead of copying over half the definition. A developer would still be able to have a similar setup, they'd just be forced to create some extra "base" services that exclude the links/net/volumes. |
@dnephin I can see two sensible approaches with
Looking at it now, (1) seems better for multiple reasons:
|
OK, I've blacklisted |
extends
extends
– Inherit services from other services
extends
– Inherit services from other servicesextends
– Inherit services from other services
Looks great. Two things:
An aside: I'm not 100% convinced by having "base" services. I quite like the idea of having the default config inside the GitHub repo, then some downstream deployment system could overlay a production configuration on top without imposing that a base config exists. These are kinks we can smooth out over time though... |
@bfirsh that's fair. I think any time you try to "extend" a service definition that isn't in the current repo, it's more likely you actually want to pull in My understanding (based on #988) is that there will be support for doing this eventually, but we're addressing the easier case of "local includes" first (which is a bit of a different use case). It would be great to have a name to refer to these "external project includes". |
Agreed - created #1127.
Circular import detection now pushed. |
It was easier to implement #1109 on top of these changes, rather than independently, so I've done that. |
This is ready to go, in my opinion. ping @dnephin |
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
`extends` – Inherit services from other services
`extends` – Inherit services from other services Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
It's definitely good to be able to extend services defined elsewhere. One thing I don't understand is, why is it prohibited to extend services that have
A simple project with an app and a db container. It should work anywhere there's Docker. If myimages is accessible, then
Which obviously fails. Because app is linked to something (or gets volumes from somewhere...). The "solution" would be to pull The recommended approach seems to be to create base definitions for services and the write top-level ymls with I believe there should be no limitations as to which containers can be extended. Scalars should be overridden, lists should be merged. But besides that, it should be up to users how and what to extend. |
@iafilatov See the #1380 it might fit what you want |
Mostly yes, thanks. |
hello, how can I approach a case where I have multiple services which are each essentially isolated (microservice architecture w/REST communication between services), but I want a master compose repo/file that controls orchestrating/building the entire platform? Right now using the current extends syntax doesn't work bc the individual services all have their own links (databases/cache/etc) Any info appreciated, thanks! |
+1, I have a similar use case as @erichonkanen. Specifically, I have I would like to have a project-level (the directory above It seems reasonable to support links, in the following way: if you extend a service with links (or volumes_from), this should be allowed if and only you define a service of the same name (which can either also be an extension, or be created from scratch). |
+1’ing this, also, too. |
+1 |
Here's a first pass at the feature also known as "import", "include" and "copy", most recently proposed in #988 and spiked out in #1080.
I feel like the example in the docs should be simpler. Perhaps there should be a new documentation page with a fuller explanation of the various intricacies (overriding individual env vars, 3-file example, not inheriting links or volumes_from), and a more concise explanation here.
Also, maybe
ports
should be included in the "not inherited" blacklist.TODO:
links
orvolumes_from
net:container
(waiting on Make volumes_from and net containers first class dependencies #1076)