2.5 KiB
2.5 KiB
Deploy (master only)
Runs after the deployment repo is pushed and the image for every arch the host needs is in the registry.
- Preflight on the host (
ssh -o BatchMode=yes <host>):uname -mmatches a published arch;/srv/<fqdn>does not exist (if it does, this is an update: go to Update); Traefik is running and thetraefiknetwork exists; the certificate for<fqdn>is in Traefik's acme store or the resolver can issue it; the image pulls (docker pull <image>:<version>; if the org is private, log in with a read-only token passed via stdin anddocker logoutafterwards, never leave credentials on the host unless the user asked). - Clone:
git clone https://git.bjphoster.com/deployments/<name>.git /srv/<fqdn>onmain. 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 thatgit remote -vhas no token. - 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 24or 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). - Start:
docker compose pull && docker compose up -d, thendocker compose psand logs until healthy. - 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://<fqdn>/<health path>; 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. - 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/<fqdn> && git pull --ff-only, set <NAME>_VERSION=<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-<arch> in Docker locally, copy the binary and the unit, run make install on the host (or replicate its steps), systemctl enable --now <name>, verify as above. Confirm with the user first; the default deploy target is the container stack.