feat: add ship release and deploy skill

This commit is contained in:
bryanpedini committed 2026-11-21 18:38:15 +01:00
1 parent 3d7e3adea1
commit a9087b29f4
6 files changed
+216

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
# 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 <host>`): `uname -m` matches a published arch; `/srv/<fqdn>` does not exist (if it does, this is an update: go to Update); Traefik is running and the `traefik` network 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 and `docker logout` afterwards, never leave credentials on the host unless the user asked).
2. Clone: `git clone https://git.bjphoster.com/deployments/<name>.git /srv/<fqdn>` 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://<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.
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/<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.