My thoughts on Slackware, life and everything

Category: Me (Page 1 of 30)

Slackware Cloud Server Series, Episode 13: Blogging Platform

If you are reading this, then you are looking at the result of a migration that kept me busy for a good part of October. Alien Pastures is no longer a WordPress blog. After eighteen years of WordPress (the first post on this blog dates from 2008), every page you see here is a plain HTML file, generated from text files in a git repository, and served by Apache without a single line of PHP or a database query in sight.

Why? I was getting tired of patching WordPress and its plugins, of the never-ending stream of login attempts and spam comments, of keeping PHP and MariaDB happy, and of the nagging feeling that the most exposed service on my server was also the one with the largest attack surface. Already some years ago I had done a quick research on Hugo, a framework for building static websites. A blog does not need to be a dynamic web application. It needs to show text and pictures, let people comment, and let me write new articles in a comfortable way.

That last part is where most “static site” tutorials stopped being helpful. They assume that you love editing Markdown files in vi and running build commands by hand. I do love vi, but I also want to write a blog post from a browser on my laptop, drop in a screenshot, and press “Publish”. And then, what do do with reader comments on a blog with static pages? I want my readers to be able to leave comments, without me handing their data to Disqus or another Big Tech service.

So I built a complete blogging platform out of Open Source components, all running on my own servers. It turned out to be a perfect fit for the Slackware Cloud Server series, because it combines several things we already did in earlier episodes (Docker, Apache reverse proxies, Let’s Encrypt) with some new ones: a git forge with CI/CD, a package registry, and a “pull” deployment that does not need any SSH keys.

Check out the list below which shows past, present and future episodes in my Slackware Cloud Server series. If the article has already been written you’ll be able to click on the subject. The first episode also contains an introduction with some more detail about what you can expect.


Why would I want a static blog?

A “static” website consists of files that are created once, and then served to every visitor as they are. Compare that to WordPress, where every page view runs PHP code which queries a database and assembles the page on the spot. Let me list the advantages of going static:

  • Security There is nothing to hack on the web server. No login page, no PHP, no plugins with yet another vulnerability, no database with your users’ password hashes. The web server only hands out files. My server logs are still full of bots trying /wp-login.php, but now they get a polite “410 Gone” and that’s it.
  • Speed A static page is as fast as your web server can read a file from disk. No caching plugins needed.
  • Low maintenance No more monthly WordPress core updates, plugin updates, theme updates, PHP upgrades that break a plugin, database upgrades… Apache and the Artalk comment server are the only things to keep up to date.
  • My content is just text Every post is a file in a git repository. I have the complete history of every change, I can grep through eighteen years of writing, and making a backup is as simple as git clone.
  • Portability The web server only needs Apache and a cron job. Moving the blog to another host means: copy one script and one configuration file, point DNS at the new host, done. That matters to me; nobody knows how long my servers will stay where they are.

There are trade-offs of course. A static site needs a “build” step after every change, which takes a few minutes before a new post is visible. And all the dynamic bits (comments, search) need a different solution. That’s exactly what the rest of this article is about. And you can use this knowledge to build your own Hugo-powered blog! I created a git repository hugo-blog-kit to accompany this article and to help you get started.

What happens where?

Before we dive in, here is the big picture. This is what the whole stack looks like, and what happens when you publish a new post:

Architecture of the blogging platform
  1. You write a post in your browser, in MarkDown language, using the visual editor Sveltia CMS. Sveltia is a single web page which talks to your git repository (I use a Forgejo git server in this article but it can just as well be Codeberg or Github). When you press “Save”, it commits your post (a Markdown text file plus any images) to the git repository. You never touch git yourself, unless you want to.
  2. Forgejo notices the new commit on the “main” branch and starts a job for Forgejo Actions, its built-in CI/CD system (CI/CD = Continuous Integration/Continuous Delivery, the automated “build, test, deliver” pipeline that software developers use).
  3. A runner picks up the job. It starts a Docker container from a “builder image” that contains Hugo (turns your Markdown into HTML pages) and Pagefind (creates a search index for the site). The complete website ends up in a single tarball.
  4. The runner uploads that tarball into Forgejo’s package registry, as a new version of a “generic package”.
  5. On your web server, a small script sitepull.sh runs from cron every few minutes. It asks the package registry whether there is a newer version of the site tarball, downloads it, verifies its checksum, unpacks it and switches the web site over to it in one atomic step. Right after the switch, it can announce your new posts on Mastodon.
  6. Apache serves the files to your readers.
  7. Artalk runs in a Docker container next to Apache and handles the comments. Every new comment goes into a moderation queue, and a small “sidecar” script approves comments from people who have commented before, just like WordPress did.

Note the direction of step 5: the web server pulls the site. Nothing ever pushes to it. That means the build server does not need an SSH key that allows it to write to your web server. If your build server ever gets compromised, your web server is not automatically compromised too. And moving the web server to another host or another provider does not involve any changes on the forge side.

Preamble

This section describes the technical details of our setup, as well as the things which you should have prepared before trying to implement the instructions in this article.

I write this article as someone who is root on all of the servers involved. You don’t have to be: an ordinary account on the forge and a shell account on the web server (member of the docker group) will do, as long as the admins are willing to do a few one-time steps for you. The README of the hugo-blog-kit explains exactly which steps, and how to install everything in your home directory.

Web Hosts

For the sake of this instruction, I will use these hostnames:

  • blog.darkstar.lan - the blog itself
  • comments.darkstar.lan - the Artalk comment server
  • forge.darkstar.lan - your Forgejo server

Setting up your domain (which will hopefully be something else than “darkstar.lan”…) with new hostnames and then setting up web servers for the hostnames in that domain is an exercise left to the reader. Before continuing, please ensure that your equivalents for blog.darkstar.lan and comments.darkstar.lan have a web server running. They don’t have to serve any content yet, but we will add some blocks of configuration to their VirtualHost definitions during the steps outlined in the remainder of this article.

Using a Let’s Encrypt SSL certificate to provide encrypted connections (HTTPS) to your webserver is documented in an earlier blog article.

Note that I am talking about webserver “hosts” but in fact, all of these can be virtual webservers running on the same machine, at the same IP address, served by the same Apache httpd program, but with different DNS entries. There is no need at all for multiple computers when setting up your Slackware Cloud server. In my own setup, the forge and the blog happen to run on different servers, but the instructions work equally well on a single box.

What you should already have

  • Docker; see Episode 1.
  • A Forgejo server with Actions enabled and at least one runner. Forgejo is a self-hosted git forge, comparable to GitHub or GitLab. Setting up Forgejo deserves an episode of its own (working on it to become Episode 14!). Installing it and registering a runner is well documented in the Forgejo administrator guide. If you already followed Episode 2, you can let your users log in to Forgejo with their Keycloak account. Forgejo version 12 or newer is required for the Sveltia editor; I use Forgejo 15.
  • A runner with the label “docker”. The build job in this article asks for a runner that can start Docker containers. When you register a runner, give it a label like docker:docker://node:22-bookworm-slim. If the forge is not yours, ask its admin whether such a runner is available; otherwise you can register a runner of your own for your account or repository under Settings > Actions > Runners.
  • Apache httpd with mod_rewrite, mod_proxy, mod_proxy_http and mod_headers enabled. All of these are part of Slackware’s httpd package.

Port numbers

  • The Artalk Docker container listens at the loopback TCP port 23366. That is where the Apache reverse proxy for comments.darkstar.lan directs incoming traffic.
  • Nothing else listens on a port: the blog is plain files, and the sitepull script only makes outgoing HTTPS connections.

Secret keys

You will need a few passwords and tokens. Generate random strings with:

$ openssl rand -base64 24
  • Artalk admin password (your own login on the comment server). Artalk accepts it as a bcrypt hash, so the password itself never appears in a configuration file: ARTALK_ADMIN_PASSWORD='(bcrypt)$2y$10$S0me.L0ng.Hash.That.Starts.With.The.Bcrypt.Prefix'
  • Moderator bot password, for the moderation sidecar. Same procedure.
  • A package token for the build job: a Forgejo access token with only the “package: read and write” scope.
  • A read token for the web server, only needed if your repository owner is a private organization: a Forgejo access token with only the “package: read” scope.
  • A Mastodon token, only if you want your new posts announced on Mastodon: an access token for your Mastodon account with only the “write:statuses” and “profile” scopes.

A bcrypt hash of a password is created with the htpasswd tool which comes with Apache:

$ htpasswd -nbBC 10 '' 'MySecretPassword' | cut -d: -f2
$2y$10$5x0n7Jk1nJ8b0...

File Locations

  • The blog’s git repository lives on the forge as darkstar/blog (organization “darkstar”, repository “blog”).
  • On the web server, the activated site builds go into: /usr/local/blog/ (the DocumentRoot is the symlink /usr/local/blog/current).
  • Images from an old WordPress blog (if you have one) go into: /usr/local/blog-media/
  • The sitepull script and its configuration go into: /usr/local/sbin/sitepull.sh and /etc/sitepull/blog.conf
  • The Mastodon announcer and its configuration go into: /usr/local/sbin/mastodon-announce.py and /etc/sitepull/mastodon-announce.conf
  • The Docker configuration for Artalk goes into: /opt/artalk/
  • The Artalk database goes into: /usr/local/artalk/

Server configuration steps

I will break down the story into its main parts:

  • Create a Hugo site and put it in a git repository on your forge
  • Create a Docker “builder” image containing Hugo and Pagefind
  • Prepare the forge: a bot account, a token, and some settings
  • Add the build workflow which turns every commit into a site package
  • Let the web server pull and activate new packages
  • Add comments with Artalk, and a moderation sidecar
  • Add the Sveltia CMS editor so you can write posts in your browser

A Hugo site in a git repository

Hugo is a “static site generator”. You give it a directory with content (Markdown files), templates (HTML with placeholders) and a configuration file, and Hugo writes out a complete website: one HTML page per post, archive pages per category and tag, RSS feeds, a sitemap. It is a single program written in Go, and it is ridiculously fast: Alien Pastures, with more than 3,000 pages, is built in well under a minute.

Install Hugo on your desktop

You don’t strictly need Hugo on your own computer, because the runner builds the site. But a local preview while you work on templates is very handy. Download a release from Hugo’s GitHub page.

