From d1d132c06319a9e0d16e64030c7bcc49678864dd Mon Sep 17 00:00:00 2001 From: Sergei Poljanski Date: Fri, 13 Nov 2026 18:13:55 +0400 Subject: [PATCH] docs: describe monitoring, XMPP certificates and the newer roles The README still listed the roles from before monitoring, the bucket replica, the interop runner and the Traefik-issued XMPP certificates. Add them, explain the certificate flow and where dashboards, retention and alerts live, and note the hand-made Loki bucket in the Terraform README. Assisted-by: Claude:opus-5-5 --- README.md | 98 +++++++++++++++++++++++++++++++++++---------- terraform/README.md | 3 ++ 2 files changed, 79 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index b0e24eb..b755f5d 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,16 @@ Ansible. Pushing to `main` deploys: a Forgejo Actions workflow applies | Server | Size | Runs | |--------|------|------| -| asxpio-ops | 2 vCPU, 4 GB | Traefik, Forgejo, crawler-alert; app stacks deployed from their own repos | -| asxpio-services | 8 vCPU, 16 GB | Forgejo Actions runner, Minecraft (Paper), SillyTavern, XMPP (asxp.io), Xray | +| asxpio-ops | 2 vCPU, 4 GB | Traefik, Forgejo, monitoring, crawler stats; app stacks deployed from their own repos | +| asxpio-services | 8 vCPU, 16 GB | Forgejo Actions runners, Minecraft (Paper), SillyTavern, XMPP (asxp.io), Xray | Both are reachable for administration only over WireGuard (10.20.0.0/24) or the private network (10.10.0.0/20). ## Layout -- `terraform/`: servers, network, firewalls, object storage buckets. +- `terraform/`: servers, network, firewalls, DNS, object storage buckets. + Applied by hand; see `terraform/README.md`. - `ansible/site.yaml`: everything the pipeline manages (see below). - `ansible/playbooks/`: host bootstrap, run by hand. - `.forgejo/workflows/deploy.yaml`: the pipeline. @@ -26,15 +27,21 @@ Both are reachable for administration only over WireGuard | Role | Host | What | |------|------|------| | `base` | both | unattended upgrades, fail2ban, journal size cap, Docker daemon config, weekly image prune | +| `monitoring_agent` | both | node_exporter, cAdvisor and Alloy on the VPC address | | `traefik` | ops | reverse proxy, TLS, dashboard on WireGuard | -| `crawler_alert` | ops | daily and weekly crawler report timers | +| `xmpp_cert_sync` | ops | pushes Traefik's XMPP certificates to ejabberd (see below) | +| `crawler_alert` | ops | crawler reports (daily, weekly) and metrics every 5 min | +| `monitoring` | ops | Prometheus, Loki, Grafana, blackbox and Postgres exporters, alerts | | `forgejo` | ops | Forgejo at git.asxp.io (git.czsk.it is an alias), SSH passthrough | | `forgejo_runner` | services | Actions runner and its job labels | +| `forgejo_runner_interop` | services | runner for another-im/interop on dev.another.im | | `sillytavern` | services | SillyTavern on the WireGuard address | | `minecraft` | services | Paper server | | `xmpp` | services | ejabberd, apushd and tackygram for asxp.io; secrets stay in `/opt/xmpp/state` | +| `acme_forward` | services | port 80: ACME challenges to Traefik on ops, 404 otherwise | | `xray` | services | Xray VLESS Reality on :443, config in the vault | | `restic_backup` | both | nightly restic backup to object storage, hel1 and fsn1 | +| `s3_replicate` | services | daily copy of the hel1 buckets into their fsn1 twins | Not managed here: the app stacks on asxpio-ops (asxpio, datacenterbingo, blog, czsk, vhpbot, storage). Each deploys from its own repository into @@ -44,12 +51,72 @@ blog, czsk, vhpbot, storage). Each deploys from its own repository into 1. Edit the role or variable, for example an image tag in `ansible/inventory/group_vars/` or a compose file under - `ansible/roles//files/`. + `ansible/roles//files/`. Versions are pinned exactly; Renovate + opens a PR per bump. 2. Push a branch. The pipeline does a dry run against production. 3. Merge to `main`. The pipeline dry-runs again, then applies. A run with nothing to change touches nothing and restarts nothing. +Things to know: + +- **Game servers** are saved and stopped with a 120 s timeout before a + compose change recreates them. +- **The runner** executes the pipeline. A change to it recreates the + container mid-job: the change lands, that job is reported as failed, + and the next run confirms it. +- **Forgejo** restarts on a config change; the job log may pause for a + few seconds. +- **New systemd units** don't exist yet during the dry run, so tasks that + enable them use `ignore_errors: "{{ ansible_check_mode }}"`. + +To run it yourself, over WireGuard: + +```sh +cd ansible +ansible-playbook site.yaml --check --diff # dry run +ansible-playbook site.yaml --tags traefik # one service +``` + +## Monitoring + +Grafana is at https://gf.asxp.io, reachable over WireGuard and the VPC +only. Dashboards are provisioned from +`ansible/roles/monitoring/files/dashboards/` and can't be saved from the +UI: change the JSON and deploy. The overview is the home dashboard. + +- **Metrics:** Prometheus scrapes both hosts over the VPC and keeps 90 + days. Scripts add metrics through node_exporter's textfile directory + (`monitoring_textfile_dir`). +- **Logs:** Alloy ships the journal and container logs to Loki, kept 2 + years. From 2026-11-14 chunks go to bucket `asxpio-loki-main` (hel1); + older ones stay on disk until they expire. +- **Probes:** blackbox_exporter checks the sites and the TCP/TLS services + from outside (`monitoring_probes`). +- **Alerts** mail `monitoring_alert_email`. Rules are in + `templates/alert-rules.yaml.j2`. + +Settings: `ansible/inventory/group_vars/all/monitoring.yaml`. + +## XMPP certificates + +Traefik issues them; ejabberd on services only loads files. + +1. The router `xmpp-cert` in Traefik's dynamic config requests + xmpp.asxp.io + conference.asxp.io. The HTTP challenge reaches services + (where those names point), and `acme_forward` passes it to ops. + asxp.io itself is the site's certificate: Traefik never requests a + name it already holds. +2. `xmpp-cert-sync.path` on ops fires when `acme.json` changes (and a + timer daily). It pushes both certificates over SSH with a key that + only runs `xmpp-cert-install`, from ops' VPC address. +3. `xmpp-cert-install` checks name, expiry and key, writes + `/opt/xmpp/state/certs/.pem` and reloads ejabberd, which picks + a file per domain. + +Alerts: sync not successful for 2 days; served certificate older than +Traefik's for 6 hours; expiry under 14 days. Names: `xmpp_cert.yaml`. + ## Backups Hetzner's server backups are off. Each host runs `restic-backup.timer` @@ -67,23 +134,10 @@ restic-backup fsn1 restore latest --target /tmp/restore --include /opt/xmpp The password is `vault_restic_password` in the vault. Keep a copy outside the servers and this repo's CI: without it nothing can be read. -Things to know: - -- **Game servers** are saved and stopped with a 120 s timeout before a - compose change recreates them. -- **The runner** executes the pipeline. A change to it recreates the - container mid-job: the change lands, that job is reported as failed, - and the next run confirms it. -- **Forgejo** restarts on a config change; the job log may pause for a - few seconds. - -To run it yourself, over WireGuard: - -```sh -cd ansible -ansible-playbook site.yaml --check --diff # dry run -ansible-playbook site.yaml --tags traefik # one service -``` +`s3_replicate` copies `asxpio-backups-main` (minus `restic/`), +`asxpio-terraform-main` and `k8s-asxpio-main` to their fsn1 twins daily +around 06:10 UTC. A run that would delete over 1000 objects stops and +mails instead. ## Secrets diff --git a/terraform/README.md b/terraform/README.md index 072ac06..abc1138 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -26,6 +26,9 @@ day-to-day configuration is in `../ansible`. - asxpio-backups-main (hel1) - asxpio-backups-repl (fsn1) +**Logs:** +- asxpio-loki-main (hel1): Loki chunks; created by hand, not in Terraform + ## DNS