Build and publish the documentation image
The public image serves a curated Zensical site with nginx. The final image
contains the checked static artifact and nginx, with no Python or repository
sources. The complete private documentation remains available as Markdown in
Git and through the normal zensical build --clean --strict CI check.
Public sources
docs/public-pages.json is the publication allowlist and navigation definition.
The public site is a portfolio, so it includes most pages: the architecture and
platform pages, all ADRs, the runbooks, the service guides, and these
repository pages. Adding a page requires reviewing its complete content and
referenced assets for personal data and credentials.
scripts/ci/public-docs.py assembles those pages and their referenced assets
under tmp/public-docs/docs, with a separate zensical.toml and navigation.
That file copies the theme, Markdown extensions, extra, and extra_css from
the main zensical.toml without pymdownx.snippets, so both sites look the
same. The assembly also copies the listed stylesheets, which must be .css
files under docs, and the template overrides in theme.custom_dir
(docs/templates/), which must be .html files. Zensical skips a top-level
templates/ folder in docs, so the templates never become pages.
It clears that build directory before each assembly. Markdown links to excluded
pages become plain labels in the assembled copy. The repository sources stay
unchanged. Includes, raw HTML, reference-style links, unsupported asset types,
and paths outside docs fail assembly.
The build uses only the assembled directory. Removing a page from navigation
alone does not prevent publication, as the Zensical navigation documentation
explains. The artifact check compares HTML, search locations, and sitemap URLs
with the allowlist. It rejects private page references, unexpected pages and
downloads, missing public pages, and symlinks. Generated theme assets must match the
file names and SHA-256 hashes in scripts/ci/public-docs-assets.json. A Zensical
upgrade requires reviewing and updating that inventory. Zensical's generated 404.html
is the only extra HTML page. The checker expects the search format of the pinned
Zensical version and fails if that format changes.
The docs job in .github/workflows/validate.yaml builds both sites.
Dockerfile runs the public build and artifact check before
copying its result into the runtime image. The image workflow therefore fails
before publication if that check fails. CI regression tests inject forbidden
pages into HTML, search, and sitemap to verify the boundary.
Publication review
Internal addresses, host names, and internal DNS names are public. They
document topology and grant no access. Bucket, project, and service account
names are public for the same reason. The allowlisted pages and
hardware/netbox-devices.csv contain no personal names beyond the owner's
handle and "Sergi Castro" as the site author byline, and no email addresses,
phone numbers, home address, home public IP, secret values, or credentials. The
CSV's contact, owner, serial-number, asset-tag, and geographic-coordinate fields
are empty.
These pages stay private. The table names them by title because the artifact check rejects any private page path in the public HTML.
| Page | Reason |
|---|---|
| Kubernetes and GitOps | Contains a personal name and an unresolved incident journal. |
| Retire LanCache | A finished one-time procedure. |
| Glossary | Includes the private CONTEXT.md. Public builds disable includes. |
Build locally
Install requirements-docs.txt, then run:
zensical build --clean --strict
python3 scripts/ci/public-docs.py build
task docs:image
task docs:image:run
Open http://127.0.0.1:8080. Stop the container with Ctrl+C.
The runtime listens on 8080 as UID and GID 101. A read-only root filesystem
needs only a writable /tmp, capped at 16 MiB in the staging Deployment.
Unknown paths return HTTP 404. scripts/ci/docs-nginx.conf also serves exact
HTTP 301 redirects for retired non-homelab paths from the previous site
(/About, /Projects, /Projects/Mini Jam Games, and
/Projects/k8s-go-webhooks, with and without trailing slashes) to their
canonical pages on sergicastro.com.
To check files copied from a built container, run:
Publish to GHCR
.github/workflows/docs-image.yaml builds relevant pull requests without
publishing. Pushes to main, v* tags, and manual runs publish to
ghcr.io/igresc/homelab-docs using the job's GITHUB_TOKEN.
Full sha-<commit> tags identify builds. Only a current branch build updates
its mutable tags, and only the default branch updates latest.
The package remains private. No publishing PAT is required.
Staging deployment
Flux Kustomization homelab-docs-staging reconciles
kubernetes/apps/staging/homelab-docs. It waits for staging-registry-auth,
staging-certificates, and staging-network. The Deployment pins a published
curated GHCR SHA tag. It has probes, resource limits, no mounted service account
token, and a read-only root filesystem.
The Deployment pulls with the cluster-wide ghcr-pull Secret. A
ClusterExternalSecret in kubernetes/infrastructure/staging/registry-auth
selects every namespace through the automatic kubernetes.io/metadata.name
label, including new namespaces. It templates a kubernetes.io/dockerconfigjson
from kv/infra/github/ghcr-pull, properties username and token, using
External Secrets templating.
Any staging workload that needs a private GHCR image lists
imagePullSecrets: [{name: ghcr-pull}]. The ClusterSecretStore
openbao-ghcr-pull authenticates to production OpenBao as the
external-secrets/ghcr-pull-reader service account, through the existing
jwt-staging-grafana mount, role staging-ghcr-pull, audience vault.
terraform/staging_registry_secrets.tf limits that role to the pull path and
token self-service. The later JWKS migration must move this store and role
with the other staging users.
module.pangolin configures two public routes on the managed site pointing at
staging Traefik:
docsregistersdocs.igresc.comdirectly on domain IDigrescusing single-labelsubdomain = "docs".homelab_docsretains the importeddocs.dev.igresc.comhostname (Pangolin resource 12 and target 11 interraform/homelab_docs_staging.tf) during the cutover. Provider 1.6.1 rejects dotted subdomain values, soexisting_full_domainpreserves the imported subdomain withignore_changesand checks that the full hostname stays unchanged. A rebuild must first register that hostname in Pangolin and update the import IDs; the provider cannot create it fromsubdomain = "docs.dev".
The existing Cloudflare wildcard resolves both names to the Oracle edge once no
more specific Cloudflare record overrides docs.igresc.com. Cloudflare
wildcards cover deeper labels
unless a more specific record takes precedence. No extra public DNS record
is needed. The internal homelab-docs.staging.local.isabelsoler.es A record
points to staging Traefik at 10.0.20.90.
Pangolin terminates public TLS and connects to 10.0.20.90:443 over HTTPS.
Each route sends its public hostname in Host (docs.igresc.com or
docs.dev.igresc.com) and TLS server name
homelab-docs.staging.local.isabelsoler.es, matching the staging Certificate's
SAN. The HTTPS health check connects to
homelab-docs.staging.local.isabelsoler.es, which resolves to staging Traefik.
It uses the same SNI and requests / without following redirects. Don't point
it at the public hostnames. Those resolve to the Oracle edge, so a failed
probe would remove the only target and the route could not recover. Pangolin's upstream
transport generator
sets insecureSkipVerify: true when a TLS server name is set. The provider
exposes no switch for this. SNI selects the backend certificate but does not
prove that Pangolin verifies it. Review the deployed edge transport before
cutover if backend certificate verification is required.
The staging Ingress routes docs.igresc.com, docs.dev.igresc.com, and
homelab-docs.staging.local.isabelsoler.es to the app. An HTTP upstream on
port 80 would loop through staging's global HTTPS redirect.
Activate staging
- Review the full OpenTofu plan and get approval before applying it. The
import blocks adopt the existing Pangolin route and target during apply.
Confirm the plan retains
docs.dev.igresc.comand moves its target fromdocker.local.isabelsoler.es:8084to staging HTTPS. Handle unrelated drift separately. - Push the validated staging manifests. On
talos-test, wait forhomelab-docs-stagingto become Ready. Confirm the namespace'sghcr-pullExternalSecret is Ready and the Deployment is available. Namespace creation can precede the pull Secret by one refresh interval. - Check that Certificate
homelab-docs-tlsbecomes Ready. It uses the existingstaging-ingress-letsencryptClusterIssuer and DNS-01 forhomelab-docs.staging.local.isabelsoler.es. Issuance needs no Pangolin challenge route. - Verify the backend before the approved Pangolin apply:
curl --resolve homelab-docs.staging.local.isabelsoler.es:443:10.0.20.90 \
-H 'Host: docs.dev.igresc.com' \
https://homelab-docs.staging.local.isabelsoler.es/
- Apply the reviewed Pangolin and internal DNS changes. Check the public home page, search, and sitemap. Confirm a private page returns HTTP 404.
To roll back, keep the homelab_docs entry in terraform/main.tf. Removing
it destroys the Pangolin resource. Point it back at the Docker host container,
and set the TLS fields to empty strings. Omitting them leaves the old values in
place.
tls_server_name = ""
set_host_header = ""
target = {
site = "managed"
ip = "docker.local.isabelsoler.es"
port = 8084
method = "http"
health_check = {
hostname = "docker.local.isabelsoler.es"
scheme = "http"
port = 8084
tls_server_name = ""
follow_redirects = true
}
}
Plan and apply with the same two Pangolin -target addresses as the cutover.
Then remove ./homelab-docs.yaml from
kubernetes/clusters/staging/kustomization.yaml and push the revert. The app
holds no data. The cluster-wide pull Secret stays for other workloads.
The separate cv/mkdocs-igresc k3s workload and its docs.igresc.com route
remain unchanged.