{"success":true,"name":"brimind-static-page-live","description":"Use when deploying static HTML or a Next.js export.","category":"unitary","path":"unitary/brimind-static-page-live/SKILL.md","file":"SKILL.md","content":"---\nname: brimind-static-page-live\ndescription: Use when deploying static HTML or a Next.js export.\n---\n# Deploy a static site without an app process\n\n1. Confirm the source folder, hostname, and destination. If source is on the Mac, inspect and build on the Mac; verify which host the shell runs on before resolving a local path. Read the README, build config, and working-tree status. Build from the intended working tree, not `git archive` or a clone, when the user points to local work that may be uncommitted.\n2. Confirm static output (`output: 'export'` for Next.js). Run the documented build with the staging URL for metadata if supported. Publish only the fresh export with `index.html` at its root, not source, `.env`, caches, or dependencies. No app port, daemon, tunnel, or Node install is needed on a static origin. Use a runtime deployment if the project needs a backend at request time.\n3. Choose routing by the requested hostname and origin. Use the dispatcher steps below for managed `offer.brimind.pro` tenants. For a custom hostname on a [PRIVATE_HOST] running Caddy, use [Direct static deployment with Caddy](references/caddy-static-deploy.md). Verify live DNS against the requested origin before changing routing; DNS alone does not configure HTTPS or serve the site.\n4. For staging, change only its route and leave production DNS and routing untouched. Add `X-Robots-Tag: noindex, nofollow` unless indexing is wanted. This is not access control; require authentication if staging must be private.\n5. Verify public HTTPS with normal certificate validation, match the homepage and assets to the built artifact, and check the HTTP redirect where expected. Report the URL, verification, and remaining blockers in the owner's colored status format.\n\nThe dispatcher commands below run in `[PRIVATE_HOST]:[PATH]`. Owner send rules from `i7-remote-ops` still apply.\n\nSibling skills: `brimind-demo-site` (full prospect site, Vercel default),\n`brimind-house-style` (what must be on any client-facing page).\n\n## Managed wildcard dispatcher\n\nDispatcher `static` mode needs two things:\n\n| Need | Why |\n|---|---|\n| a **slug** (the subdomain) | tenant identity travels in the `Host` header; without it nothing routes |\n| a **folder** under `sitesRoot` | that is the whole \"deployment\" |\n\nNever invent the slug. Ask for it, once, and stop until it is given.\n\n## 1. Lay the folder out\n\nUse the ready-to-serve export from step 2, with `index.html` at its root.\n\nClient work goes under `clients/projects/<slug>/` — never at the repo root.\n\n## 2. Read `sitesRoot` — never hardcode it\n\n```bash\nnode -e \"console.log(require('./brimind-tunnel/wildcard/config/tenants.config.json').sitesRoot)\"\n```\n\nIt has pointed at a stale path before. Read it every time; the example ships\n`/var/www/sites`, the live config may not agree.\n\n## 3. Copy the folder in\n\n```bash\nSLUG=<slug>\nROOT=$(node -e \"console.log(require('./brimind-tunnel/wildcard/config/tenants.config.json').sitesRoot)\")\n\nrsync -av --delete ./<source-folder>/ \"$ROOT/$SLUG/\"     # local dispatcher\n# rsync -av --delete ./<source-folder>/ [PRIVATE_HOST]:\"$ROOT/$SLUG/\"   # dispatcher on the [PRIVATE_HOST]\n```\n\n`--delete` makes the copy idempotent: a redeploy leaves no orphan file from the\nprevious version. Dry-run it first (`rsync -avn --delete …`) whenever the target\nfolder already exists.\n\n## 4. Register the tenant — once\n\nAdd to `brimind-tunnel/wildcard/config/tenants.config.json`, in `tenants`:\n\n```json\n{ \"slug\": \"<slug>\", \"name\": \"<human name>\", \"mode\": \"static\", \"active\": true }\n```\n\nNo `port` key. `static` tenants have no port — adding one is the usual mistake.\nThe store reloads on mtime change, so no restart is needed for a config edit alone.\n\n## 5. Validate before it 502s in public\n\n```bash\ncd brimind-tunnel/wildcard && npm run check\n```\n\n`check` catches a bad `sitesRoot`, a missing folder, a duplicate or non-allowlisted\nslug, a `tunnel` forward that does not exist — all of it before a stranger sees a 502.\n**Never skip it**, and never announce a URL you have not curled.\n\n## 6. Confirm from the outside\n\n```bash\ncurl -s -o /dev/null -w \"%{http_code}\\n\" https://<slug>.offer.brimind.pro/\n# expect 200\n```\n\n| Code | Means |\n|---|---|\n| `200` | live — share it |\n| `404` | slug routes, folder is empty or `index.html` is misnamed |\n| `502` | dispatcher down, or the tunnel forward for `:4444` is down |\n| `000` | nothing answered — DNS/TLS/agent, not your HTML |\n\nIf the dispatcher is not already running: `cd brimind-tunnel/wildcard && npm start`\n(`:4444`), and check `npm run tunnel:status` from the repo root that `:4444` is\nactually forwarded.\n\n## 7. Rollback\n\n```bash\n# flip the tenant off, then re-validate\n#   \"active\": false   in tenants.config.json\ncd brimind-tunnel/wildcard && npm run check\nrm -rf \"$ROOT/<slug>\"        # only once you are sure nothing else serves that folder\n```\n\nNever delete a folder under `sitesRoot` you did not create in this session.\n\n## Gotchas\n\n- **A static tenant does not need the laptop** when the dispatcher runs on the [PRIVATE_HOST] —\n  the files are on the [PRIVATE_HOST]. It *does* need the laptop when the dispatcher is local\n  and reached over the tunnel. Say which case you are in before promising uptime.\n- Missing trailing slash in the rsync source copies the folder *inside* the target.\n  `./site/` → `$ROOT/$SLUG/`, with both slashes.\n- `mode: \"static\"` with a `port` key is not an error the eye catches — `npm run check`\n  does.\n- Entry-point guards written as ``import.meta.url === `file://${process.argv[1]}` ``\n  break in this repo (the space in the folder name URL-encodes, the process exits\n  silently). Use `pathToFileURL(process.argv[1]).href`.\n- Demo pages carry the BRIMIND footer credit and, if uncommissioned, a line saying\n  the business has not ordered it — see `brimind-house-style`.\n\n## Report back\n\nAnswer with the URL, its HTTP code, and the one command that proves it. A URL with\nno curl behind it is not a deploy.\n","linked_files":["references/caddy-static-deploy.md"],"origin":"brimind","owner_id":null,"source":"router"}