tilt-dev / tilt-dev/tilt

Respect depends_on conditions from docker-compose

Open
#2,239 5 comments 13 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
10.1k
Forks
413
Avg merge
1d 10h
Merged PRs (30d)
6

Description

For reference, this issue was raised in #2210.

When using a docker compose file with one or more depends_on including conditions service_healthy, tilt does not check those conditions.

depends_on is a condition added in v2, and in v2.1 a condition service_healthy was added to it.

Example configuration:

services:
  myServiceA:
    extends:
      file: docker-compose.base.yml
      service: myServiceA_base
    depends_on:
      mariadb:
        condition: **service_healthy**
      mongodb:
        condition: **service_healthy**
      myServiceB:
        condition: service_started
    command: ["npm", "run", "dev"]

  mariadb:
    image: mariadb:10.1.30
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
      timeout: 20s
      retries: 10

  mongodb:
    image: mongo:4.0
    healthcheck:
      test: echo 'db.runCommand("ping").ok' | mongo mongodb:27017/test --quiet
      interval: 10s
      timeout: 10s
      retries: 5

  myServiceB:
    extends:
      file: docker-compose.base.yml
      service: myServiceB_base
    depends_on:
      mariadb:
        condition: **service_healthy**
      mongodb:
        condition: **service_healthy**
    command: ["npm", "run", "dev"]

With this configuration, mariadb and mongodb should be started first, then myServiceB and at last myServiceA.

Tilt is not respecting this, as it is not checking the service_healthy conditions.

In docker compose v3 format, depends_on condition was removed altogether, but many companies are still using it, specially the ones that don't make use of Docker Swarm, so I think this should be supported by Tilt.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the Docker Compose example in the report, focusing on services using depends_on with service_healthy and service_started conditions. Trace Tilt's Docker Compose dependency handling and add or run coverage for the reported ordering. Done means dependent services start only after their configured conditions are met.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, go
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.