basforge

Search titles, text and the “If it doesn’t work” cases.

    RU

    The secret file comes before up -d

    Put the secret file in place first, then change compose. With secrets: … file: /srv/secrets/…, compose doesn’t create the container if the file is missing.

    Why the order matters

    A new secret path reaches the server with git pull. If git pull ran before the file was moved, any up -d leaves the service down. For Traefik that’s every site at once.

    So put the file in place beforehand, and run git pull and up -d as one command:

    wc -c < /srv/secrets/traefik/cf_api_token                            # not 0 — the file is there
    cd /opt && git pull && cd /opt/traefik && docker compose up -d

    How to move a secret into a file without showing it on screen — Secrets in Docker stacks.

    If it doesn’t work

    After git pull and up -d, Traefik didn’t come up and every site is down

    Cause
    Compose got a new secret path, but there’s no file there yet — compose doesn’t create the container.
    Fix
    Put the secret file at the new path and run docker compose up -d again.