# Deploy (master only) Runs after the deployment repo is pushed and the image for every arch the host needs is in the registry. 1. Preflight on the host (`ssh -o BatchMode=yes `): `uname -m` matches a published arch; `/srv/` does not exist (if it does, this is an update: go to Update); Traefik is running and the `traefik` network exists; the certificate for `` is in Traefik's acme store or the resolver can issue it; the image pulls (`docker pull :`; if the org is private, log in with a read-only token passed via stdin and `docker logout` afterwards, never leave credentials on the host unless the user asked). 2. Clone: `git clone https://git.bjphoster.com/deployments/.git /srv/` on `main`. For a private repo use a one-shot `-c http.extraHeader="Authorization: token ..."` from a file or env, not stored in `.git/config`, and confirm afterwards that `git remote -v` has no token. 3. Configure: `cp env.example .env`, adjust host-specific values; create the data dirs and the config from the example; generate secrets on the host (`openssl rand -hex 24` or similar), write them only into `.env`/config with mode 600, and store a copy where the user expects it (ask if unknown; never print them in chat unless the user asks). 4. Start: `docker compose pull && docker compose up -d`, then `docker compose ps` and logs until healthy. 5. Verify end to end: from the host or the user's PC (whichever resolves the internal FQDN) `curl -sS -o /dev/null -w '%{http_code} %{ssl_verify_result}\n' https:///`; expect 200 (or the app's auth status) with a valid certificate. Check the app logs the real client IP, not Traefik's, if trusted proxies were configured. 6. Remove any temporary Traefik helper that existed only to pre-issue the certificate (e.g. a `config/issue-cert.yml`) only if the user asked; otherwise mention it. ## Update (stack already deployed) `cd /srv/ && git pull --ff-only`, set `_VERSION=` in `.env`, `docker compose pull && docker compose up -d`, verify as above, then remove the previous image version on the host only if nothing else uses it. ## Native target (profile `full`, host without Docker) If the user asks for a native deploy instead of the container: build with `make build-` in Docker locally, copy the binary and the unit, run `make install` on the host (or replicate its steps), `systemctl enable --now `, verify as above. Confirm with the user first; the default deploy target is the container stack.