You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clarify the precedence between config.yml and docker compose files. #415
In a conversation with @Schnitzel, there was a philosophical discussion on the relationship between ddev and docker and whether the source of truth would be located within ddev's config.yml file OR if that would be secondary/subordinate to docker-compose.yml (and other files). This conversation touched on everything from ease of use, flexibility, best practices from the larger docker ecosystem, etc.
One thing surfaced in the conversation was the desire to, if an existing docker-compose.yml was already in existence to use that instead of generating a stock one from values stored in .ddev/config.yml. While that it is possible (essentially making ddev a wrapper), my bias would be to not adopt that approach OR to provide some additional guidance in converting that to an override Docker compose file.
This is just a placeholder for now as I need to put a little more thought and detail on this in order to make something actionable out of this.
maybe some background here as well.
amazee.io plans to use docker-compose.yml files to configure the hosting environment. As for amazee.io it is very important to not only have awesome production hosting, but also local development hosting, we're interested in having one file that configures everything.
there is a key in there amazeeio: which is not part of the docker-compose specs but as it is yaml, docker-compose actually doesn't care and just looks at the keys that are interesting for itself.
Just a short update of what happened on our side.
Unfortunately we had to realize that just adding a key to the yaml causes some versions of docker-compose to freak out and not parse it at all, even it is a fully valid Yaml.
It's probably too late for this, but it would be great if you'd give an example of "adding a key to the yaml causes some versions of docker-compose to freak out" so we'd understand it fully.
Labels does sound like the correct path though, (as little as I actually understand the problem being solved.)
Hi @Schnitzel. Just a quick heads up that we had a productive conversation this morning and will be following up by tomorrow with a proposed path forward. The example docker-compose file was incredibly helpful in understanding the use case and what would work/not work in each proposed path forward. Thanks for sending that along and we're looking forward to driving this issue to a completion state!
There are a couple of issues here, the stated issue and some things behind it.
Currently, the config.yml just overrides the images for the docker-compose.yml. It does that by setting environment variables that are used in the docker-compose. So the precedence is actually clear.
ddev never overrides or edits an existing docker-compose.yml
The docker-compose.yml can in fact be edited by the end-user to their delight, and ddev will not validate or be able to recover from weird things that may happen.
However, the long-term issues remain: This whole situation is not clear to the end-user, and the end-user can easily make the docker-compose file do things that we wish they wouldn't :) So long-term we may want to spin off an issue to wrap the docker-compose with something clearly owned by ddev.
Currently, the config.yml just overrides the images for the docker-compose.yml.
but this docker-compose.yml sits within a ddev folder no? so ddev could basically say: if I find a docker-compose.yml within the root folder, I don't even look at a config.yml or any ddev folder.
ddev never overrides or edits an existing docker-compose.yml
good! it shouldn't
This whole situation is not clear to the end-user, and the end-user can easily make the docker-compose file do things that we wish they wouldn't :)
mhh but they can also create weird stuff in a config.yml that might create broke stuff (like defining a Docker Image that actually does not do what it should)
At this point, the product has changed focus and is biasing towards stability and reliability instead of attempting to take on an unbounded answer space as a thin wrapper to Docker/Docker-compose. To that end, if a person/team had an arbitrary docker-compose that they wished to stand-up, they could always configure as a default php app and simply copy the additional compose file into the .ddev folder. This could also be done via a simple pre-start copy drush exec-host command to copy from the project root to .ddev/. To that end, closing this longstanding issue out.
We all understand that this makes testing hard or even impossible. amazee.io will provide testing resources within the Lagoon Testing infrastructure
Features like ddev ssh might now work from the beginning, which is acceptable for now. We will figure out over time how we can implement all the fancy systems that ddev has together with the Lagoon docker-compose.yml files
Understand that this issue is contentious but would it be possible to add support for a project type of custom which just disables the automatic generation of the docker-compose.yaml and launches whatever is defined in there, allowing for persistent customisations.
This can come with a major disclaimer and even be an "officially unsupported feature" but still allow others to extend ddev.
@thom8 I think you can override anything with custom docker-compose files, does that do the job for you? You can create any docker-compose.*.yaml that overrides or adds features, and you can specifically override with docker-compose.override.yaml. Only the main file is managed (and recreated on every start) by ddev.
Please let us know what you need that can't be done with that... Thanks!
If you really, really want to get into the business of building and maintaining your own docker image, then you can either extend ours (Use FROM drud/nginx-php-fpm-local:v0.19.0 and build it, or else fork the contents (especially Dockerfile.in) in containers/nginx-php-fpm-local and use make container there. But it's likely to break when we change the upstream image. Then you would change the image line in your docker override to specify your forked/derived image.
We don't build any images in the docker-compose, so that's why it's not going to work for you there.
Activity
Schnitzel commentedon Jul 20, 2017
maybe some background here as well.
amazee.io plans to use docker-compose.yml files to configure the hosting environment. As for amazee.io it is very important to not only have awesome production hosting, but also local development hosting, we're interested in having one file that configures everything.
here an example file for just a super easy node hosting:
https://github.com/amazeeio/node-example/blob/master/.amazeeio.yml
there is a key in there
amazeeio:which is not part of the docker-compose specs but as it is yaml, docker-compose actually doesn't care and just looks at the keys that are interesting for itself.rickmanelius commentedon Sep 6, 2017
This is now being prioritized for our next sprint to get to a decision/solution.
Schnitzel commentedon Sep 7, 2017
Just a short update of what happened on our side.
Unfortunately we had to realize that just adding a key to the yaml causes some versions of docker-compose to freak out and not parse it at all, even it is a fully valid Yaml.
So we went ahead and found a solution with using labels, example here:
https://github.com/amazeeio/drupal-example/blob/lagoonize/docker-compose.yml
So all these
com.amazeeio.*labels tell our build and deploy system lagoon how to create the needed resources on kubernetes/openshift.rfay commentedon Sep 7, 2017
It's probably too late for this, but it would be great if you'd give an example of "adding a key to the yaml causes some versions of docker-compose to freak out" so we'd understand it fully.
Labels does sound like the correct path though, (as little as I actually understand the problem being solved.)
rickmanelius commentedon Sep 7, 2017
Hi @Schnitzel. Just a quick heads up that we had a productive conversation this morning and will be following up by tomorrow with a proposed path forward. The example docker-compose file was incredibly helpful in understanding the use case and what would work/not work in each proposed path forward. Thanks for sending that along and we're looking forward to driving this issue to a completion state!
rfay commentedon Sep 11, 2017
There are a couple of issues here, the stated issue and some things behind it.
However, the long-term issues remain: This whole situation is not clear to the end-user, and the end-user can easily make the docker-compose file do things that we wish they wouldn't :) So long-term we may want to spin off an issue to wrap the docker-compose with something clearly owned by ddev.
Schnitzel commentedon Sep 11, 2017
but this
docker-compose.ymlsits within addevfolder no? so ddev could basically say: if I find adocker-compose.ymlwithin the root folder, I don't even look at a config.yml or anyddevfolder.good! it shouldn't
mhh but they can also create weird stuff in a config.yml that might create broke stuff (like defining a Docker Image that actually does not do what it should)
6 remaining items
rickmanelius commentedon Apr 3, 2018
At this point, the product has changed focus and is biasing towards stability and reliability instead of attempting to take on an unbounded answer space as a thin wrapper to Docker/Docker-compose. To that end, if a person/team had an arbitrary docker-compose that they wished to stand-up, they could always configure as a default php app and simply copy the additional compose file into the .ddev folder. This could also be done via a simple pre-start copy drush exec-host command to copy from the project root to .ddev/. To that end, closing this longstanding issue out.
Schnitzel commentedon Apr 13, 2018
As discussed during DrupalCon Nashville together with Rick, Kevin, Jam, Tyler and Me. We would like to reopen this issue and support the following:
ddev configfinds an existingdocker-compose.ymlin a repository it checks it's content and if it finds something like:https://github.com/amazeeio/drupal-example/blob/0de18ce1a7310c3193c99f9bcafe002ab13f038e/docker-compose.yml#L3-L5
it know this is a
lagoonproject and symlinks thedocker-compose.ymlfrom the repo into the ddev config folderddev sshmight now work from the beginning, which is acceptable for now. We will figure out over time how we can implement all the fancy systems that ddev has together with the Lagoondocker-compose.ymlfilesrfay commentedon May 4, 2018
ddev startClosing again.
thom8 commentedon Jun 3, 2018
Understand that this issue is contentious but would it be possible to add support for a project type of
customwhich just disables the automatic generation of thedocker-compose.yamland launches whatever is defined in there, allowing for persistent customisations.This can come with a major disclaimer and even be an "officially unsupported feature" but still allow others to extend ddev.
rfay commentedon Jun 3, 2018
@thom8 I think you can override anything with custom docker-compose files, does that do the job for you? You can create any docker-compose.*.yaml that overrides or adds features, and you can specifically override with docker-compose.override.yaml. Only the main file is managed (and recreated on every start) by ddev.
Please let us know what you need that can't be done with that... Thanks!
thom8 commentedon Jun 4, 2018
Looks like I can't easily extend one of the current services by building
FROMthe default image eg.Do you have any ideas how this could be done?
rfay commentedon Jun 4, 2018
If you really, really want to get into the business of building and maintaining your own docker image, then you can either extend ours (Use
FROM drud/nginx-php-fpm-local:v0.19.0and build it, or else fork the contents (especially Dockerfile.in) in containers/nginx-php-fpm-local and usemake containerthere. But it's likely to break when we change the upstream image. Then you would change the image line in your docker override to specify your forked/derived image.We don't build any images in the docker-compose, so that's why it's not going to work for you there.
thom8 commentedon Jun 4, 2018
This would be possible if we had the ability to override the
docker-compose.yamlunderstanding that we would need to manage any upstream conflicts.Extending an image from within the project is far easier than having to build outside and specify the forked image.
And with CI we'll pick this up pretty quickly if there was an upstream conflict.