Switch to Hugo Website Generator

Switch to Hugo Website Generator

Long time no see. The last days I had some spare time and checked out different static website generators. I got stuck with Hugo and converted my existing website mcbachmann.de and my blog blog.mcbachmann.de to Markdown by using ExitWP for Hugo. After several rounds of learning the peculiarities of Hugo, integrating the existing pictures and reformatting the generated Markdown files I’m now finally able to manage my website with simple text files and don’t have to care about WordPress updates.

Next steps are creating a CI pipeline in my local Gitea & Woodpecker setup so the website automatically gets deployed when I add or change articles. Also the size of the thumbnail images when opening an article is not yet perfect.

Update 2022-04-23

These sites are now automatically deployed by Woodpecker using the following setup.

Dockerfile

FROM alpine:edge
RUN apk --update add --no-cache hugo openssh-client rsync

.woodpecker.yml

---
pipeline:
  docker:
    image: docker
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    commands:
      - cd docker; docker build -t internal/deploy_hugo:latest .

  build:
    image: internal/deploy_hugo:latest
    commands:
      - hugo

  deploy:
    image: internal/deploy_hugo:latest
    commands:
      - mkdir /root/.ssh
      - chmod 700 /root/.ssh
      - echo "$ID_ECDSA" | base64 -d >/root/.ssh/id_ecdsa
      - chmod 600 /root/.ssh/id_ecdsa
      - rsync -avz --delete -e public/ deployuser@myhostname:/var/www/
    secrets: [ id_ecdsa ]

Woodpecker Setup

Create a Woodpecker secret named id_ecdsa (see deploy step) and store your private ECDSA key in Base64 format. Base64 is necessary as copying the ECDSA key into Woodpecker will lose some unprintable characters and produce a malformed key.

Also make sure the repository is marked “trusted” to allow volume mounts.