ligbox-ops-platform/deploy/vm112-wizard/perf-domains-list-20260625/README.md
Ligbox Spec Hub edffd8b3c0 feat(desk): Serviços IaaS perf, Escopo OPS cards e blocklist UI (Spec 017/018)
Cache VM112/VM122 para lista e detalhe domínio, modal purge com loading animado,
cards Escopo OPS clicáveis (camada + Spec + navegação), blocklist visível na UI,
e documentação nas specs e anais de referência 20260625.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 18:53:57 +00:00

63 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# VM112 — cache `GET /api/admin/domains` (2026-06-25)
**Problema:** Serviços IaaS (Desk) demorava 1016s — `zmprov gad` ~5s por pedido, sem cache.
**Patch:** cache em memória no wizard VM112 + invalidação em cd/dd/purge.
## Ficheiros
| Ficheiro | Destino VM112 |
|----------|----------------|
| `carbonio_cache.py` | `/opt/ligbox-wizard/backend/app/services/` |
| `carbonio.py` | idem |
| `domain_orchestration.py` | idem |
| `infrastructure.py` | idem |
| `admin_domains.py` | `/opt/ligbox-wizard/backend/app/routers/` |
## Deploy
```bash
scp perf-domains-list-20260625/*.py root@10.10.10.112:/tmp/
ssh root@10.10.10.112 '
W=/opt/ligbox-wizard/backend/app
cp /tmp/carbonio_cache.py $W/services/
cp /tmp/carbonio.py $W/services/
cp /tmp/domain_orchestration.py $W/services/
cp /tmp/infrastructure.py $W/services/
cp /tmp/admin_domains.py $W/routers/
systemctl restart ligbox-wizard
'
```
## Env (opcional)
| Variável | Default | Descrição |
|----------|---------|-----------|
| — | `TTL_ALL_DOMAINS=90` | Cache `zmprov gad` (carbonio_cache.py) |
| — | `TTL_ORCH_LIST=60` | Cache lista orquestrada montada |
| Desk `VM112_DOMAINS_CACHE_TTL` | 60 | Cache proxy VM122 |
## Validação
```bash
# 2.º hit lista — deve ser <1s
curl -s -H "X-Api-Key: $KEY" http://10.10.10.112:8090/api/admin/domains | jq '.cached, .cache_age_sec'
# Desk detalhe — purge_blocked para blocklist
curl -s -H "Authorization: Bearer $TOKEN" \
https://api.ops.ligbox.com.br/api/v1/vm112/domains/ligbox.com.br | jq '.purge_blocked'
```
**Documentação:** Spec 017/018 § Performance · anais `docs/anais-referencia/20260625_SERVICOS_IAAS_PERF_UX_ESCOPO.md` · frontend `?v=20260625align1`
```bash
# Lista — 1.º ~56s, 2.º <0.1s
curl -s -H "X-Api-Key: $KEY" http://10.10.10.112:8090/api/admin/domains | jq '.cached, .cache_age_sec, (.domains|length)'
# Detalhe purge modal — 1.º ~16s, 2.º <0.1s
curl -s -H "X-Api-Key: $KEY" http://10.10.10.112:8090/api/admin/domains/diarissima.com | jq '.domain, (.accounts|length), (.infra_status.steps|length)'
```
## Rollback
Restaurar backup ou git anterior em `/opt/ligbox-wizard/backend/app/services/` + `systemctl restart ligbox-wizard`.