Note for Slackware 15.0 users: the “extended” Hugo binary is linked against glibc 2.34 or newer, and Slackware 15.0 has glibc 2.33. Use the standard (static) build instead, unless your theme needs the extended features (Sass compilation, mostly). On Slackware -current, both builds work.

$ wget https://github.com/gohugoio/hugo/releases/download/v0.169.0/hugo_0.169.0_linux-amd64.tar.gz
$ tar -xf hugo_0.169.0_linux-amd64.tar.gz hugo
$ mv hugo ~/bin/
$ hugo version
Create the site
$ hugo new project blog --format yaml
$ cd blog
$ git init -b main

That creates the directory structure Hugo expects. The most important parts:

  • content/ - your posts and pages, in Markdown
  • layouts/ - your own templates, which override the theme’s
  • static/ - files that are copied into the website unchanged
  • themes/ - the theme(s) you use
  • hugo.yaml - the configuration

Pick a theme from the Hugo themes site and add it to the themes/ directory. For Alien Pastures I ported the WordPress theme I had been using for years (Hemingway by Anders Norén) to Hugo, so that the blog looks exactly like it did before. That was a good exercise in learning how Hugo templates work, but a ready-made theme will get you going much faster.

A word of warning: Hugo introduced a new template layout in version 0.146 (2025) and many themes and tutorials out there still use the old one. When you read about templates, make sure the information is recent. The official documentation is always up to date.

Configuration and environments

Instead of a single hugo.yaml, I use a configuration directory with a part for each “environment”. Hugo merges the base configuration with the part for the environment you are building:

config/
  _default/hugo.yaml      everything that is the same everywhere
  production/hugo.yaml    https://blog.darkstar.lan/
  staging/hugo.yaml       a test site, kept out of search engines

This allows the build job to create a test version and the real version of the site from the same commit. I used a staging site at a different hostname for weeks while working on the migration, while the old WordPress blog stayed online.

Here is a shortened config/_default/hugo.yaml to show the important bits:

title: "My Blog"
locale: "en-US"
theme: "mytheme"

# WordPress-style URLs: /my-post/, /tag/slackware/, /category/linux/
taxonomies:
  category: categories
  tag: tags
permalinks:
  page:
    posts: "/:slugorcontentbasename/"
  term:
    tags: "/tag/:slug/"
    categories: "/category/:slug/"

pagination:
  pagerSize: 5

markup:
  goldmark:
    renderer:
      unsafe: true      # allow some raw HTML inside Markdown

params:
  artalk:
    server: "https://comments.darkstar.lan"
    site: "My Blog"

And config/production/hugo.yaml simply contains:

baseURL: "https://blog.darkstar.lan/"
A first post

New posts go into their own directory, together with their images. Hugo calls that a “page bundle”:

content/posts/2026/hello-world/index.md
content/posts/2026/hello-world/screenshot.png

The index.md file starts with “front matter” (the metadata, between the --- lines), followed by the text in Markdown:

---
title: "Hello world"
date: 2026-11-15T12:00:00+01:00
categories: [software]
tags: [slackware]
comments: true
---
My **first** post on my own blogging platform. Here is a picture:

![A screenshot](screenshot.png)

The URL of this post will be https://blog.darkstar.lan/hello-world/ because of the permalinks setting above: the directory name becomes the URL, and it does not change when you edit the title later.

Preview it
$ hugo server --environment staging

Point your browser at http://localhost:1313/ and look at your site. Hugo watches your files and refreshes the page in your browser whenever you save a change.

When you are happy with it, create the repository “blog” in your organization on the forge (I’ll call the organization “darkstar”) and push your site to it. The repository can be private: the forge only hands out the finished website, never the sources.

The builder image

The runner builds the site inside a Docker container. I could install Hugo at the start of every build job, but I prefer a dedicated image with one exact Hugo version inside. A build should never break because “latest” moved to a version that deprecated a template function I use. Upgrading Hugo becomes a conscious decision: build a new image, test it, change one line in the workflow.

Here is the Dockerfile (shortened; the complete one adds OCI labels with version information):

# Hugo builder image for Forgejo Actions.
# The Node base is needed because JavaScript actions such as
# actions/checkout need a node binary inside the job container.
FROM node:22-bookworm-slim

ARG HUGO_VERSION
ARG PAGEFIND_VERSION=1.5.2

RUN apt-get update \
 && apt-get install -y --no-install-recommends ca-certificates curl git jq \
 && rm -rf /var/lib/apt/lists/*

# Fetch the extended Hugo binary and verify it against the upstream
# checksum list before installing it.
RUN set -eu; cd /tmp; \
    base="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}"; \
    tgz="hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"; \
    sums="hugo_${HUGO_VERSION}_checksums.txt"; \
    curl -fsSLO "$base/$tgz"; \
    curl -fsSLO "$base/$sums"; \
    grep " ${tgz}\$" "$sums" | sha256sum -c -; \
    tar -xzf "$tgz" -C /usr/local/bin hugo; \
    rm -f "$tgz" "$sums"; \
    hugo version

# Pagefind builds the static search index after Hugo has run.
RUN npm install -g "pagefind@${PAGEFIND_VERSION}" && pagefind --version

CMD ["/bin/bash"]

Build it and push it into the container registry which is built into Forgejo (here it goes in under user ‘alien’, substitute your own user):

$ docker build --build-arg HUGO_VERSION=0.169.0 \
    -t forge.darkstar.lan/alien/hugo-builder:0.169.0 .
$ docker login forge.darkstar.lan
$ docker push forge.darkstar.lan/alien/hugo-builder:0.169.0

Note: Docker stores the login credentials per registry hostname. If your registry is reachable under more than one name, log in with exactly the name you are pushing to. That cost me a “reqPackageAccess” error and some head scratching.

The image contains nothing but public tools, so I made it public. My own version is at forge.slackware.nl/alienbob/hugo-builder and you are welcome to use it as-is or copy the Dockerfile.

Prepare the forge

The build job needs to upload the finished site into the package registry, and for that it needs an access token. That token should be able to do nothing else.

You don’t need to be the admin of the forge for this. Most people who use somebody else’s Forgejo server won’t be, and that’s fine: create the token in your own account. Go to Settings > Applications, generate a new token, and select only the scope package: Read and Write. A token with only that scope cannot read or change any of your repositories, issues or settings, even though it belongs to your account. If the blog repository belongs to an organization (I use “darkstar” in this article), make sure you are a member of a team in that organization with write access to packages.

In the repository, go to Settings > Actions and add:

  • Variables
    • SITE_ENVS = production (or staging production if you also want a test site)
    • PKG_OWNER = darkstar (the organization, or your user name if the repository is yours)
    • PKG_USER = your user name
  • Secrets
    • PKG_TOKEN = the token you just created
If you are the admin of your forge

Then I recommend a separate bot account, so that the token is not tied to your personal account at all. That is how I did it. Create the account from the command line on your Forgejo server:

# forgejo admin user create --username blogbot \
    --email blogbot@darkstar.lan --random-password \
    --must-change-password=false

Do not forget that last parameter. Without it, the account is created with a “must change password” flag, and every API call with its tokens is refused until someone logs in once and changes the password. Ask me how I know…

Make the bot a member of a team in the “darkstar” organization that has write access to packages. Then log in as the bot (or use the admin’s “sudo” feature), create the token with only the scope package: Read and Write, and use blogbot as the PKG_USER variable.

The build workflow

Forgejo Actions reads its workflows from the .forgejo/workflows/ directory in your repository. The syntax is the same as GitHub Actions. Create .forgejo/workflows/build.yaml:

name: build-and-publish

on:
  push:
    branches: [main]
  # Nightly rebuild, so posts with a future date appear on time.
  schedule:
    - cron: '23 4 * * *'
  workflow_dispatch:

jobs:
  build:
    # Must match a label of your runner.
    runs-on: docker
    container:
      image: forge.darkstar.lan/alien/hugo-builder:0.169.0
    env:
      FORGE_URL: ${{ github.server_url }}
      SITE_ENVS: ${{ vars.SITE_ENVS }}
      PKG_OWNER: ${{ vars.PKG_OWNER }}
      PKG_USER: ${{ vars.PKG_USER }}
      PKG_TOKEN: ${{ secrets.PKG_TOKEN }}
      KEEP_VERSIONS: '3'
    steps:
      - uses: actions/checkout@v4
      - name: Build and publish site packages
        run: bash .forgejo/scripts/build-publish.sh

The schedule deserves a word. Hugo leaves out posts with a date in the future. If you write a post today and give it next Monday’s date, it appears with the first nightly build after that date. A simple way to schedule posts, without any “scheduler” running anywhere.

The real work happens in .forgejo/scripts/build-publish.sh. It builds the site once per environment, adds the search index, and uploads the result as a new version of a generic package:

#!/bin/bash
# build-publish.sh - build the Hugo site once per environment and upload
# each build as a version of a Forgejo generic package.
#
# Package name : blog-<environment>
# Version      : <UTC timestamp>-<12 char commit sha>
#                The timestamp prefix makes versions sort correctly as
#                plain strings, which is how the web host picks "newest".
# Files        : site.tar.gz and site.tar.gz.sha256

set -euo pipefail

: "${FORGE_URL:?FORGE_URL not set}"
: "${PKG_OWNER:?PKG_OWNER not set}"
: "${PKG_USER:?PKG_USER not set}"
: "${PKG_TOKEN:?PKG_TOKEN not set}"
SITE_ENVS=${SITE_ENVS:-staging}
KEEP_VERSIONS=${KEEP_VERSIONS:-10}

SHA=${GITHUB_SHA:-$(git rev-parse HEAD)}
VERSION="$(date -u +%Y%m%dT%H%M%SZ)-${SHA:0:12}"
PKG_API="$FORGE_URL/api/packages/$PKG_OWNER/generic"
AUTH=(--user "$PKG_USER:$PKG_TOKEN")

for env in $SITE_ENVS; do
  pkg="blog-$env"
  out="$PWD/_out/$env"
  rm -rf "$out"
  mkdir -p "$out"

  echo ">>> Building environment '$env' as $pkg $VERSION"
  # Drafts are never built: packages may be publicly downloadable.
  hugo --environment "$env" --minify \
       --destination "$out/public" --cleanDestinationDir

  # Static full-text search index (served from /pagefind/).
  pagefind --site "$out/public" --silent

  tar -C "$out/public" -czf "$out/site.tar.gz" .
  (cd "$out" && sha256sum site.tar.gz > site.tar.gz.sha256)

  # Upload the tarball first and the checksum last. The web host treats
  # a version without a checksum as "not ready yet" and retries later.
  for f in site.tar.gz site.tar.gz.sha256; do
    curl -fsS "${AUTH[@]}" --upload-file "$out/$f" \
      "$PKG_API/$pkg/$VERSION/$f"
  done
  echo ">>> Uploaded $pkg $VERSION"

  # Keep only the newest KEEP_VERSIONS versions in the registry. The
  # ones that remain are the rollback window for the web host.
  curl -fsS "${AUTH[@]}" \
    "$FORGE_URL/api/v1/packages/$PKG_OWNER?type=generic&q=$pkg&limit=50" \
  | jq -r --arg n "$pkg" \
      '[.[] | select(.name == $n) | .version] | sort | reverse | .[]' \
  | tail -n +"$((KEEP_VERSIONS + 1))" \
  | while read -r old; do
      echo ">>> Pruning $pkg $old"
      curl -fsS "${AUTH[@]}" -X DELETE "$PKG_API/$pkg/$old"
    done
done

Commit both files and push. In the “Actions” tab of your repository you can watch the job run. When it shows a green checkmark, look at the “Packages” tab of the “darkstar” organization: there should be a package “blog-production” with one version.

If your job stays in the “Waiting” state forever, then no runner has the label “docker”. That happened to me: my existing runner only had labels for running Slackware build jobs. Adding a docker label to the runner’s configuration file and restarting the runner fixed it.

Search with Pagefind

You may have noticed the pagefind command in the build script. Search is one of those things that you think needs a server, but Pagefind proves otherwise. After Hugo has written the site, Pagefind reads all the HTML files and creates a compact search index, split into small chunks. A bit of JavaScript on your search page downloads only the chunks it needs for the words someone types, so even a large blog gets a fast search without any search server.

The search page in your theme needs only this:

<link href="/pagefind/pagefind-ui.css" rel="stylesheet">
<div id="search"></div>
<script src="/pagefind/pagefind-ui.js"></script>
<script>
  window.addEventListener('DOMContentLoaded', function () {
    new PagefindUI({ element: '#search', showImages: false });
  });
</script>

Add a data-pagefind-body attribute to the HTML element that holds the text of your posts, so that Pagefind indexes your articles and not the sidebar that is repeated on every page.

The web server pulls the site

Why pull instead of push?

The common way to deploy a website from a CI job is to let the job copy the files to the web server with rsync over SSH. That means storing an SSH private key with write access to your web server in the CI system. I don’t want write-capable SSH keys lying around on Internet-connected machines. And when I move my web server to another provider, I don’t want to touch my build setup.

So the web server fetches the site itself. All it needs is outgoing HTTPS to the forge, and (if your organization is private) a token that can only read packages.

The sitepull script

Save this as /usr/local/sbin/sitepull.sh and make it executable:

#!/bin/bash
# sitepull.sh - pull the newest static site build from a Forgejo generic
# package registry and activate it with an atomic symlink switch.
#
# Usage: sitepull.sh /path/to/site.conf
#
# Layout under SITE_ROOT:
#   current     -> releases/<version>    (Apache DocumentRoot)
#   releases/   one directory per activated build
#   incoming/   temporary download area
#   PIN         optional; contains a version string to stay on
#
# Rollback: echo <version> > $SITE_ROOT/PIN   (next run switches to it)
# Resume  : rm $SITE_ROOT/PIN                  (follow newest again)
#
# Hook: POST_ACTIVATE in the configuration names a command that runs right
# after each switch, when the new build is live (for instance
# mastodon-announce.py to toot new posts). It gets SITE_ROOT, SITE_VERSION
# and SITE_PREVIOUS in its environment. If it fails, sitepull runs it again
# on every following round until it succeeds; a failing hook never stops
# or undoes the switch itself.

set -euo pipefail
umask 022

CONF=${1:?Usage: $0 /path/to/site.conf}
# shellcheck source=/dev/null
. "$CONF"

: "${FORGE_URL:?FORGE_URL not set in $CONF}"
: "${PKG_OWNER:?PKG_OWNER not set in $CONF}"
: "${PKG_NAME:?PKG_NAME not set in $CONF}"
: "${SITE_ROOT:?SITE_ROOT not set in $CONF}"
KEEP_RELEASES=${KEEP_RELEASES:-5}
MIN_FILES=${MIN_FILES:-50}
POST_ACTIVATE=${POST_ACTIVATE:-}
HOOK_TIMEOUT=${HOOK_TIMEOUT:-300}
TAG="sitepull[$PKG_NAME]"

log() { logger -t "$TAG" -- "$*"; }
die() { log "ERROR: $*"; echo "$TAG ERROR: $*" >&2; exit 1; }

CURL=(curl -fsS --retry 2 --connect-timeout 20 --max-time 900)
if [ -n "${READ_TOKEN:-}" ]; then
  CURL+=(-H "Authorization: token $READ_TOKEN")
fi

mkdir -p "$SITE_ROOT/releases" "$SITE_ROOT/incoming"

# One run per site at a time; a slow download must not overlap the next
# cron tick.
exec 9>"$SITE_ROOT/.lock"
flock -n 9 || exit 0

# Run the POST_ACTIVATE hook; remember a failure so the next round retries.
run_hook() {
  [ -n "$POST_ACTIVATE" ] || return 0
  # Word splitting on purpose: POST_ACTIVATE is "command [arguments]".
  # shellcheck disable=SC2086
  if SITE_ROOT="$SITE_ROOT" SITE_VERSION="$1" SITE_PREVIOUS="${2:-}" \
     timeout "$HOOK_TIMEOUT" $POST_ACTIVATE </dev/null; then
    rm -f "$SITE_ROOT/.hook-retry"
  else
    echo "$1" > "$SITE_ROOT/.hook-retry"
    log "post-activate hook failed for $1, will retry next round"
  fi
}

# Decide which version we want: the pinned one, or the newest published.
if [ -s "$SITE_ROOT/PIN" ]; then
  WANT=$(tr -d '[:space:]' < "$SITE_ROOT/PIN")
else
  LIST=$("${CURL[@]}" \
    "$FORGE_URL/api/v1/packages/$PKG_OWNER?type=generic&q=$PKG_NAME&limit=50") \
    || die "cannot query the package list at $FORGE_URL"
  WANT=$(printf '%s' "$LIST" | jq -r --arg n "$PKG_NAME" \
    '[.[] | select(.name == $n) | .version] | sort | last // empty')
fi
if [ -z "$WANT" ]; then
  log "no published version yet"
  exit 0
fi
case "$WANT" in
  *[!A-Za-z0-9._-]*) die "refusing odd version string '$WANT'" ;;
esac

CUR=""
if [ -L "$SITE_ROOT/current" ]; then
  CUR=$(basename "$(readlink "$SITE_ROOT/current")")
fi
if [ "$WANT" = "$CUR" ]; then
  [ -e "$SITE_ROOT/.hook-retry" ] && run_hook "$CUR"
  exit 0
fi

REL="$SITE_ROOT/releases/$WANT"
if [ ! -d "$REL" ]; then
  TMP=$(mktemp -d "$SITE_ROOT/incoming/$WANT.XXXXXX")
  trap 'rm -rf "$TMP"' EXIT
  BASE="$FORGE_URL/api/packages/$PKG_OWNER/generic/$PKG_NAME/$WANT"

  # The CI job uploads the checksum last, so a missing checksum means the
  # upload is still in progress. Fetch it first and retry later if absent.
  if ! "${CURL[@]}" -o "$TMP/site.tar.gz.sha256" "$BASE/site.tar.gz.sha256" 2>/dev/null; then
    log "version $WANT not complete yet, will retry"
    exit 0
  fi
  "${CURL[@]}" -o "$TMP/site.tar.gz" "$BASE/site.tar.gz" \
    || die "download of $WANT failed"
  (cd "$TMP" && sha256sum -c --quiet site.tar.gz.sha256) \
    || die "checksum mismatch for $WANT"

  # Refuse archives with absolute paths, parent directory components,
  # symlinks or hard links. A Hugo build contains none of these.
  if tar -tzf "$TMP/site.tar.gz" | grep -qE '^/|(^|/)\.\.(/|$)'; then
    die "unsafe path names in $WANT"
  fi
  if tar -tvzf "$TMP/site.tar.gz" | grep -q '^[lh]'; then
    die "links found in $WANT"
  fi

  mkdir "$TMP/tree"
  tar -xzf "$TMP/site.tar.gz" -C "$TMP/tree" \
      --no-same-owner --no-same-permissions
  chmod -R u=rwX,go=rX "$TMP/tree"

  # Sanity checks against an empty or truncated build.
  [ -f "$TMP/tree/index.html" ] || die "$WANT has no index.html"
  N=$(find "$TMP/tree" -type f | wc -l)
  [ "$N" -ge "$MIN_FILES" ] || die "$WANT has only $N files (minimum $MIN_FILES)"

  mv "$TMP/tree" "$REL"
fi

# Atomic switch: create the new symlink beside the old one, then rename
# it over the old one. Apache never sees a missing DocumentRoot.
ln -sfn "releases/$WANT" "$SITE_ROOT/current.new"
mv -Tf "$SITE_ROOT/current.new" "$SITE_ROOT/current"
log "activated $WANT (previous: ${CUR:-none})"
run_hook "$WANT" "$CUR"

# Remove old releases, never the active one.
find "$SITE_ROOT/releases" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \
| sort | head -n -"$KEEP_RELEASES" \
| while read -r old; do
    [ "$old" = "$WANT" ] || rm -rf -- "${SITE_ROOT:?}/releases/$old"
  done

A few things in there are worth pointing out, because they make the difference between “works on a sunny day” and “never breaks the site”:

  • The build job uploads the checksum file last. The script fetches the checksum first. If it is not there yet, the upload is still in progress, and the script simply tries again at the next cron run. You’ll never activate a half-uploaded site.
  • The new site is unpacked next to the old one, and then a symlink is switched over with an atomic mv. Apache never sees a missing or half-filled DocumentRoot.
  • Old builds are kept on disk. If a new build turns out to be broken, you go back with one command: echo <version> > /usr/local/blog/PIN. Remove the PIN file when the problem is fixed.
  • After the switch, the script can run a command of your choice: the POST_ACTIVATE hook. At that moment the new build is live, which makes it the perfect place to tell the world about a new post. More about that in “Announcing new posts on Mastodon” below. Without a POST_ACTIVATE line in the configuration, nothing happens.

The configuration file /etc/sitepull/blog.conf:

FORGE_URL=https://forge.darkstar.lan
PKG_OWNER=darkstar
PKG_NAME=blog-production
SITE_ROOT=/usr/local/blog

# Only needed when the package owner is not publicly visible.
# Use a token with the package READ scope only.
READ_TOKEN=

KEEP_RELEASES=5
MIN_FILES=50

Make that file readable only for the account that runs the script if it contains a token. Then add a cron job, for instance in the crontab of a dedicated unprivileged user that owns /usr/local/blog:

*/5 * * * * /usr/local/sbin/sitepull.sh /etc/sitepull/blog.conf

Run the script once by hand and check your /var/log/messages for the “activated” message.

The Apache virtual host

The VirtualHost for blog.darkstar.lan gets this configuration block:

    # The symlink is switched atomically by sitepull.sh.
    DocumentRoot "/usr/local/blog/current"
    <Directory "/usr/local/blog">
        Options FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>

    # Hugo's own "page not found" page, in the blog's layout.
    ErrorDocument 404 /404.html

Check your Apache configuration for global Alias directives before you start. My server had an old Alias /css in a global configuration file which silently hijacked the stylesheet of the new blog. I moved all the theme’s files under a /_ap/ prefix (“Alien Pastures”) to stay clear of such collisions.

Comments with Artalk

Artalk is a self-hosted comment system: a small server written in Go, plus a JavaScript widget that you put on your pages. Readers enter a name and an email address (no account, no third-party login), and the comment is stored in a SQLite database on your own server. It supports threaded replies, email notifications, a moderation queue, Akismet spam checking, and it can import comments from other systems.

I looked at several alternatives. Artalk was the winner for me. It does not require any credentials like OpenID Connect or social login for commenters. People should be able to comment with just a name and an email address, as they could on WordPress. It also offers a moderation queue for comments from new people, and a good import tool.

Docker Compose

Create /opt/artalk/docker-compose.yml. All of Artalk’s settings can be given as environment variables, so you never have to edit its own configuration file:

services:
  artalk:
    image: artalk/artalk-go:2.10.1
    container_name: artalk
    restart: unless-stopped
    # Only Apache on this host talks to Artalk; it terminates TLS.
    ports:
      - "127.0.0.1:23366:23366"
    volumes:
      - /usr/local/artalk:/data
    environment:
      TZ: "Europe/Amsterdam"
      ATK_TIMEZONE: "Europe/Amsterdam"        # the default is Asia/Shanghai
      ATK_LOCALE: "en"

      ATK_SITE_DEFAULT: "My Blog"
      ATK_SITE_URL: "https://blog.darkstar.lan"
      ATK_TRUSTED_DOMAINS: "https://blog.darkstar.lan"

      # Behind Apache: take the reader's address from X-Forwarded-For,
      # otherwise rate limits and Akismet only see the proxy.
      ATK_HTTP_PROXY_HEADER: "X-Forwarded-For"

      # Your admin account, created or updated at every start.
      ATK_ADMIN_USERS_0_NAME: "alien"
      ATK_ADMIN_USERS_0_EMAIL: "alien@darkstar.lan"
      ATK_ADMIN_USERS_0_PASSWORD: "${ARTALK_ADMIN_PASSWORD}"
      ATK_ADMIN_USERS_0_BADGE_NAME: "Post author"
      ATK_ADMIN_USERS_0_BADGE_COLOR: "#1abc9c"

      # A second admin, used only by the moderation sidecar.
      ATK_ADMIN_USERS_1_NAME: "moderator-bot"
      ATK_ADMIN_USERS_1_EMAIL: "moderator-bot@darkstar.lan"
      ATK_ADMIN_USERS_1_PASSWORD: "${ARTALK_BOT_PASSWORD}"
      ATK_ADMIN_USERS_1_RECEIVE_EMAIL: "false"

      # Moderation and anti-spam.
      ATK_MODERATOR_PENDING_DEFAULT: "true"   # every new comment waits
      ATK_MODERATOR_AKISMET_KEY: "${ARTALK_AKISMET_KEY}"
      ATK_CAPTCHA_ALWAYS: "false"
      ATK_CAPTCHA_ACTION_LIMIT: "3"
      ATK_CAPTCHA_ACTION_RESET: "60"

      # Mail: notify me about new comments.
      ATK_EMAIL_ENABLED: "true"
      ATK_EMAIL_SEND_TYPE: "smtp"
      ATK_EMAIL_SMTP_HOST: "${ARTALK_SMTP_HOST}"
      ATK_EMAIL_SMTP_PORT: "${ARTALK_SMTP_PORT}"
      ATK_EMAIL_SMTP_USERNAME: "${ARTALK_SMTP_USERNAME}"
      ATK_EMAIL_SMTP_PASSWORD: "${ARTALK_SMTP_PASSWORD}"
      ATK_EMAIL_SEND_ADDR: "${ARTALK_SMTP_FROM}"
      ATK_EMAIL_SEND_NAME: "My Blog"
      ATK_ADMIN_NOTIFY_EMAIL_ENABLED: "true"
      ATK_ADMIN_NOTIFY_NOTIFY_PENDING: "true"

      # Look and feel: pixel-art avatars for people without a Gravatar,
      # no emoticon list from a CDN, no voting.
      ATK_FRONTEND_GRAVATAR_PARAMS: "sha256=1&d=retro&s=240"
      ATK_FRONTEND_EMOTICONS: "false"
      ATK_FRONTEND_VOTE: "false"

The secrets go into /opt/artalk/.env, which Docker Compose reads automatically. Make it readable only by root (chmod 600 /opt/artalk/.env):

ARTALK_ADMIN_PASSWORD='(bcrypt)$2y$10$REPLACE_WITH_YOUR_HASH'
ARTALK_BOT_PASSWORD='(bcrypt)$2y$10$REPLACE_WITH_THE_BOT_HASH'
ARTALK_AKISMET_KEY='REPLACE'
ARTALK_SMTP_HOST='smtp.darkstar.lan'
ARTALK_SMTP_PORT='587'
ARTALK_SMTP_USERNAME='REPLACE'
ARTALK_SMTP_PASSWORD='REPLACE'
ARTALK_SMTP_FROM='comments@darkstar.lan'

Note the single quotes around the bcrypt hashes. A bcrypt hash contains $ characters, and without single quotes Docker Compose tries to expand $2y and $10 as variables, silently mangling your password hash. And yes, it really is ATK_ADMIN_NOTIFY_NOTIFY_PENDING with the double “NOTIFY”: the setting notify_pending lives inside the admin_notify section of Artalk’s configuration.

Start it:

# mkdir -p /usr/local/artalk
# cd /opt/artalk
# docker compose up -d
# docker compose logs -f
Apache reverse proxy for comments.darkstar.lan

These are the bits that you need to copy into the Apache VirtualHost block of the comments server.

    ProxyRequests     Off
    ProxyPreserveHost On
    ProxyPass         "/" "http://127.0.0.1:23366/"
    ProxyPassReverse  "/" "http://127.0.0.1:23366/"
    RequestHeader set X-Forwarded-Proto "https"

One thing to watch out for: when you are logged in as admin, Artalk’s comment box shows a “Dashboard” link that opens the admin panel in a frame on your blog page. If your Apache configuration sends an X-Frame-Options header (many hardening guides recommend that), the browser refuses to show any content from comments.darkstar.lan inside your blog, with an unhelpful “refused to connect”. The fix is a Content Security Policy that explicitly allows your blog to frame the comment server. Modern browsers ignore X-Frame-Options when frame-ancestors is present:

    Header always set Content-Security-Policy "frame-ancestors https://blog.darkstar.lan"
Show the comments on your pages

In your theme, add a partial template (for instance layouts/_partials/comments.html) and include it at the bottom of your post template:

{{- with site.Params.artalk }}
<div id="comments"></div>
<link href="{{ .server }}/dist/Artalk.css" rel="stylesheet">
<script src="{{ .server }}/dist/Artalk.js"></script>
<script>
  Artalk.init({
    el: '#comments',
    server: '{{ .server }}',
    site: '{{ .site }}',
    pageKey: '{{ $.RelPermalink }}',
    pageTitle: '{{ $.Title }}',
    // Oldest comments first, like WordPress.
    listFetchParamsModifier: function (params) { params.sort_by = 'date_asc'; }
  });
</script>
{{- end }}

The pageKey is how Artalk knows which comments belong to which page. Use the page’s path, so that comments survive a change of domain name.

To reply to a comment as the blog’s author: just type your admin name and email address into the comment box. Artalk recognizes them and asks for your password before it accepts the comment. Nobody can post as you without that password. Once you are logged in, your replies are published immediately and carry your “Post author” badge.

Moderation, the WordPress way

With ATK_MODERATOR_PENDING_DEFAULT set to “true”, every new comment waits in the moderation queue until you approve it. That is safe, but it gets tedious. WordPress had a nice rule for this: “comment author must have a previously approved comment”. Your regular readers get through immediately, but the unknown visitors have to wait for you to process the moderation queue.

Artalk does not have that rule, so I wrote a small Python script that adds it. It runs from cron every minute, looks at the comments that arrived since its previous run, and decides:

CommentResult
Same name and email address already has an approved commentapproved, unless Akismet calls it spam or it contains more than 2 links
Uses the name or the email address of an adminstays pending, and gets a warning label in front of the text
Anybody elsestays pending, for you to review

That second rule is there because Artalk only asks for a password when both your name and your email address are entered. Someone who uses your name with a different email address would end up in the queue anyway, but now you can’t approve it by accident.

The script logs in as the “moderator-bot” admin account that we defined in the Docker Compose file, so your own password is never stored in a plain text file. It only uses the Python standard library, so there is nothing to install. You can download it, with its configuration example and a logrotate file, from the artalk directory of the hugo-blog-kit.

# install -m 755 artalk-moderator.py /opt/artalk/
# install -m 600 moderator.conf.example /opt/artalk/moderator.conf
# vi /opt/artalk/moderator.conf        # bot password, Akismet key
# python3 /opt/artalk/artalk-moderator.py --check

The --check verifies the database, the bot’s login and your Akismet key. Then add it to root’s crontab:

* * * * * /usr/bin/python3 /opt/artalk/artalk-moderator.py >> /var/log/artalk-moderator.log 2>&1

Every decision ends up as one line in the log, so you can always see why a comment was or wasn’t approved:

id=20702 user='erics' page=/my-post/ -> approved: known commenter (1 approved), Akismet ham
id=20700 user='alien' page=/my-post/ -> flagged, stays pending: impersonation: uses the name of admin "alien"

Writing posts in your browser with Sveltia CMS

Sveltia CMS is a “Git-based headless CMS”. Behind that mouthful hides something quite elegant. It is a single web page, which you put on your blog at https://blog.darkstar.lan/admin/. When you open it, you log in at your Forgejo server, and from then on Sveltia reads and writes the files in your blog’s git repository through Forgejo’s API. There is no server-side component, no database, no login system of its own. The web server only serves two static files.

Sveltia is a modern rewrite of Netlify CMS (later Decap CMS) and it supports Forgejo directly. It needs Forgejo 12 or newer.

Register an OAuth2 application

In Forgejo, go to Settings > Applications (for your own account, or the organization’s) and create a new OAuth2 application:

Forgejo shows you a Client ID and a Client Secret. You only need the Client ID. Sveltia runs in the browser, so it cannot keep a secret anyway; it uses PKCE instead, a method where the browser proves for every single login that it is the same browser that started that login.

Allow your blog to talk to the forge (CORS)

The Sveltia page on blog.darkstar.lan sends API requests to forge.darkstar.lan. Browsers block such “cross-origin” requests unless the server explicitly allows them. Add this to Forgejo’s app.ini and restart Forgejo. This is the one step in this article that needs the forge’s admin: if that is not you, ask them to add your blog’s address.

[cors]
ENABLED = true
ALLOW_DOMAIN = https://blog.darkstar.lan
METHODS = GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS
HEADERS = Content-Type,User-Agent,Authorization
ALLOW_CREDENTIALS = false

Pay attention to the HEADERS line. Forgejo’s default list does not contain Authorization, and without it you can log in perfectly fine, after which every API call fails.

If you protect your forge with Anubis against AI scrapers (as I do, see my article about the Slackware forge being abused), make sure that /api/ and the token endpoint /login/oauth/access_token bypass Anubis. Sveltia’s API calls come from another website and carry no Anubis cookie, so a challenge page would break them. The login page itself can stay behind Anubis.

So what happens if you are not the admin of your forge, and the admin does not want to touch the CORS settings? There is a way around it that only involves your own web server. Let Apache pass the editor’s API calls on to the forge, under the blog’s own address. Add the following to the VirtualHost block of your blog’s webserver:

    SSLProxyEngine on
    ProxyPass        "/_forge/api/" "https://forge.darkstar.lan/api/"
    ProxyPassReverse "/_forge/api/" "https://forge.darkstar.lan/api/"

Then we make two changes to the Sveltia configuration (see further down for the details of static/admin/config.yml). Point Sveltia’s api_root at https://blog.darkstar.lan/_forge/api/v1 instead of https://forge.darkstar.lan/api/v1 and add auth_methods: [token]. The browser now only ever talks to your blog, so no CORS is involved. There’s a price to pay of course. Instead of the comfortable “Sign in with Forgejo”, you sign in once with a personal access token (scopes: user read, repository and issue read/write), which you create in your forge account. I tested this on my own staging site with the forge’s CORS setting switched off, and the whole cycle of draft, review and publish worked. The hugo-blog-kit README describes both variants.

The admin page

Create two files in your site’s static/ directory. The first one is static/admin/index.html:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="robots" content="noindex, nofollow">
  <title>My Blog - write</title>
  <script src="https://unpkg.com/@sveltia/cms@0.245.1/dist/sveltia-cms.js"
          integrity="sha384-WtLM0kE6Istn0n75BQVe+QHHleDS926pjdktjJ16OITlVqpJFAiD69ErfPcwrBvB"
          crossorigin="anonymous"></script>
</head>
<body></body>
</html>

The code is always downloaded from unpkg.com. I pin an exact version of Sveltia, and the integrity attribute makes the browser refuse the script if the file on the CDN does not match. Sveltia releases a new version almost every day and I’d rather upgrade deliberately than break my editor unwittingly.

The second file, static/admin/config.yml, tells Sveltia where your repository is and what a post looks like:

backend:
  name: gitea                     # also the right name for Forgejo
  repo: darkstar/blog
  branch: main
  base_url: https://forge.darkstar.lan
  api_root: https://forge.darkstar.lan/api/v1
  app_id: 12345678-abcd-ef01-2345-6789abcdef01    # your Client ID

# Drafts live on their own branch with a pull request, so they never
# reach "main" and never trigger a build. "Publish" merges them.
publish_mode:
  type: editorial_workflow
  direct_publish: true

media_folder: static/images
public_folder: /images

collections:
  - name: posts
    label: Posts
    label_singular: Post
    folder: content/posts
    # content/posts/2026/<name>/index.md, images in the same folder.
    path: "{{year}}/{{slug}}/index"
    extension: md
    format: yaml-frontmatter
    create: true
    media_folder: ""
    public_folder: ""
    fields:
      - { label: Title, name: title, widget: string }
      - label: Body
        name: body
        widget: markdown
        editor_components: [image, code-block, table, hr]
      - label: Publication date
        name: date
        widget: datetime
        default: "{{now}}"
        format: "YYYY-MM-DDTHH:mm:ssZ"
      - label: Categories
        name: categories
        widget: select
        multiple: true
        options:
          - { label: Linux, value: linux }
          - { label: Software, value: software }
      - { label: Tags, name: tags, widget: list, required: false }
      - { label: Allow comments, name: comments, widget: boolean, default: true }

Commit, push, wait for the build, and open https://blog.darkstar.lan/admin/. Click “Sign in with Forgejo”, approve the “Authorize My Blog CMS?” question on your forge, and you’re in.

Drafts, review, publish

I use Sveltia’s “editorial workflow”. When you save a new post, Sveltia creates a branch cms/posts/<name> and a pull request on the forge. Your post can be a Draft, In Review, or Ready, and none of that triggers a build, because the build workflow only reacts to the “main” branch. When you click “Publish”, Sveltia merges the pull request into main. That push starts the build, and a few minutes later your post is on your blog.

One thing to get used to: your blog’s repository now has two writers. Every “Publish” in Sveltia is a commit on the forge. If you also work on your theme in a local clone, always start with a git pull (and I recommend git config pull.rebase true in that clone), or git will refuse your next push.

Making the editor feel like WordPress

Out of the box, Sveltia’s editor gives you bold, italic, strikethrough, links, headings, lists, quotes, code blocks and images. That’s a good start, but I am used to the WordPress classic editor. I needed to add the missing functionality that allows me to keep on writing articles in my own recognizable style.

Sveltia can be extended with your own “editor components” through a small JavaScript API. I wrote a few, in one file that is loaded right after Sveltia:

  • Image with size and alignment: Choose icon (64 px), small, medium, full width, original or a custom width; left, right, centred or none; a caption; and a link to the full-size image or to a web address. It is stored as a Hugo “shortcode” in the Markdown text, and a template in my theme creates real resized copies of the image (plus a double-size version for sharp display on high-resolution screens), just like WordPress made its thumbnails.
  • Coloured text: I added the colours I used to use.
  • Underlined text, a YouTube video (click-to-load, nothing is loaded from Google until the reader clicks “Play”), and the "Continue reading" cut.
  • A preview pane that uses the blog’s own stylesheet, so the preview looks like the published post.

To show you how little code such a component needs, here is the coloured text button:

CMS.registerEditorComponent({
  id: 'colored-text',
  label: 'Coloured text',
  icon: 'format_color_text',
  trigger: 'button',
  mode: 'dialog',
  summary: '{{text}}',
  fields: [
    { name: 'text', label: 'Text', widget: 'string' },
    { name: 'color', label: 'Colour', widget: 'select', default: '#008000',
      options: [ { label: 'Green', value: '#008000' },
                 { label: 'Orange', value: '#ff6600' },
                 { label: 'Red', value: '#ff0000' } ] }
  ],
  // How to recognize it in the Markdown text...
  pattern: /<span style="color: (#[0-9a-fA-F]{6});">([^<]*)<\/span>/,
  fromBlock: function (m) { return { color: m[1], text: m[2] }; },
  // ...and how to write it.
  toBlock: function (v) {
    return '<span style="color: ' + v.color + ';">' + v.text + '</span>';
  },
  toPreview: function (v) {
    return '<span style="color: ' + v.color + ';">' + v.text + '</span>';
  }
});

Add colored-text to the editor_components list of the Body field in config.yml, and the button appears in the toolbar. A complete extension file with all of these components is in the hugo-blog-kit, for you to borrow: editor-extensions.js, and the theme’s image shortcode that goes with it.

A small Hugo template change rounds it off: in WordPress, I opened practically every external link in a new browser tab. Markdown has no syntax for that, but Hugo lets you override how links are rendered. A “render hook” in my theme (layouts/_markup/render-link.html) adds target="_blank" to every link that points to another website. I never have to think about it again :-)

Announcing new posts on Mastodon

On WordPress, the Jetpack plugin posted a link to every new article on my Mastodon account. Jetpack did that from inside WordPress, at the moment I pressed “Publish”. A static site has no such moment. Pressing “Publish” in Sveltia only starts a build, and the post appears on the blog some minutes later, when sitepull has fetched the new site.

So that sitepull step is where the announcement happens. The sitepull script has a hook which runs right after it switches to a new build, and a small Python script mastodon-announce.py (standard library only, like the moderation sidecar) hangs from that hook. This has some nice properties:

  • The toot goes out when the post is really live. A toot from the CI job would link to a page that does not exist yet.
  • A post with a date in the future is announced when the nightly build after that date publishes it.
  • The Mastodon token lives on the web server and nowhere else; the forge and the runner never see it.

How does the script know which posts are new? The theme writes a small file /_theme/toots.json with every build, listing the 50 newest posts: their title, URL, date, tags and a fixed id (the post’s folder in the repository). The script remembers the ids of the posts it has seen, and toots every post it has not seen before. Editing a published post, giving it a new title, or rolling back to an older build and forward again, toots nothing. On its first run, the script marks all listed posts as seen without tooting anything, so you don’t flood your followers with your entire archive.

There are a few safety nets, because a misbehaving bot is the last thing you want on your Mastodon account:

  • Posts that are dated more than 30 days ago are never tooted automatically.
  • If more than three new posts show up in a single build, that’s a mass change (for instance a re-import), not new writing. Nothing is tooted and you get an email from cron. You then pick the ones you do want announced.
  • If your Mastodon server is unreachable, sitepull retries on every round until it works. Every toot carries an Idempotency-Key header, so a toot whose answer got lost on the way is not posted twice.

A toot looks like this; the text is the post’s title, the hashtags come from its tags:

Slackware Cloud Server Series, Episode 13: Blogging Platform

https://blog.darkstar.lan/slackware-cloud-server-series-episode-13-blogging-platform/

#Slackware #SlackwareCloudServer #Hugo #Forgejo #Artalk

Mastodon fetches the page to build a preview card below the toot. For a good-looking card, the theme adds a description and an image (the first picture of the post) to every page as og:description and og:image meta tags.

In Sveltia, two new fields under the post body give you control: Toot text, if you want to write the announcement yourself instead of using the title, and Announce on Mastodon, a checkbox to keep a post off Mastodon.

The setup takes five minutes. If you followed Episode 7, your account lives at https://mastodon.darkstar.lan/, but any Mastodon server will do.

First, create the token. In Mastodon, go to Preferences > Development > New application, give it a name (the name of your blog is fine), and in the list of scopes, untick “read”, “write” and “follow” and tick only write:statuses and profile. The script can then post toots, and nothing else: it can’t read your timeline or your direct messages, or follow anyone. Save the application, open it again, and copy “Your access token”.

Install the script and its configuration (both are in the hugo-blog-kit repository), and make the configuration readable only by the account that runs sitepull, because it contains the token:

# install -m 755 mastodon-announce.py /usr/local/sbin/
# install -o someuser -m 600 mastodon-announce.conf.example /etc/sitepull/mastodon-announce.conf

The important lines in /etc/sitepull/mastodon-announce.conf are:

MASTODON_URL=https://mastodon.darkstar.lan
MASTODON_TOKEN=<your access token>
SITE_DIR=/usr/local/blog/current
STATE=/usr/local/blog/mastodon-state.json
LOG_FILE=/usr/local/blog/mastodon-announce.log
EXTRA_HASHTAGS=#Slackware

As the account that runs sitepull, check the configuration, and then let the script record the posts that are already on your blog:

$ python3 /usr/local/sbin/mastodon-announce.py /etc/sitepull/mastodon-announce.conf --check
$ python3 /usr/local/sbin/mastodon-announce.py /etc/sitepull/mastodon-announce.conf --seed

Running the above two commands is mandatory before you put this into production!

Finally, switch on the hook by adding this line to /etc/sitepull/blog.conf:

POST_ACTIVATE="/usr/bin/python3 /usr/local/sbin/mastodon-announce.py /etc/sitepull/mastodon-announce.conf"

If you also run a staging site, make sure that this line does not end up in its configuration, or your test posts will be tooted too. And if you want to see what would happen before you trust the script with your account, run it with --dry-run, or set VISIBILITY=private in its configuration for the first toot.

Check the result

Time to see if everything works together:

  • Open https://blog.darkstar.lan/admin/, write a short post with an image, and save it. On the forge you should see a new branch and a pull request, and no build job.
  • Publish the post. A build job starts in the Actions tab; when it is finished, a new version of the “blog-production” package appears.
  • Within five minutes, your syslog should show sitepull’s “activated” message, and the post is on https://blog.darkstar.lan/.
  • If you set up the Mastodon announcement: a toot with a link to the new post appears on your Mastodon account, and /usr/local/blog/mastodon-announce.log has a line with its URL.
  • Leave a comment on it from a private browser window, with a name and email address that you have never used. It should wait in the moderation queue, and you should get an email.
  • Log in to the Dashboard from the comment box, approve the comment, then post a second comment with the same name and email address. That one should be published within a minute, thanks to the moderation sidecar.
  • Search for a word from your post on the search page.

Coming from WordPress?

My own situation was a migration, not a fresh start: more than 900 posts, 757 tags and more than 20,000 comments, written over eighteen years. A few things that helped:

  • The export: Tools > Export in WordPress gives you a WXR file (an XML file with all your posts, pages, comments, categories and tags). Mine was 31 MB.
  • The conversion: I wrote a Python script that turns the WXR file into Hugo content files. My old posts stay HTML (Hugo can render HTML content files as well as Markdown), so nothing gets lost in a conversion to Markdown. The script also takes care of the WordPress-specific bits like [caption] shortcodes, the automatic paragraph formatting that WordPress applies when it shows a post, and the output of plugins like “List category posts”. It writes the comments in Artalk’s import format, and turns pingbacks into a static “Mentioned elsewhere” list under each post. I cleaned up the script for general use and published it with step-by-step instructions, including the Hugo templates and Apache redirect rules that go with it: wp2hugo.
  • The comments: Artalk’s import command reads the converted comments into its database: docker exec artalk artalk import -y -p '{"target_site_name":"My Blog","target_site_url":"https://blog.darkstar.lan"}' /data/comments.artrans. Your own old comments end up under your admin account if the name and email address in the export match those in the Docker Compose file.
  • The images: I did not put eighteen years of uploaded images into git. The wp-content/uploads directory was copied once to /usr/local/blog-media/ on the web server, and an Apache Alias /wp-content/uploads serves it from there. Only new images, uploaded with Sveltia, live in the git repository.
  • Old URLs: people and search engines will keep using the old WordPress URLs for years. Apache’s mod_rewrite with a RewriteMap (generated by the conversion script) sends /?p=1234 to the right post, /feed/ to the new RSS feed, /2024/01/ to the archive page, and answers 410 Gone to /wp-login.php, /xmlrpc.php and friends. A test script that checks every old post ID against the live site gave me confidence on the day of the switch.
  • Jetpack’s social sharing: the Mastodon announcement described above replaces it. The posts from WordPress are recorded as “seen” on the first run, so switching over does not toot eighteen years of articles. For migrated posts, the theme uses the original image as the preview image, not WordPress’ 150x150 pixel thumbnail.
  • Old links to comments: links like /my-post/#comment-12345 are common on forums. Artalk numbers the comments anew during the import, so the conversion script also writes a small “old number to new number” file, and a few lines of JavaScript in the theme translate the old link into Artalk’s own #atk-comment-678.

Lessons learned

Some things that cost me time, so that they don’t have to cost you time:

  • Hugo ignores symlinked directories in static/. Use rsync or a bind mount if you want to include files from elsewhere in a local preview.
  • Recent Hugo versions refuse to render HTML content files unless you allow it explicitly with security.allowContent in your configuration. You need this for migrated WordPress posts.
  • Use hugo.Data instead of .Site.Data in your templates; the latter is deprecated.
  • Copy-pasted text from WordPress is full of invisible no-break spaces (the classic editor turns a double space into one). Forgejo warns about “invisible Unicode characters” in such files. Writing them as &nbsp; makes them visible and changes nothing in the browser.
  • In an Apache RewriteCond list, every line except the last one before the RewriteRule needs [OR]. Forget one, and the conditions are combined with AND, which silently breaks the whole rule. apachectl configtest will not warn you, because the syntax is valid.
  • The Artalk Docker image defaults to the Asia/Shanghai timezone. You need to set ATK_TIMEZONE and not just the container’s TZ.

Attribution

This platform stands on the shoulders of some great Open Source projects: Hugo, Forgejo, Artalk, Sveltia CMS by Kohei Yoshino, and Pagefind by CloudCannon. The look of this blog is still the Hemingway theme by Anders Norén, which I ported to Hugo.

The migration itself was done in a long series of evening sessions with Claude AI as my sparring partner. As I wrote in my post about the Slackware Cloud Server in real life: AI can be an accelerator, as long as the ideas start with you and the quality control ends with you. Every script in this article ran on my own servers before it ended up here.

Final thoughts

I am really pleased with the result. The blog is faster than it ever was, my server has one PHP application less to worry about, and I write my posts in a browser editor that does what I expect from it. And everything, from the text of every post to every comment, lives on servers that I control.

Is this setup more complex than “install WordPress”? At first sight, the answer is “yes, certainly”. But all the moving parts are small, and each of them does one thing. That’s exactly the UNIX philosophy of “do one thing and do it well”! If the forge is down, the blog keeps working. If the runner breaks, I fix it and the next build catches up. If I want to move the blog to another server, I copy one script and one configuration file.

Leave your comments, suggestions and opinions below. They’ll go through the moderation queue of course, unless you have commented here before ;-)

Thanks for reading. Eric

My LibreOffice packages stop using Google OAuth API keys

LibreOffice logo

Unfortunately, I had to make the decision to remove my personal Google OAuth API keys from the LibreOffice packages that I build and release for Slackware.

During compilation of the libreoffice package, I provide this API key in the build environment, and as a result you can directly read from and write to your Google Drive when editing documents. No local document copies required. This has been my way of building libreoffice for many years. It’s a free service from me to you, and because the volume of users of my package is low enough, I have never been charged money for using Google’s Storage API.

And then, Google made another move to push community initiatives to the margins. There were multiple warnings during the year that I had to provide more personal and consent details for my ‘LibreOffice for Slackware’ API project or else my key would be revoked. All of this to satisfy a Data Safety Program (your data must be safe from me, I get it). I responded that I am an unpaid volunteer who wants to provide the users of his distro packages with the best experience and that I did not have to time or inclination to record product videos to prove that I was not stealing and reselling my users’ data. This was their answer, provided verbatim, which made me decide to just delete the API keys from the Google Cloud Console.

Thank you for your response and for explaining your project’s integration with LibreOffice for the Slackware Linux community. We appreciate the context regarding your build script.

While we understand that your project compiles into a desktop binary package, the Google API Services User Data Policy requires us to verify how your application interacts with Google User Data and displays the OAuth consent screen. Because we cannot interactively test native desktop applications on our end, a demonstration video is a strict requirement for verification and cannot be waived.

Providing this video is straightforward for desktop applications: you simply need to use a screen recording tool to capture your computer screen while running the compiled LibreOffice binary.

Please record a comprehensive new demonstration video that satisfies the following criteria:

In-App Functionality: Demonstrate the full operational functionality of the requested Google Drive scope within the compiled LibreOffice application. (Note: You mentioned users save and read documents stored in “OneDrive” in your email, but we specifically need to see the integration with Google Drive). Source Account Impact: Show the changes triggered in the app reflected in the user’s Google account (e.g., show a document being successfully saved to, or opened from, the user’s Google Drive). Consent Screen: The OAuth consent flow and permission screen must be displayed with all requested scopes fully expanded and readable—if the scopes are obscured, click “Show all services.” Please ensure the URL bar showing your Client ID is visible in the browser when the consent screen pops up. Scope Matching: The scopes requested by your app must exactly match the scopes configured and submitted for verification in the Google Cloud Console. Critical Note For Live Apps: If your integration is already live to your users, do not deploy unverified scopes to production traffic. Instead, trigger new scopes only in a staging environment. If your app has reached its user cap, use a separate project to record the demo. The publishing status should remain “In Production.”

Once you have recorded the new demonstration video, please reply directly to this email with a publicly accessible link (such as YouTube, Vimeo, or a Google Drive link with permissions set to “Anyone with the link can view”) so we can continue the review.

Also, we need you to address the following items for us to continue your app’s verification:

Your privacy policy does not specify any data protection mechanisms for sensitive data. Please take the following action(s) to continue with your request ⤷ Update and resubmit your app in Cloud Console with the following:

A link to the updated privacy policy containing data protection disclosures (Learn more) Important! Once you have addressed the issues above, reply directly to this email to confirm. You must reply to this email after fixing the highlighted issues to continue with the app verification process.

Thank you,

The Third Party Data Safety Team

Future LibreOffice packages provided by me will therefore not have the ability any longer, to connect to Google Drive for document editing. Instead, I advise you to install rclone, which is a powerful tool that allows you to connect to a large amount of online storage facilities and protocols. The instructions to connect Rclone to your Google Drive are available on their website, like they do with all of their supported backend storage options. The result is a locally mounted directory in your Linux filesystem where you can interact with your online documents as if they were stored locally. Rclone does the business of downloading and uploading your document bytes completely transparently.

Apologies for any inconvenience. Gone are the days where Google’s mantra was “don’t be evil”. Eric

Heads-up: Alien Pastures blog will become Hugo-powered

I have been playing with the idea of leaving Wordpress behind as the content publishing platform for my Alien Pastures blog.
Wordpress is great software and it's versatile and offers a wealth of plugins that allow the blog owner to do all kinds of nice stuff. For me it was the ideal solution at the time when I wanted to create a blog and was looking for something self-hosted but also self-contained (the whole blog in one single directory). I was not sure if I would be able to keep running it on the server where the blog was born, therefore something like Wordpress CMS combined with a SQLite file-based database backend was perfect.

That was 16 years ago, and the blog moved servers, grew a lot in content and it uses a proper MariaDB backend now. But it puts a strain on the servers where I host(ed) it; the stable Slackware versions (first 14.2, then 15.0) have become stale and Wordpress started requiring versions of PHP and MariaDB that were not available for the Slackware version I was using... also the blog increasingly needs protection from scammers, spammers, AI-bot-scrapers and hackers; it needs performance tweaks to deal with server load and executing the interpreted PHP code in which Wordpress is written, and there are security vulnerabilities discovered in Wordpress and its plugins all the time.

When today I had to upgrade the Wordpress code and a good ten plugins again because of a un-authenticated Remote Code Execution (RCE) vulnerability, accompanied by stern warnings to "backup your database first!", I knew that my research would ultimately pay off.

I decided to move forward with an experiment I have been conducting for a while. My future blog pages will all be static HTML. Nothing is interpreted, nothing is vulnerable other than potentially Apache or Slackware itself, and I will use a Docker container for a part of the new setup.

That setup is based on a new (private) git repository which will hold my blog's content after it has been converted from Wordpress syntax into Hugo syntax and layout. Hugo is a static site generator, written in Go. How that will work with this git repository?

  • I run a converter on a full export of the Wordpress blog (that's a single XML file containing everything except the media files) to generate a collection of static HTML pages that will become the "legacy" part of the new blog.
  • In a private repository on the Slackware Forge I will store the Hugo framework defining the layout of my blog, the theme for my blog (a Hugo port of the GPL-licensed Wordpress theme 'Hemingway' by Anders Norén which I currently use), the converted legacy (Wordpress) content plus the Sveltia in-browser editor which I will be using to write and publish new articles. Sveltia can read the repository's full content and can also write to that repository.
  • Since a Hugo-generated static web site does not know the concept of a comments section because that goes against the static page concept, I will run a self-hosted Artalk comments server in Docker. My new blog will load the comments below each blog article by asking the Artalk server for them over a trusted connection, protected by Docker secrets.
  • When someone posts a comment, it is held in a moderation queue, unless that someone (the combination of nickname and email address) already has an earlier approved comment, in which case the comment will automatically be approved by a moderator bot within the minute. This moderation plugs into an Akismet anti-spam service just like I have right now on the Wordpress blog. It will prevent me from having to deal with a hundred spam comments per day.
  • When I make a change to the repository (updating the blog layout, adding a new theme, whatever) this triggers a Forgejo CI workflow in git. Those triggers are very similar to Github runners if you use CI on Github (or any other git platform). The Forgejo runner starts a Docker image which contains Hugo; Hugo fetches the repository content, renders the lot into static HTML pages and packs the whole set into a registry package.
  • A cron job on the blog server polls the Forge for updated site content packages every two minutes, and pulls that package when one becomes available. It unpacks the tarball (it's nothing more than that), checks if the sha256 checksum is correct and then refreshes the blog's content - the pages which you are seeing.
  • When I want to write or update an article, I launch Sveltia (via a hidden URL on the blog), login to the Slackware Forge and start writing.  When I click "publish", Sveltia will commit my article to the private repository, triggering the CI workflow, and two minutes later the new article is online.
    When I save an article in Draft, then Sveltia commits the article in a temporary git branch; any branch except "main" will never trigger the CI workflow, so you will never see my drafts by accident :-)

There's a lot of moving parts in that setup, and it is not as straight-forward as Wordpress; but it is a good learning experience into Git workflows. Also, the constituent parts (except for the free tier of the online Akismet anti-spam service) that I deploy locally are not tied to any kind of commercial entity and fully open source. And it's a hundred percent safe solution.

And... you may have noticed that I wrote the above plan in great detail. That is because I have all of this already running as a staging server while I debug this new setup, remove the kinks and tweak everything to my liking. Feel free to look and click around, post comments if you want, but know that all of that will be wiped again when I make the switch. Also the content of that staging server is frozen to the moment when I did the last content conversion. This new post will not appear there.

Have a look at https://hugo.slackware.nl/ and tell me when you find bugs. I need some time for an actual cut-over and I am not yet completely happy with the Sveltia editor setup, so Wordpress will remain the blog's CMS for a while.

The hugo-builder repository on the Slackware Forge on the other hand, is open to anyone who is curious to start experimenting with Hugo themselves; it contains the code that generates the Docker image used by the aforementioned CI workflow.
I added a subdirectory 'workflow-example' which contains a copy of the actual CI runner that I am using for the new Alien Pastures blog. You can copy that into your own repository and rename the directory to '.forgejo'; you'd also have to do some small modifications and define some variables and secrets in your Forge account to make it work for your own future Hugo website.

Daylight Saving Time frustrations

I have a confession to make :-) For years I faced the annoyance that my laptop would not follow the one-hour timeshift when the Daylight Saving Time would change from Summer- to Wintertime or back. I had to manually fix the time for years. My servers are fine always. I never took the time to find the root cause and fix this.
Today I had enough of it and dug into the issue until I found the root cause.

So what is happening?

My laptop’s hardware clock (RTC) is set to localtime instead of UTC. Combine that with the laptop being switched off (and not using NTP) when the DST switch happens and you get my symptoms. How is that?

The RTC only stores a wall-clock value. It has no idea whether that value is CEST or CET. Slackware tracks how to read it in /etc/hardwareclock, which says either "UTC" or "localtime". In localtime mode, rc.S reads the RTC at boot with hwclock --hctosys --localtime, and rc.6 writes the system time back with --systohc at shutdown.

And that results in roughly these events happening this weekend:

  • Saturday 22:00 CEST: I shut down the laptop. The rc.6 script writes “22:00” into the RTC. That means 20:00 UTC.
  • DST switches from Summer- to Wintertime while I am sleeping and the laptop is off.
  • Sunday morning: The laptop is still off but the RTC is battery-powered and has kept ticking. It would show, say, “10:17”. It is still counting in CEST, so that is really 08:17 UTC, which is 09:17 CET.
  • I pour coffee and boot the laptop: hwclock asks the timezone database how to read “10:17” today. The answer is CET (UTC+1), so it sets the kernel to 09:17 UTC.
  • Result: the system clock is now off by an hour in UTC. It displays 10:17 CET while the real time is 09:17 CET.

In spring the same thing happens in the other direction, and the laptop ends up an hour behind. Then - like every time - I correct it by hand, the corrected value gets written to the RTC at the next shutdown, and the mistake is baked in for another six months.

Why is my server not suffering the same fate? Any one of the following would be enough, but my LAN server runs an NTP daemon and is never powered down:

  • Its RTC is set to UTC, so a stored value means the same thing at any time of year.
  • The machine runs ntpd, which corrects the clock after boot anyway.
  • It is not powered off, but instead keeps running through the DST switch. When it is running, the kernel handles DST through the zone file, and the next shutdown writes a correct local value.

