feat(deploy): version.json generation, webhook promote, verify (BIT-468)
Align LXC deploy with BIT-465: write-version-json.sh, optional webhook-deploy.sh, verify.sh fails when ER_VERSION_JSON_PATH is set but missing/invalid, env.example + nginx sketch + runbook updates. Ignore deploy/lxc/runtime/ (generated on server).
This commit is contained in:
1 parent
e17acc983c
commit
c02c300dc3
8 files changed
+185
-2
No files matched your search
@@ -145,6 +145,21 @@ systemctl status bitreport-error-reporting-ingest-api.service
|
||||
journalctl -u bitreport-error-reporting-ingest-api.service -f
|
||||
```
|
||||
|
||||
### 10.1 `version.json` (BIT-465)
|
||||
|
||||
Gerar metadados de build/commit após cada `git pull` / promote (ficheiro **não** vai para o Git — `deploy/lxc/runtime/` está em `.gitignore`):
|
||||
|
||||
```bash
|
||||
set -a
|
||||
source /etc/error-reporting/env
|
||||
set +a
|
||||
/opt/errors.bitreport.pt/deploy/lxc/write-version-json.sh
|
||||
```
|
||||
|
||||
Com `ER_VERSION_JSON_PATH` definido no env (ver `deploy/lxc/env.example`), o `verify.sh` **falha** se o JSON estiver ausente ou não cumprir o schema mínimo (`project`, `commit`, `branch`, `builtAt`, `builtBy`). Fluxo completo de exemplo após push no Gitea: `deploy/lxc/webhook-deploy.sh` (ajustar ramo, utilizador e `systemctl` ao teu host).
|
||||
|
||||
Para `https://errors.bitreport.pt/version.json` sem VPN, configurar o proxy (Nginx ou NPM *Advanced*) com `location = /version.json` a servir o ficheiro no disco — ver comentário em `deploy/lxc/nginx/bitreport-error-reporting.site.conf.example`.
|
||||
|
||||
## 11. Fixture HTTP de demo (opcional)
|
||||
|
||||
No Compose, o worker usa um contentor nginx com `collector-worker/fixture/errors.json`. Em LXC nativo, para reproduzir o cenário de poll HTTP:
|
||||
@@ -233,7 +248,8 @@ Se o domínio estiver atrás de **Cloudflare** e o utilizador vir **525 SSL hand
|
||||
| 1 | No LXC: `/opt/errors.bitreport.pt/deploy/lxc/verify.sh` | Sucesso local (`ingest` `/health` HTTP **200**) |
|
||||
| 2 | `curl -sS -o /dev/null -w '%{http_code}\n' https://ingest.<hostname-acordado>/health` | **200** |
|
||||
| 3 | `curl -sS -o /dev/null -w '%{http_code}\n' https://errors.bitreport.pt/` | **200** ou redireccionamento esperado da UI |
|
||||
| 4 | Browser | Smoke de login / navegação na admin UI |
|
||||
| 4 | `curl -fsS https://errors.bitreport.pt/version.json` (após configurar *location* estático no proxy) | **200**, JSON com `commit` alinhado ao deploy |
|
||||
| 5 | Browser | Smoke de login / navegação na admin UI |
|
||||
|
||||
**Nota:** tráfego público pode mostrar `server: cloudflare`; a origem continua **NPM → LXC da stack**. Até TLS/DNS estarem correctos, `curl` externo pode responder **525** — usar a tabela acima como critério após go-live.
|
||||
|
||||
@@ -244,6 +260,7 @@ Se o domínio estiver atrás de **Cloudflare** e o utilizador vir **525 SSL hand
|
||||
| Env exemplo | `deploy/lxc/env.example` |
|
||||
| Migrações + seed | `deploy/lxc/run-migrate.sh` |
|
||||
| Smoke test | `deploy/lxc/verify.sh` |
|
||||
| `version.json` + promote webhook | `deploy/lxc/write-version-json.sh`, `deploy/lxc/webhook-deploy.sh` |
|
||||
| Units systemd | `deploy/lxc/systemd/` |
|
||||
| Nginx exemplo | `deploy/lxc/nginx/` |
|
||||
| Acesso público (NPM/DNS) | Este documento — §14 |
|
||||
Reference in new issue
Block a user