Introduce profiles#98
Conversation
Signed-off-by: Nicolas De Loof <[email protected]>
| services: | ||
| foo: | ||
| image: foo | ||
| bar: | ||
| image: bar | ||
| profiles: ["test"] | ||
| zot: | ||
| image: zot | ||
| profiles: ["debug"] | ||
| depends_on: ["bar"] |
There was a problem hiding this comment.
| services: | |
| foo: | |
| image: foo | |
| bar: | |
| image: bar | |
| profiles: ["test"] | |
| zot: | |
| image: zot | |
| profiles: ["debug"] | |
| depends_on: ["bar"] | |
| services: | |
| foo: | |
| image: foo | |
| bar: | |
| image: bar | |
| profiles: | |
| - test | |
| zot: | |
| depends_on: | |
| - bar | |
| image: zot | |
| profiles: | |
| - debug |
|
|
||
| - Compose application model parsed with no profile enabled only contains the `foo` service. | ||
| - If profile `test` is enabled, model contains both the `foo` and `bar` service. | ||
| - If profile `debug` is enabled, model contains both the `foo` and `zot` service, but not `bar` |
There was a problem hiding this comment.
| - If profile `debug` is enabled, model contains both the `foo` and `zot` service, but not `bar` | |
| - If profile `debug` is enabled, model contains both `foo` and `zot` services, but not `bar` |
| implementation when none of the listed profiles match the active ones, until the target component is | ||
| explicitly targeted by a command. | ||
|
|
||
| References to other services (by `links`, `extends` or shared resource syntax `service:xxx`) MUST not |
There was a problem hiding this comment.
The term "shared resource syntax service:xxx" is not defined anywhere in the spec document.
Where can a newcomer learn what is it? It would be good if there was at least a hyperlink here.
There was a problem hiding this comment.
This is referring to system resources shareable between services or with the host, where you can specify the resource with the service:[service name] syntax, see network_mode and ipc in the spec.
There was a problem hiding this comment.
Thanks for the clarification. If the document included these links to the spec that would be really helpful for other people, too. Do you think it can be added?
There was a problem hiding this comment.
Now I see that this snippet was already merged in https://github.com/compose-spec/compose-spec/pull/110/files#diff-bc6661da34ecae62fbe724bb93fd69b91a7f81143f2683a81163231de7e3b545R182.
My comment should really be placed there. The gist of it stands: could a link network_mode and ipc be added in the document?
|
With the follow-up PR for Also having a profile name start with # start profile named "--build"
compose up --profile --build |
|
About restriction on profile name, I suggest we re-use work done on #60 and define |
EricHripko
left a comment
There was a problem hiding this comment.
Looks like a great start and a lovely potential addition to the spec 🙌 I got one chunky point of discussion inline and a few minor suggestions 💬
| References to other services (by `links`, `extends` or shared resource syntax `service:xxx`) MUST not | ||
| automatically enable a component that would otherwise have been ignored by active profiles. | ||
|
|
||
| #### illustration sample |
There was a problem hiding this comment.
| #### illustration sample | |
| #### Illustration sample |
Since other headings uppercase first letter
|
|
||
| ### profiles | ||
|
|
||
| `profiles` defines a list of named profile for volume to be enabled. When not set, volume is always enabled. |
There was a problem hiding this comment.
| `profiles` defines a list of named profile for volume to be enabled. When not set, volume is always enabled. | |
| `profiles` defines a list of named profiles for volume to be enabled under. When not set, volume is always enabled. |
|
|
||
| ### profiles | ||
|
|
||
| `profiles` defines a list of named profile for network to be enabled. When not set, network is always enabled |
There was a problem hiding this comment.
| `profiles` defines a list of named profile for network to be enabled. When not set, network is always enabled | |
| `profiles` defines a list of named profiles for network to be enabled under. When not set, network is always enabled |
|
|
||
| ### profiles | ||
|
|
||
| `profiles` defines a list of named profile for service to be enabled. When not set, service is always enabled. |
There was a problem hiding this comment.
| `profiles` defines a list of named profile for service to be enabled. When not set, service is always enabled. | |
| `profiles` defines a list of named profiles for service to be enabled under. When not set, service is always enabled. |
| All top-level elements support a `profiles` attribute to define a list of named profiles. Elements without | ||
| a `profiles` attribute set MUST always be enabled. The enclosing component MUST be ignored by compose | ||
| implementation when none of the listed profiles match the active ones, until the target component is | ||
| explicitly targeted by a command. |
There was a problem hiding this comment.
It feels a bit strange that users can get (what is essentially) a one-off profile with always-on services + just the target service. This might get rather confusing since we're ignoring profiles attribute on the target service, but enforcing it everywhere else.
Is it worth to fomalise this a bit more by saying that compose run/up TARGET will activate the profiles of the target service? I appreciate that this probably makes the lives of Compose implementors harder (especially considering the follow-up profile-specific files proposal), but this functionality in isolation seems more confusing than beneficial.
|
@ndeloof - have you had a chance to break this out into a smaller initial profile proposal? |
|
@EricHripko I have been pretty busy, feel free to take ownership on this topic if you can |
|
@ndeloof I'd gladly support here, what can I do to advance this PR? AFAIK the next step was to reduce the scope of this PR to a minimum and add further use cases with additional PRs? But for me this PR already is quite limited in scope, so what should be cut for the first step? I would only think of limiting the profiles key word to the If that would be okay, I could create a new PR with this and incorporate the pending feedback from here (since I can not take over this PR??). |
|
@acran yes indeed, we agreed on reducing scope to |
|
I created a new PR with hopefully all the feedback incorporated in #110. Please have a look (= |
|
This is awesome - thanks for picking it up @acran 🙂 |
|
closing as obsolete |
What this PR does / why we need it:
Introduce
profilesin compose schema and specification.This is based on #97 discussion, but does not cover the
overridefile proposal, which could be proposed in a follow-up PR.Which issue(s) this PR fixes:
see #97