Operations & Runbooks¶
Operational playbooks for CloudXM's platform. Start here when something breaks. All services follow the same deploy and incident flow unless a product page says otherwise.
Environments¶
| Environment | Where | Branch |
|---|---|---|
| Production | VPS prd1 (services) / Cloudflare Pages (sites) | main |
| Staging | VPS prd1, offset ports / Pages previews | feature branches / MRs |
| Sandbox | VPS prd1 (ShopXM/NFSe only) | manual |
Deployment¶
flowchart LR
MR[Merge Request] -->|review + pipeline preview| MAIN[merge to main]
MAIN --> GL[GitLab CI]
GL -->|static sites| PAGES[wrangler pages deploy]
GL -->|services| SSH[ssh deploy@prd1]
PAGES --> CF[Cloudflare Pages]
SSH --> DOCKER[docker compose / rsync + artisan] Deploying a static site (Pages)¶
- Pushes to
maindeploy to production automatically (GitLab CI →wrangler pages deploy --branch main). - Merge requests get preview deployments (
<hash>.cloudxm-wiki.pages.dev), protected by Cloudflare Access. - Never run
wrangler deploy(no--branch) as a preview command — it overwrites production.
Deploying a service (VPS)¶
- The app repo's CI connects as the
deployuser (group-levelPROD_SSH_KEY). - rsync code / build image →
docker compose -p <project> up -d(or rsync + artisan for PHP-FPM apps). - Healthcheck must fail the pipeline if the service is down after deploy.
Backups¶
| What | How | Where |
|---|---|---|
| PostgreSQL databases | pg_dump daily (cron) + pre-deploy | /opt/backups/ on prd1 |
| Config (nginx, PHP, cron) | cloudxm-infra repo is source of truth | git |
| Secrets | GitLab CI variables (masked) | GitLab |
Restore discipline
Test restores periodically. A backup you cannot restore is not a backup.
Incident response¶
- Detect — monitoring/healthchecks, client report, or manual check.
- Triage — is it an edge (Cloudflare) or origin (VPS) problem?
curl -sI https://<domain>/and check DNS/SSL first. - Communicate — post in the team channel; keep a timeline.
- Mitigate — rollback is faster than forward-fixing for deploys (redeploy previous release / revert MR).
- Recover — restore from backup if data is involved (test in staging first).
- Review — add the root cause to the runbooks; update this wiki.
Quick triage commands¶
# Edge vs origin
curl -sI https://convert.cloudxm.com.br/health | head -5
# VPS reachability
for port in 22 80 443; do
timeout 3 bash -c "echo > /dev/tcp/2.24.212.12/$port" 2>&1 && echo "$port OPEN" || echo "$port CLOSED"
done
# Service health (on VPS)
docker ps --format "table {{.Names}}\t{{.Status}}"
systemctl status nginx php8.2-fpm postgresql 2>&1 | head -20
Access management¶
| Resource | Grant via | Revoke via |
|---|---|---|
| Wiki (this site) | Cloudflare Access policy (Google Workspace group cloudxm-employees) | Remove from Google group |
GitLab emcloud | GitLab members | GitLab members |
| VPS prd1 | SSH keys in authorized_keys (per-user) | Remove key |
Offboarding
When someone leaves: revoke Google Workspace access first (it cascades to wiki + e-mail), then GitLab, then VPS keys. See Onboarding for the access map.
Maintenance windows¶
- Prefer low-traffic hours (BR evenings) for breaking changes.
- Announce maintenance in the team channel at least 24h ahead.
Runbook index¶
| Runbook | Where |
|---|---|
| This wiki deploy/incident flow | this page |
| SupraMax search index recovery | SupraMax product page |
| VPS provisioning & recovery | cloudxm-infra repo |
| [TODO: add per-service runbooks as they are written] | — |