# Infra: sites, databases, buckets, domains, servers

The **Infra page** answers "where is what, and is it working?": every site, database, bucket, domain and server -
on this server, on your other servers, on Cloudflare and on Hostinger - with its status, its links (this domain ->
this server -> this site -> this app -> this repository) and the Harness project it belongs to.

It is **off by default**: turn it on in **Settings -> Features -> Infra**. An **Infra** entry appears in the
sidebar (shortcut G then I).

## How it works

1. **Harness reads everything**: this server directly, your other servers over SSH (read-only), Cloudflare and
   Hostinger with their API keys. It links what it finds: a domain to its site, a site to its app, its database and
   its git repository.
2. **It watches it for you**: every address is checked (does it answer, is its certificate valid), so are domain
   expiry dates and disk space, every 15 minutes (`infra_refresh_min`) or when you click **Refresh**. A problem goes
   to the top of the page and to your notifications, once per incident.
3. **You create by asking Claude**: "put this folder online", "create a database for my app"... Claude follows the
   standard recipes (below) and the result appears on the page.

The page itself never changes your sites or databases; the only thing it does on its own is connecting a server
(see [Other servers](#other-servers)). To change something, ask Claude: each line has an **Ask Claude** box.

## The page

A list in the second bar next to the sidebar (see [Sessions](sessions.md#layout); under **☰** at the top left on a phone)
starts with **Overview** and **To look at**, then lists **what you host** - Sites, Databases, Buckets, Domains, E-mail -
with how many of each and what is down, then **where it runs**: Servers & services. Search, filter by project and
show hidden lines (eye button) on every tab except E-mail.

- **Overview**: a "How it works" box (with a link to this page) (close it with ×, bring it back with **How it works**
  at the top right), the list **To look at**, a table **Where everything runs** (one line per type, one column per
  place: this server, your other servers, then each service such as Cloudflare or Vercel; a number opens that type
  filtered on that place), and **What Harness reads**: each source with what it gives and, when something is
  missing, the next step (**Add the key ...**, **Add these rights** for a Cloudflare token that cannot read
  everything, **Connect** for a VPS not read yet).
- **To look at**: everything down or to check, in one list.
- **Sites, Databases, Buckets, Domains**: one block per place, **your servers** first (this server, then the others),
  then **hosted elsewhere** (Cloudflare, Vercel, Supabase...). A thin bar under the title shows how the type is
  spread across places; the chips above the blocks show a single place. A domain counts where it points: the place
  of the site it serves, otherwise its host, otherwise "Points nowhere". **Domains -> Add a domain** watches a domain
  from any registrar.
- **Servers & services**: one card per server with its address, its system, memory / disk / CPU in use and how many
  sites, databases and buckets run on it, then what Harness reads.
- **E-mail**: where your addresses come from (see [E-mail](#e-mail) below).
- Click any line to open its page, in place of the list (the arrow at the top left goes back). Every type has the
  same blocks: **Details** (its addresses with the result of their checks, then what Harness knows about it), **Manage**
  (what you can do on it from here: a Docker app, a connected server, a domain you added), **Linked to**, **Organize**
  (project, note, hide) and **Ask Claude**. Above them: its name, its status and the buttons that leave Harness:
  **Open**, its repository (Git page), its Cloudflare / Hostinger dashboard.
- **Presentation mode** (eye at the bottom of the sidebar, or Shift+P) blurs names, addresses, server names, projects, details
  and notes on this page too.

## What it reads

| Source | What you see | Needs |
|---|---|---|
| This server | Caddy (or nginx) sites and what is behind each one (folder, app port, systemd service, Docker container, git repository), PostgreSQL / MySQL databases (also inside Docker), SQLite files, Garage buckets, disk, memory | nothing |
| Your other servers | the same, read over SSH | `python3` there and SSH access: see [Other servers](#other-servers) |
| Any domain | registrar and expiry date (public RDAP service), who serves its DNS (OVH, GoDaddy, Namecheap, IONOS, Gandi, o2switch...), who hosts its address (one of your servers, Vercel, Netlify, GitHub Pages, Shopify, Cloudflare, Webflow, Wix, Squarespace...) | nothing (public DNS); add the domains no provider lists in **Domains -> Add a domain** |
| Cloudflare | domains (zones) and their DNS, Workers and their addresses, Pages, R2 buckets and their public addresses, D1 databases, Registrar domains | the key `CLOUDFLARE_API_TOKEN` (+ `CLOUDFLARE_ACCOUNT_ID`) |
| Hostinger | domains with their expiry date, VPS, DNS zones | the key `HOSTINGER_API_TOKEN` |
| Vercel *(beta)* | projects with their production deployment (state, date, git repository, framework), their domains; domains bought at Vercel with their expiry date; every team the token sees | the key `VERCEL_TOKEN` |
| Netlify *(beta)* | sites with their last deployment and git repository, Netlify DNS zones | the key `NETLIFY_AUTH_TOKEN` |
| Supabase *(beta)* | each project: its database (state, region, Postgres version; a paused free project shows "paused"), its Storage buckets, its Edge Functions, linked together | the key `SUPABASE_ACCESS_TOKEN` |
| GitHub Pages *(beta)* | the Pages sites of your repositories, their address and build state | the GitHub tokens already in your keys (Git page) |

Keys go in **Settings -> Keys** (the Infra page links to them). Harness only **reads** with them. Give read rights
where the provider allows it (Cloudflare, GitHub); Vercel, Netlify and Supabase tokens cannot be limited to reading:
leave them **not exposed** to sessions (the default in Keys) so only the Infra page uses them. A token without one of
the rights only hides that part: the page says which.

The public DNS lookups go through a public resolver over HTTPS (Cloudflare's 1.1.1.1 by default): it sees the domain
names asked, nothing else. Each name is looked up at most every 6 hours.

### Creating the keys

- **Cloudflare**: [dash.cloudflare.com/profile/api-tokens](https://dash.cloudflare.com/profile/api-tokens) ->
  Create token -> Custom, rights (Read): Zone, DNS, Workers Scripts, Workers Routes, Cloudflare Pages, Workers R2
  Storage, D1, Registrar; add **DNS Edit** if you want Claude to create DNS records for new sites.
- **Hostinger**: hPanel -> Profile -> API -> new token.
- **Vercel**: [vercel.com/account/settings/tokens](https://vercel.com/account/settings/tokens) -> Create token, scope
  "Full account" to see every team (Vercel has no read-only token: Harness only reads).
- **Netlify**: User settings -> Applications -> Personal access tokens -> New access token.
- **Supabase**: [supabase.com/dashboard/account/tokens](https://supabase.com/dashboard/account/tokens) -> Generate
  new token.
- **GitHub Pages**: nothing more if the Git page already shows your repositories.

*Beta* means written from the provider's official API reference and tested against its documented answers, not yet
seen on a real account: if a line shows an error, ask Claude from that line (it sees the error) and tell us.

### My provider is not listed

- **Domains**: nothing is needed. Add the domain in **Domains -> Add a domain** (or ask Claude "watch the domain
  example.com"): its registrar, expiry date, DNS provider and host are read from public information, and it is
  linked to your server when it points to it. Alerts before expiry work the same.
- **A server** (OVH, DigitalOcean, Hetzner, Scaleway...): **Add a server**, it is read over SSH like any other.
- **A platform** (Render, Railway, Fly.io, Firebase, AWS...): its sites still show through their domains (the page
  says who hosts each address). Full support is planned provider by provider.

## Other servers

- **A Hostinger VPS** shows up by itself once the Hostinger key is in the vault, named **VPS Hostinger**. If it
  already accepts an SSH key of this server, Harness connects it on its own (the Hostinger API says which key, so
  nothing is tried blindly). Otherwise open it and click **Connect**: Harness adds its own key
  (`harness-maxxing@<this server>`) to the VPS' `root` account through your Hostinger key, then reads it. That is the
  only change the Infra page makes on a provider; you can remove the key in hPanel -> VPS -> SSH keys.
- **Any other server**: **Add a server** (top of the page) with its address, SSH user and port. If none of this
  server's keys is accepted there, the window gives you one line to run on that server, then **Try again**.
- On the page of a connected server (block **Manage**): change the **name shown** (the internal name, used in links, never changes) or
  **Disconnect** it (nothing changes on the server).
- From the terminal: `maxxing infra server connect <IP or Hostinger VPS id>`, `server rename NAME "Label"`.

Harness only reads the other servers (sites, ports and services, Docker, databases, buckets, disk, memory). The
server needs `python3` (every usual Linux has it).

### Run a topic on another server

A topic can run its sessions on one of these servers (off by default): a GPU machine, a client's server, wherever the
files are. In Sessions, the topic's **⋯** menu -> **Run on a server** (Infra page on): choose the server and the
folder there, **Test**, **Save**. Its sessions and scheduled jobs then run Claude Code on that server, in that folder,
over SSH; you follow and steer them here as usual (answers, tools, stop, steer). The topic's memory stays here and
goes with each turn.

- The server needs **Claude Code** (`claude`) and `python3`. It uses its own Claude sign-in; tick **Send my Claude
  sign-in** to use this server's instead (sent for the turn only, never written there). No other key of the vault is
  ever sent.
- Only Claude Code, in **Full access** or **Accept edits**: the sandbox, asking before actions, the browser and the
  devices live on this server, so a topic set to them is refused with the reason (never run with less protection).
  Agents always run on this server.
- From the terminal: `maxxing infra remote TOPIC SERVER FOLDER [--credentials]`, `--check`, `--off`.

## Statuses

- **OK** (green), **To check** (orange): a page answering 404, a certificate or a domain expiring soon, a DNS record
  pointing to another server than the one serving the site, a disk almost full, a failed backup...
- **Down** (red): no answer, a server error (5xx), an expired domain, a resource created by a recipe that cannot be
  found any more.

**Alerts** go to the notifications feed (and Telegram when its feed thread is on): a site or a server going down
and back up, a certificate expiring within 14 days, a domain expiring within 30 then 7 days (when not
auto-renewed).

## Create things on this server

Ask Claude in plain words; it follows a fixed recipe (skill `maxxing-infra`, command `maxxing infra`) so everything
is done the same way, checked before it is applied, and appears on the page:

- **"Put this folder online"** -> `https://<your Harness address>/<name>/`, at once, no DNS. These pages run
  **isolated** (sandboxed): they can never touch Harness or your session (an app behind such a path never receives
  your Harness cookie and cannot set one; hidden files like `.env` or `.git` are never served; the workspace root,
  the code, the state folder and `.ssh` cannot be published). Perfect for pages, demos, reports, static
  sites. An app with a login, a cart or cookies needs its **own address** (`shop.example.com`): Claude advises it,
  and creates the DNS record on Cloudflare when the key allows it.
- **"Create a database for my app"** -> PostgreSQL (installed the first time, reachable from this server only), one
  database and one user per app, its address stored in **Keys** (`DB_<NAME>_URL`), **backed up every night**
  (job "Infra: database backups", 7 copies kept in `/var/backups/maxxing-db`).
- **"Create a bucket"** -> S3 storage on this server (Garage), its keys in **Keys** (`S3_<NAME>_...`), optionally
  public at `https://<your Harness address>/<name>/`. Files stay on this disk: for big public files Cloudflare R2 is
  often better, Claude says so.
- **"Install Uptime Kuma"** (or n8n, Umami, Vaultwarden, any open source app published as a Docker image) ->
  Claude reads the app's official docs and writes its compose file; Harness checks it against fixed rules before
  anything runs, puts it in `/srv/apps/<name>/` and starts it, then gives it its own HTTPS address (see
  [Docker apps](#docker-apps)). Docker is installed the first time, after you say yes.
- **"Add my other server 203.0.113.7"** -> Claude connects it (`maxxing infra server connect`); if it does not
  accept a key of this server yet, Claude tells you the line to run there.

## Docker apps

The **Docker** section lists every container of this server (and of your other servers), grouped by app (one compose
project = one app), with its state, its image and the memory it uses. An app installed by Harness
(`maxxing infra app add`) also gets buttons in the **Manage** block of its page:

- **Start**, **Stop**, **Restart**, and **Logs** (the last lines, shown in the page and refreshed while they are open);
- **Create a page**: the app shows inside Harness, as a page of the sidebar (an extension named `app-<name>`, which you
  can pin, rename or remove like any other). Harness tells the app's address that Harness may show it. Some apps still
  refuse to be shown inside another page, and a sign-in inside the page only works when the app and Harness share the
  same domain (`kuma.example.com` and `ui.example.com`): the page always has an **Open in a tab** button.

The rules every app follows (Claude adapts the app's own compose file to them, the check refuses what breaks them):

- **No port open to the internet**: the app listens on `127.0.0.1` only; it is reached through its HTTPS address
  (Caddy). This holds even though Docker bypasses the `ufw` firewall.
- **Its own folder**: `/srv/apps/<name>/compose.yaml`, `.env` (secrets, readable by root only, also kept in Keys as
  `APP_<NAME>_...`) and `data/` for everything the app stores. No hidden Docker volume: backing up or removing an app is
  a plain folder.
- **Pinned versions** (no `latest`), **a memory limit** (512 MB unless the app needs more), restarted after a reboot.
- **No access to the rest of the server**: no host network, no privileged container, no devices, no system folder,
  and not the Docker socket unless you agree (`--allow-socket`: it gives the app full control of the server).

Removing an app (`maxxing infra app remove NAME`) stops it and removes its address and its page; its folder stays
until you ask for `--purge`. Containers that Harness did not install are shown read-only: ask Claude to take one over
the standard way to get the buttons.

## In conversations

When Claude talks about resources, it adds a small `infra` block that the app shows live (status, link to the page):

````
```infra
site: shop.example.com
database: shop
```
````

Lines: `site`, `database`, `bucket`, `domain`, `server`, `worker`, `pages`, `id` (one resource each), or filters
`project: acme`, `kind: database`, `location: <server>`. Shown when the Infra page is on (otherwise the text stays).

## E-mail

The **E-mail** tab shows, domain by domain, where each address comes from and where its mail goes. It only reads:
nothing is created or changed at your providers.

- **Mailboxes of the E-mail page**: address, IMAP / SMTP servers, last check (OK or the error, and when). Click one to
  open it on the E-mail page.
- **Cloudflare Email Routing**: for each zone, whether routing is on, and its rules: `contact@example.com -> you@gmail.com`,
  the rules handled by a Worker or dropped, and the catch-all. A destination not verified at Cloudflare is flagged.
- **Hostinger Email**: your e-mail plans, their mailboxes, aliases, forwarders and catch-alls ("No Hostinger e-mail
  plan" when there is none).
- **The chain**: each forward ends with **in the E-mail page** when the destination is one of your mailboxes there,
  else with **Add to the E-mail page**.
- **DNS health** of every domain that receives mail: MX, SPF (one record, under 10 lookups), DKIM (looked up on a few
  common selectors), DMARC (its policy), each problem with what to change, for example "No DMARC record: add a TXT
  record `_dmarc.example.com` `v=DMARC1; p=none; rua=mailto:you@example.com`". A subdomain without its own record
  follows the policy of its parent domain (its `sp=` when it has one): Harness says so, never suggests `p=none` there
  (it would weaken it) and never suggests lowering the parent's `p=`. An invalid parent record (two records, no `p=`)
  protects nothing, and Harness says so. An SPF record must end with `~all` or `-all` (its own, or the one of its
  `redirect=` target): `+all`, `?all` or no `all` at all are flagged, and so is an `include:` loop. The suggested SPF
  record covers the SMTP server of your mailboxes on that domain; when the sending service is not known, Harness says
  which `include:` to add instead of offering a record built from the MX alone. The report address is always on the
  same domain (one of your mailboxes there, else `dmarc@<domain>`): reports sent to another domain never arrive.

Providers are read again after 5 minutes, the DNS after an hour; **Refresh** reads everything now.

**Permission missing** on a Cloudflare zone: the token sees the zone but not its Email Routing. Add the permission
**Zone -> Email Routing Rules -> Read** for all zones to the Cloudflare token (Settings -> Keys; edit the token on
Cloudflare, the value does not change). The destination addresses need **Account -> Email Routing Addresses -> Read**.
Other mail providers (Migadu, Purelymail, Zoho, OVHcloud, cPanel hosts) are not read yet: their addresses still show
when they are on the E-mail page.

## Terminal

`maxxing infra status`, `maxxing infra list [--kind site] [--json]`, `maxxing infra refresh`, and the recipes:
`site add|remove|list`, `reserved` (the names a site cannot take), `db install|create|sqlite|backup`, `bucket install|create`, `server connect|add|rename|remove|list`,
`domain add|remove|list`,
`annotate`, and `maxxing infra mail [--refresh] [--json]` (the E-mail tab). See `maxxing infra --help` and the CLI reference.

## Safety of `infra.json`

The servers of `<workspace>/infra.json` are reached through `ssh` by the server itself, so Claude may not edit that
file (it is in the deny rules of every turn, like the folder settings); use `maxxing infra server add` or the page.
An entry written by hand that the CLI would refuse (odd user, host or key path) is ignored. One provider that does
not answer (Cloudflare, Hostinger, a server) only leaves its own section empty: checks and alerts of the rest go on.
