-
Notifications
You must be signed in to change notification settings - Fork 310
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
support docker-compose configs from multiple directories #5170
Comments
re: "Maybe this should actually be a bug instead of a feature request? Except we're matching the underlying DC behavior," ya, there was a fairly long discussion on this when we first added support for https://github.com/compose-spec/compose-spec/blob/master/spec.md#compose-file
Seems reasonable to add support for independent docker-compose apps; it's just something we punted on |
We'd find this feature super useful as we have several docker compose projects we want to manage at once with Tilt, but they have clashing configs (default network name overrides) that cannot be combined. This is what I wanted to write:
Without Tilt, these must be run as:
but it looks like Tilt is trying to do |
Has anyone found a decent workaround for this? Would it be possible to implement a custom docker_compose function in tilt/starlink that would support this by not combining all docker-compose files, even when called in separate docker_compose calls? |
Currently the backend supports this. i think it just needs to be threaded through the tiltfile api. I think part of the problem here is that, in the interviews with compose users that I've done, MOST people don't deeply understand how compose-file overrides work. Some people don't use them at all, some people use them a lot, and some people use them accidentally (when what they really want is multiple compose projects). One of the downsides of the current tiltfile API for docker-compose is that it's hard to come up with an API that fits what all 3 groups expect. One API I considered was something like:
where the presence of the alternatively, something like:
where the presence of i could also imagine trying to infer from the compose file itself whether it's an override file or a project file. That might be a can of worms though, maybe @milas or @nicksieger have thoughts on this idea (since they are now compose maintainers) |
Thanks for the info. I really like the idea of Alternatively, a backwards compatible way would be a new parameter that tells For anyone else that's run into this, I did start work on a tilt extension to create an alternate to |
I think trying to infer overrides by looking at files is going to be tricky without knowing how the developer wants the files to be applied. The fact that Tilt lumps multiple files into a single project regardless of the number of I do like the idea of introducing a @mcreenan can you say a little more about your setup where you do want separated compose projects (and everything that goes with them, notably, separate networks to which the project containers are attached)? |
@nicksieger Right now we just use the default network for each docker compose projects. I will be looking into making them share a network, but that's much less important. The short of it is:
So we want to be able to run the monolith app and multiple microservice apps in parallel with one control plane. |
Ok, that setup makes sense. So what is it about Tilt's current behavior that merges multiple docker compose statements and/or files into a single project that's problematic? Is it the use of relative paths in each compose file that gets broken when merging? |
@nicksieger Tilt won't even allow it, as it throws an error when you try to use See tilt/internal/tiltfile/docker_compose.go Lines 68 to 73 in 5d444b8
|
Fixes tilt-dev#5170. Signed-off-by: Nick Sieger <nick@nicksieger.com>
Fixes tilt-dev#5170. Signed-off-by: Nick Sieger <nick@nicksieger.com>
Fixes tilt-dev#5170. Signed-off-by: Nick Sieger <nick@nicksieger.com>
Fixes tilt-dev#5170. Signed-off-by: Nick Sieger <nick@nicksieger.com>
Fixes tilt-dev#5170. Signed-off-by: Nick Sieger <nick@nicksieger.com>
Fixes tilt-dev#5170. Signed-off-by: Nick Sieger <nick@nicksieger.com>
Fixes tilt-dev#5170. Signed-off-by: Nick Sieger <nick@nicksieger.com>
I think this mostly is solved. One small issue I've encountered so far with microservices via docker-compose is that you can have containers with the same name in different repos. But you will get an error for resource already existing.
|
There's a new argument to |
@nicksieger how would this look like? |
@Wulfheart for example, if you have two compose files docker_compose('a.yaml', project_name='a')
dc_resource('foo', project_name='a', new_name='a-foo')
docker_compose('b.yaml', project_name='b')
# This second one is not necessary for disambiguation, it just adds the prefix for consistency
dc_resource('foo', project_name='b', new_name='b-foo') |
Describe the Feature You Want
The ability to compose multiple docker-compose files from different projects, e.g.
docker_compose(['proj1/docker-compose.yaml', 'proj2/docker-compose.yaml'])
Current Behavior
We infer the DC project directory from the first config provided and then use that for all other DC configs.
This means, e.g., paths in
proj2
are interpreted relative toproj1
, even though they are likely written to be interpreted relative toproj2
.Why Do You Want This?
Onboarding to Tilt and wanting to run multiple DC projects at once
Notes
The text was updated successfully, but these errors were encountered: