Hugo: Administration¶
Force a rebuild¶
The Hugo site is built into the custom Docker image at compose build time. The build is content-keyed via the cloned services/repository/ tree, so:
A change in
services.hugo.source_versioninvalidates the clone, which invalidatesCOPY ./services/repository/in the Dockerfile, which triggers a freshhugobuild on the next deploy.A force rebuild without a source-version change can be triggered by clearing the role’s image cache:
make compose-exec cmd="docker compose -f /opt/docker/web-app-hugo/docker-compose.yml build --no-cache"The next
make compose-deploy mode=update apps=web-app-hugowill pull the image, restart nginx, and serve the freshly rendered output.
Bumping the source version¶
Pick the new tag/commit in the upstream repository (default: gohugoio/hugoDocs releases).
Update
roles/web-app-hugo/meta/services.yml:hugo: source_version: <new-tag>Re-deploy:
make compose-deploy mode=update apps=web-app-hugoVerify in the browser that the content reflects the new version.
Debugging a failed Hugo build¶
The Hugo build runs inside docker compose build. If hugo exits non-zero, the play fails and the previous image keeps serving. To inspect the failure log:
make compose-exec cmd="docker compose -f /opt/docker/web-app-hugo/docker-compose.yml build --progress=plain --no-cache web-app-hugo 2>&1 | tail -200"
Common causes:
hugoreports unknown content / module errors: the upstream repository moved a directory or a Hugo Module. Pin to a known-good tag insource_version.hugoreports template execution errors: the theme’s templates are incompatible with the bundled Hugo binary. Bumpservices.hugo.builder_version(e.g. to a newerv<version>tag) or pin the source repo to a tag known to build with the current Hugo.Module fetch fails (
go.modresolution): Hugo modules pull fromproxy.golang.org. Network egress to that host must be allowed by the local firewall / proxy.
Rotating the Hugo binary¶
To upgrade the extended Hugo binary independently of the content repo, edit services.hugo.builder_version in meta/services.yml (e.g. v0.166.0). The change invalidates only the builder layer, not the cloned repo, so the next compose build reuses the same content but with the new binary.