Content Management that can withstand the plundering hoards

Frontend implementation

Use the canonical HTTP reference for methods, statuses, MIME, validators, ranges, cache policy, safe paths and admin endpoints. Use runtime settings for flags/defaults and installation for deployment.

Runtime interface

For an isolated local run from repository root, create mysite/index.html, then:

go run ./frontend/cmd/webserver --root=./mysite \
  --listen=127.0.0.1:8099 --admin-listen=127.0.0.1:8098

This reads an existing directory. Stop with Ctrl+C. For a CMS-generated site, use the local setup.

Implementation boundaries

The frontend uses the standard library and reads only published files. It makes no application outbound calls, database or Kubernetes requests, and has no private CMS volume or credentials. Responses stream without temporary files. Paths are cleaned, symlinks resolved and the resolved target checked against the resolved root. Retain response-level tests for rejected requests as well as success.

Published-directory contract

Use /www/current rather than a subPath mount of one release. Re-resolve the active root according to root-freshness and allow open reads to finish against their release. Keep metadata-based upload delivery, conditional requests and range responses aligned with publisher guarantees.

Build and verification

Use the build/test guide. A source-level benchmark from repository root is go test -bench=. -run=^$ ./frontend/internal/server/. Benchmark output depends on host/filesystem conditions and is not a production throughput guarantee.

Layout

cmd/webserver/        main: flag/env parsing, listeners, graceful shutdown
internal/config/      configuration from flags and VIKING_* env vars
internal/logging/     structured JSON access + operational logs
internal/metrics/     dependency-free Prometheus text-format registry
internal/server/      file handler, path safety, conditionals, ranges, admin