Skip to content

deploy.sh: compose run migrate swallows the rest of the remote script via stdin #1

Description

@MauriceDellin

What happens

scripts/deploy.sh (tag 0.25.0) sends the remote script to bash -s via an ssh heredoc — the script arrives on stdin. When a stateful app declares a migrate service (§ 6.2 PLX), the line

IMAGE="$IMAGE" dc run --rm migrate

runs docker compose run without -T, so compose attaches the container to stdin and consumes the remainder of the heredoc. After the migrate container exits, bash reads EOF: dc up -d web, the health poll, and the rollback logic are never executed, and the job exits 0 — a silent no-op deploy that reports success.

Stateless apps (no migrate service) are unaffected, which is probably why this never showed up on plexus-ms.org itself. We hit it on the first stateful-app deploy of tenant medocs: CI green, migrations applied, but no web container was ever created (the old release — or nothing, on a first deploy — keeps “serving”).

Fix

Detach stdin from the migrate run:

IMAGE="$IMAGE" dc run -T --rm migrate

(or </dev/null). -T also matches the non-interactive semantics the verb wants everywhere.

Repro

Any app whose compose.yaml declares a migrate service with profiles: ["migrate"]; run the deploy verb via CI or ssh-heredoc and observe the log stops right after the migrate output, with exit 0 and no up/healthcheck lines.

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