aphid 0.4.0

aphid 0.4.0 adds a second binary to the project: aphid-server, a small production web server for a site built with aphid build. It ships as a multi-arch container image, ghcr.io/lhelge/aphid-server, so self-hosting a site in a container no longer needs nginx and a config file. The site generator itself has no breaking changes in this release.

A two-line Dockerfile

Build the site into dist/ as before, then:

FROM ghcr.io/lhelge/aphid-server:0.4.1
COPY dist /site

Note

The first image is 0.4.1. The 0.4.0 release workflow failed before publishing an image, and 0.4.1 contains the fix.

The image is scratch plus one static binary: about 10 MB, a non-root user, port 8080. It needs no configuration file. Every option is a flag or an environment variable, and PORT is honoured, so platforms that inject it work out of the box.

It does what the nginx setup used to do:

  • index.html for directories, content types, ETag/Last-Modified revalidation and range requests.
  • Relative redirects for directories without a trailing slash (/posts → /posts/), so a redirect behind a TLS-terminating proxy never leaks the internal port or scheme.
  • Your 404.html for missing paths.
  • GET /healthz for health probes, never logged.
  • Graceful shutdown on SIGTERM: in-flight requests finish before it exits.

It only speaks plain HTTP/1.1. TLS belongs to the reverse proxy in front of it.

Logs you can query

Every request produces one access-log line on stdout. With APHID_LOG_FORMAT=json, each line is a JSON object with the method, path, status, duration, bytes, referrer, user agent and client address (from X-Forwarded-For). Filtering on status and referrer turns the log into a broken-link report:

jq -c 'select(.status == 404) | {path, referrer}' server.log

OpenTelemetry, if you want it

Set OTEL_EXPORTER_OTLP_ENDPOINT and aphid-server exports traces and logs over OTLP/HTTP:

  • One server span per request, with the standard HTTP semantic-convention attributes. An incoming traceparent header is continued.
  • Log records linked to the request’s span.
  • The standard OTEL_SERVICE_NAME, OTEL_RESOURCE_ATTRIBUTES and OTEL_EXPORTER_OTLP_HEADERS variables are honoured, and HTTPS collectors work without a CA bundle in the image.

Without an endpoint, nothing is exported and nothing tries to connect. A collector that is down never slows a request: export failures are logged once, not on every attempt.

Also in this release

  • All dependencies are updated to their latest versions. The template engine stays on Tera 1, so existing themes keep working unchanged.
  • Static aphid-server binaries for x86_64 and aarch64 Linux are attached to the GitHub release alongside the usual aphid builds.

Upgrading

cargo install aphid --locked --force
aphid --version

Nothing changes for aphid build or aphid serve. To try aphid-server, see Serving with aphid-server for the full option table, the log format, the OpenTelemetry settings and a stack-file example for hoster. Deployment lists it alongside the GitHub Pages setup.