Open nicks opened 4 years ago
This repro case is helpful: https://github.com/Yolk-HQ/tilt-demo/tree/a9c969fe1c27c975ae5fcd73c627b29dc26e5446
A simple workaround for now is to read in the docker compose file, loop over the services and manually specify dc_resource
with resource_deps
.
docker_compose('./docker-compose.yml')
# Read the docker compose yaml file and convert into Starlark object
yml = read_yaml('./docker-compose.yml')
# Get the services dict
services = yml.get('services')
# Loop over each service and manually configure the service with `dc_resource`,
# specifying the same name from the compose file, and using the `depends_on`
# key for the service in the compose file to configure the `resource_deps`
for name in services:
dc_resource(name, resource_deps=services.get(name).get('depends_on', []))
it also might make sense to have tilt automatically configure the resource_deps when it sees a depend_on...there's been more interest recently in formally specifying the docker-compose config format, which might help us iron out the mismatches between the two deps models.
Suppose you have a docker-compose.yml file where
backend
has adepends_on: postgres
.If you start tilt as
Tilt will not start postgres.
However, if you add
dc_resource('backend', resource_deps=['postgres'])
to your Tiltfile, it will start postgres.I'm not sure if these behaviors should be consistent or not. I think there are a couple subtle mismatches between docker-compose depends_on and Tilt's resource_deps.
For now, you can workaround this by adding the
dc_resource
config