Skip to content

Create missing accessories on deploy, never change existing ones #33

Open

Description

@wadewilliams

Context

flow-deploy never touches deploy.role=accessory services (databases, caches): no pulls, no restarts. That's deliberate, because recreating a database container mid-deploy is a data and downtime decision a person should make.

Adding a new accessory, though, currently needs a manual up -d on the host before or after the deploy that introduces it.

Proposal

Adding is fine; changing isn't. On deploy, create an accessory only when no container exists for it, and never touch an existing one:

<compose-command> up -d --no-deps --no-recreate <accessory>

…run only for accessories with no container (running or stopped) in the project. --no-recreate guarantees an existing container is never replaced, even if its config changed.

Open questions:

  • Should a new accessory be health-checked before the deploy continues? (Apps that need it would otherwise start against a database that isn't ready.)
  • Where in the phases: before drain-first services drain, so new code finds it?
  • If creating it fails: fail the deploy (and revert) before any app changes?

Note: accessory drift warning (removed from #31)

#31 briefly had a warn-only drift check. It flagged an accessory whose config had changed since it started (so the next manual up -d would recreate it), using compose's own decision (up -d --dry-run --no-deps <svc> reporting Recreate). It was cut before merge for these reasons:

  • it was warn-only
  • its output parsing depended on the Compose version (v2 prefixes dry-run lines with DRY-RUN MODE -; v5 doesn't)
  • it added a dry-run call per accessory per deploy
  • an earlier config --hash version gave false positives for env_file services, because config --hash and up hash those differently on Compose v5

The root cause it targeted, .env edits recreating accessories, is now handled by documentation: accessories drop env_file and list their variables under environment:. If drift reporting comes back, it fits naturally beside this feature.

Size

Small to medium: about 40–80 lines (find accessories with no container, run the scoped up, optional health wait), plus unit and integration tests. Nothing in #31 is in the way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions