Cloudflare Pages (homelab docs)¶
How homelab documentation is built and published to Cloudflare Pages.
Live site: hldocs-c0acdec9.pages.dev
Overview¶
| Item | Value |
|---|---|
| Source | docs/ + mkdocs.yml in homelab repo |
| Build | mkdocs-material, mkdocs build --strict |
| CI | .github/workflows/docs.yml |
| Runner | [self-hosted, Linux, X64, homelab-ci] — WSL pool; see github-self-hosted-runners.md |
| Python | actions/setup-python@v6, Python 3.13 |
| Node tooling | actions/setup-node@v5, Node 22, npm ci for markdownlint |
| Action runtime | FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true while the repo completes the Node 24 transition |
| Deploy action | cloudflare/wrangler-action@v4 |
| Pages project | hldocs-c0acdec9 |
| Trigger | Push to main when docs/**, mkdocs.yml, or .github/workflows/docs.yml changes |
| Secrets | GitHub CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID |
Docs CI is separate from Traefik’s Cloudflare DNS token (services/traefik/.env.sops.yaml).
Use a Pages-scoped API token for GitHub Actions; keep Traefik DNS-01 on its own token
(see Public edge DR).
The Pages site is intentionally public as of 2026-06-26. Do not publish
plaintext secrets, private host keys, private IP credentials, or unredacted
incident artifacts. Contractor assessments and review reports may be published
under docs/reviews/ when they contain links/evidence but no sensitive
material.
Local preview¶
From repo root:
uv sync
npm ci
uv run mkdocs serve # http://127.0.0.1:8000
uv run mkdocs build --strict # same check as CI — must pass before merge
uv run python scripts/lint-markdown.py
Markdown is linted in CI via npm ci + scripts/lint-markdown.py. Use
uv run python scripts/lint-markdown.py --fix before committing docs changes.
Publish pipeline¶
- Merge PR to
main(or push directly). - Deploy Docs workflow runs:
actions/checkout@v5actions/setup-python@v6with Python3.13actions/setup-node@v5with Node22npm cipython scripts/lint-markdown.pypip install mkdocs-materialmkdocs build --strict- Ensure Pages project exists:
npx --yes wrangler@3 pages project list - Create it if missing:
npx --yes wrangler@3 pages project create hldocs-c0acdec9 --production-branch main - Deploy with
cloudflare/wrangler-action@v4:pages deploy site/ --project-name=hldocs-c0acdec9 --commit-dirty=true - Confirm green run: Actions → Deploy Docs.
- Spot-check the live site (journal index, new runbook pages).
--strict fails on warnings (broken links to files outside docs/, bad anchors).
Link to repo files with GitHub blob URLs, not ../../scripts/... paths.
The workflow intentionally separates Node concepts:
setup-nodeinstalls Node22for repo-local npm tooling (markdownlint-cli2currently requires Node>=22).FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=trueexercises GitHub JavaScript actions on Node 24 during the platform transition.- Project bootstrap still calls
npx --yes wrangler@3; deployment itself usescloudflare/wrangler-action@v4.
Adding pages to navigation¶
Edit mkdocs.yml nav: — orphan pages under docs/ build but are easy to miss.
After adding a runbook, include it under Runbooks and in runbooks/index.md.
For review packages, add them under the Reviews nav section and keep a
top-level README with executive summary, findings, and appendix links.
Optional hardening¶
| Task | Status | Notes |
|---|---|---|
| Pages deploy via GitHub Actions | ✅ Done | Secrets in repo settings |
| Cloudflare Access on docs URL | ❌ Declined | Owner accepted public Pages site (2026-06-26) |
Troubleshooting¶
Deploy Docs failed on mkdocs build --strict¶
- Read the log for
WARNINGlines (strict treats them as errors). - Common fixes:
- Replace
../../services/.../../../scripts/...links withhttps://github.com/spadoople/homelab/blob/main/... - Fix stale
#anchorlinks after heading renames. - Reproduce locally:
uv run mkdocs build --strict.
Node or Wrangler errors¶
- Confirm the job is using
actions/setup-node@v5with Node22; that controls npm tooling, not the JavaScript action runtime. - Keep
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=trueunless the Node 24 transition has been retired across all workflows. - If project creation fails, inspect the
npx --yes wrangler@3 pages project ...step separately from the finalcloudflare/wrangler-action@v4deploy step.
Pages project missing¶
Workflow auto-creates hldocs-c0acdec9 if absent. If create fails, check token has
Account → Cloudflare Pages → Edit.
Site stale after green deploy¶
Hard-refresh or check deployment in Cloudflare dashboard → Workers & Pages →
hldocs-c0acdec9 → Deployments.
Related¶
- Documentation validation — audit + publish checklist
- Project journal
- dr-public-edge.md — Traefik/Authentik incident response (not Pages)