Greg Bair's Blog #
Personal blog built with Hugo, featuring posts about C#, programming, and homelab adventures.
This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
Tech Stack #
- Static Site Generator: Hugo
- Theme:
console, vendored inthemes/atom/(MIT) - Web Server: Caddy, containerized
- CI/CD: tangled spindle
- Container Registry: self-hosted, on the homelab tailnet
- Deployment: docker container declared in nix, pulled on a timer
Local Development #
Prerequisites #
- Hugo 0.80 or newer (the theme's stated minimum). The extended build is not required; nothing in the theme uses SCSS.
- Git
Setup #
git clone ssh://git@marge/did:plc:ccyw75iwzcnwerw2casw6l2f blog
cd blog
hugo server -D
Visit http://localhost:1313 to see your site. The theme is committed directly to this repository, so there are no submodules to initialize.
Creating New Posts #
# Create a new blog post
hugo new posts/my-new-post.md
# Create a new game page
hugo new games/my-new-game.md
New posts are created with draft = true. Set draft = false to publish —
the production build does not pass -D, so drafts never reach the live site.
Building #
# Build the site
hugo
# Build with minification (production)
hugo --minify --baseURL https://gregbair.blog
Built site will be in public/.
Deployment #
Pushing to main triggers .tangled/workflows/publish.yml on the spindle
running on homer. The workflow builds the site, builds the container image,
and pushes it to the homelab registry tagged both latest and with the commit
SHA. It never contacts the deploy host.
Deployment is pull-based and lives in the homelab repo, not here. homer runs
a blog-update timer daily that pulls :latest, compares image IDs, and
restarts the container only when the digest actually changed. A post therefore
goes live within a day of merging; to publish immediately, run the update unit
by hand:
systemctl start blog-update.service
Skip CI for a commit that changes no content with git push -o skip-ci.
Notes on the pipeline #
The registry speaks plain HTTP, which docker push refuses without
daemon-level insecure-registries configuration that a spindle microVM does
not let us set. The workflow uses skopeo copy --dest-tls-verify=false
instead, which takes the flag per invocation and reads straight out of the
build daemon.
REGISTRY is set to 10.0.3.2:5000 — the QEMU user-mode gateway, which
proxies to the host's own loopback. That address only works when the pipeline
runs on homer, where the registry lives. Running it elsewhere requires the
registry host's literal tailscale address; MagicDNS names do not resolve inside
the microVM.
Running microVM workflows requires the nixos image to be installed in the
spindle's image directory on the host. This is not automatic — see the tangled
docs on installing images.
Manual Deployment #
hugo --minify --baseURL https://gregbair.blog
docker build -t blog .
docker run -p 8080:8080 blog
Visit http://localhost:8080
Container #
The blog runs on homer as a docker container declared through
virtualisation.oci-containers in the homelab repo's services/blog.nix.
Container port 8080 is published on 127.0.0.1:8081, with cloudflared
providing public ingress for gregbair.blog and www.gregbair.blog.
# View status
systemctl status docker-blog.service
# Restart
systemctl restart docker-blog.service
# View logs
journalctl -u docker-blog.service -f
docker logs -f blog
Project Structure #
.
├── archetypes/ # Content templates
├── content/ # Markdown content
│ ├── posts/ # Blog posts
│ ├── games/ # Game-related pages
│ ├── projects/ # Project pages
│ └── _index.md # Homepage content
├── static/ # Static assets
├── themes/atom/ # Vendored theme
├── .tangled/workflows/ # CI pipeline
├── Caddyfile # Web server config
├── Dockerfile # Container image definition
└── hugo.toml # Hugo configuration
Configuration #
hugo.toml #
baseURL- Production URL (https://gregbair.blog)title- Site titletheme- Theme directory name (atom)languageCode- Site language (en-us)
License #
Content is CC BY-NC-SA 4.0, per the badge above. The vendored theme is MIT;
see themes/atom/LICENSE.
Links #
- Live Site: https://gregbair.blog
- Theme: https://github.com/gregbair/console-hugo-theme