A laptop is then of course the worst case: it is often powered off over the weekend of the switch, and it often has no NTP running at boot either.

To fix this:

  1. First, correct the system clock (the laptop must have internet connectivity)
    # ntpdate pool.ntp.org
  2. Write the now-correct time to the RTC, as UTC
    # hwclock --systohc --utc
  3. Tell Slackware's 'rc.S' and 'rc.6' scripts to treat the RTC as UTC from now on
    # echo "UTC" > /etc/hardwareclock

You can then verify the result: a "date -u" command should match the real UTC calue and hwclock should agree:
# date; date -u; hwclock --show

The order matters. If you write the RTC before correcting the system clock, you store the wrong hour, just in UTC this time. The command 'hwclock --utc' also updates the last line of '/etc/adjtime', so hwclock itself and Slackware’s /etc/hardwareclock will agree.

An additional detail to fix: my laptop's time was a few minutes off to start with. This drift happens naturally over time when your computer does not sync to an atomic clock from time to time. To keep the drift away, I enabled the NTP daemon and configured it properly.
Add these two lines to /etc/ntp.conf:

pool pool.ntp.org iburst
restrict source nomodify notrap noquery

Make the rc script executable and start it manually (on next boot, Slackware will do that for you):
# chmod +x /etc/rc.d/rc.ntpd
# /etc/rc.d/rc.ntpd start

Wait a few minutes and then use the 'ntpq' command to verify that your local NTP daemon is syncing with an online timeserver:

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 europe.pool.ntp .POOL.          16 p    -   64    0    0.000   +0.000   0.000
*mc02.root.proje 124.216.164.14   2 u   40   64    1   23.229   -2.486   4.368
+82.67.200.13    192.168.6.8      3 u   39   64    1   38.737   -2.392   3.693
+172-232-208-229 80.192.165.246   2 u   43   64    1   35.452   -7.052   4.751
+178.239.19.57 ( 10.1.105.4       2 u   42   64    1   26.853   +0.143   2.254

The line prefixed with an asterisk '*' shows the actual server your local daemon is syncing to; the ones prefixed with the plus sign '+' are considered good candidates to switch to when needed.

Note that the '/etc/ntp.conf' file in Slackware does not have 'pool' examples, only 'server' examples. You really want to configure a pool of timeservers in order to be resilient against outages. The two lines shown above are essential additions to this file; you don't have to edit anything else.

I learnt something this morning that I should have learnt a long time ago... I hope it helps other people who visit here in future, looking for answers to the same question.

The Slackware Cloud Server, in real life

I have not been very communicative of late. My apologies for that! I am going to fix that with this lengthy write-up.
For months now, I have been emotionally and mentally challenged by the reorganization aka 'transformation' which started in my company in January of 2026 and will continue into the new year, causing loss of jobs and a lot of stress (in my group as well as myself). In order to keep myself busy and distracted from all the hubbub, I play around with fun technology.
What fun tech? Slackware, the distro, feels a bit distant for me these days. I just wished there would be a stable release but I don't control the pace and I've decided that I'll just wait and sit it out. There will be much-needed release at some point, and I have lots of servers that keep me busy (updating their '-current' installations all the time) where a stable release will bring peace of mind. My Slackware related activities mostly revolve around keeping Chromium buildable on the stale Slackware 15.0.
What I do instead to challenge myself with something new is to play around with AI. Yep.
I know the aversion that many people have against AI, its use, the way these LLM's are trained and the detrimental effect they have on parts of the world economy. But, as with the introduction of any new disruptive technology, this is a passing phase and the use of AI will rationalize like it did for the steam engine, the train, the car, the computer, and tamagotchi's.
AI can be used as an accelerator of development, as long as you remain in control of the workflow and the ideas start with you... and the quality control ends with you.
My fascination is with Claude AI, and intellectually I needed to see what the value of such a tool can be to Slackware.

In preparation for my upcoming retirement from work (with a gentle nudge from my current employer ASML) I have been sparring with Claude AI, defining the outlines of multiple small and bigger projects to keep myself busy. One of these projects was already trying to take shape in my head some some years. It answers my question: how to automate the deployment of collaborative web services onto a fresh Slackware server. Eh? Let me refresh your mind then.

In the weeks before the Slackware 15.0 release, already way back in January 2022, I started a blog article series which I called "Slackware Cloud Server". You can find that article series under an easy-to-remember URL https://cloudserver.slackware.nl/ which redirects to one of the pages on this very blog.

The idea behind the Slackware Cloud Server series is written down on its landing page:

This is an article series about using Slackware as your personal cloud platform, running collaborative web-based services on a server which you own and control.
Think of file-sharing, video-conferencing, collaborative document editing, decentralized social media, streaming video and audio, backing up your 2FA codes, syncing files from your desktop and your phone to your cloud server.
And all (or most) of these services are accessible via Single Sign-On: only one user account is needed to access the goodies on your private cloud platform.

The target audience I had in mind? Small communities, families, any group of people basically that has enough of the Big Tech lock-in where your data is no longer your own and being sold to the highest bidder.
I went to great lengths to test, install and then document the steps needed to setup such a server. It took an enormous amount of time to be honest. I have no idea if anyone ever was brave enough to follow the instructions and actually build such a Slackware Cloud :-) I myself put my articles into practice and built a demo server for the Slackware crew, https://tek.slackware.nl/ .

My project is unrelated by the way, to https://slackware.cloud/ which is an evident 'rip-off' of my ideas as outlined in the blog article series ;-) That project is nothing more than some Slackware branding slapped on top of a commercial 3rd-party offering which is not running on Slackware at all. Fine, but I do not want to be associated with it.

Since that Slackware Cloud Server article series, I could never find the time to actually create something that is more than documentation. I was thinking about creating a set of Slackware packages that would install Keycloak, Jitsi, Nextcloud for you - fully pre-configured and ready-to-go. That would be next-level!
Earlier this year I realized that with the use of Claude AI I should be able to accelerate the speed of development of such an ambitious project and finish with something more widely usable. I chose Python as the language for this project (and PyQT6 for the graphical programming), Slackware-current as the target OS, Docker containers to run all the applications; and I made list of all kinds of requirements that would make this a safe-to-deploy solution. I decided to call this project "slackcloud" which is a better name for a Git repository than "slackware-cloud-server".

Right now "slackcloud" is a private repository on the Slackware Forge, i.e. it is not accessible by anyone but me... but that will change in future when the code is stable.

To kick this off, I wrote the premise for the project as a "CLAUDE.md" file, and defined the specifications for my project (some of which I already mentioned higher up). Claude Chat translated these specifications into a design document "DESIGN.md". Claude Code reads these two files from a local git clone on my laptop every time when it starts, and uses it to write the actual code. Claude Chat owns the design and reviews the work that Claude Code delivers, then shares with me the decisions to make before the coding continues (usually to resolve ambiguity in the specifications and sometimes because my ideas are proven to not work in reality), and I test the results.
The project progresses in well-defined stages. That works surprisingly well, with Code and Chat communicating via a "PROGRESS.md" document and challenging each other's assumptions. Every stage results in new, sometimes unexpected findings which then are reconciled and folded into the design. This way of working has been evolving for a few months now, and it's leading to something which I would not have been able to achieve personally in my lifetime. Great care is taken (through my explicit instructions to the AI) to log and document everything that slackcloud does and creates, putting data security and resilient design at first place, editing system files only within the boundaries of text-markers "# BEGIN slackcloud" and "# END slackcloud" ; and  touching nothing of the filesystem except its own staging directory before I deem the new code ready for production.

By now, Claude understands the ins and outs of Slackware and how it's different from other distros, but also the bot respects my own philosophy and how I want things to be done (no Unicode characters in text files please!). Call it "responsible use of AI"; yes you may mock me, I don't care.

Eventually the project deliverable will be a single Slackware package, which - once installed - will give you a "slackcloud" command-line tool plus a PyQt6 GUI. When installing Slack Cloud, you can do that via the CLI on a remote terminal and even if the server is headless, a SSH tunnel will let you run the GUI if you prefer to have the full setup program visible with 'previous' and 'next' buttons.

Keycloak is still used for the Single Sign-On but I am adding new services for which I had not written an article before: Matrix Chat (including Element Web), Dokuwiki (making use of the same farmer/sheep construct that also powers Slack Docs), and Forgejo. Still to add before I am satisfied with the result is Nextcloud AIO (all in one Docker image with Euro-Office, OpenOffice or Collabora Office, the choice will be yours) to complete a solid collaboration platform where a group of people can share and collaborate on documents, chat in realtime and have video conferences (guests allowed).
There will also be a built-from-spec admin page for an administrator to manage user accounts and group memberships a bit more elegantly than going into Keycloak's interface. The admin module will also allow for managing server backups and application upgrades.
A firewall will also be installed, with the rules automatically determined through the Slack Cloud services that are enabled (on top of your own local rules). For that, slackcloud will borrow a firewall generator engine which is another ongoing project of mine, called "Guardian Firewall Engine" which abbreviates to GFE. The abbreviation being a deliberate pun in honor of my ageing EFG (Easy Firewall Generator) at: https://alienbase.nl/efg/ this will be a re-implementation supporting IPv6 and based on nftables instead of iptables. Yet again a private repository on the Slackware Forge for now, but it will be opened up when the code is stable.

Slackcloud version 0.1.0 is already quite capable, fully supporting IPv6, and installs a variety of services, all running in Docker containers. The slackcloud tool also writes a static portal web page as shown in the screenshot where all of the installed web applications are easily accessible. Yes, those are real hostnames, and yes, I am confident that you'll be unable to access them without account. The bots have already found these sites minutes after going live anyway.
You'd also experience when you visit this page, that the Wiki site is still under lockdown (i.e. not released to the public) as an example of how a deployment can stay under the radar until the administrator is satisfied with the initial setup and decides it's time to invite the users.

Your comments and suggestions are welcome as always. Would you use this tool when it becomes available? What would be your primary concern? Why would this be an essential new capability for Slackware users?

Please try to avoid devolving the discussion into an anti-AI campaign, I am not interested in those comments.

Cheers, Eric

Continue reading

« Older posts

© 2026 Alien Pastures · Entries feed

Theme based on Hemingway by Anders Norén — Up ↑