Skip to content

Deploy services by dependency tree order instead of lexicographical order #1

@vladkucherov

Description

@vladkucherov

Hey,

The documentation states:

Services are updated in lexicographical order (by Unicode code point),
regardless of dependencies.

I see this is intentional, but could you please add an ability to deploy containers by dependency order.

For example, for the following docker-compose file:

services:
  website-frontend-react:
    ...
  website-backend-tasks:
    ...
  website-backend-service:
    ...
    deploy:
      replicas: 2
      update_config:
        parallelism: 1
        order: start-first
        failure_action: rollback
        delay: 20s
    depends_on:
      - website-backend-tasks

The deploy order if in lexicographic order would be:

  1. website-frontend-react
  2. website-backend-service
  3. website-backend-tasks

In my case, it's an issue because the thing website-backend-tasks do is run db migrations. So it prepares the DB before the new website-backend-service can boot, because if it would boot before the migrations, it would run on new queries but the db is not prepared.

Also, as a side effect of the new website-backend-service container running new queries without migrations, it's not healthy, so the deployment fails, which prevents it from continuing to the next service, which in my case is the one they would fix everything, but the deployment stopped.

So without Kerek considering the depends_on, it's harder to make it work with this kind of architecture.

Can someone please add this ability?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions