HenniOKF
Documentation

Guide

Operation and backup

Updating, pinning a state, the nightly backup with backup.sh, restoring and faults.

Updating

A new state arises when you push to main: "Check" turns green, "Image" puts a new latest into the registry. On the VPS:

docker compose -f /opt/henniokf/docker/compose.vps.yml up -d

Compose pulls the newest image and restarts the container if it changed. The login to the registry from the installation still applies. The data in the root directory stays as it is. Without pull_policy: always Docker would take an old, locally kept latest.

Afterwards read the commit on /status under "Version". It is the same as in the last green run of "Image":

gh run list --workflow Image --limit 3

When you need git pull: only if docker/compose.vps.yml, docker/vps.env.example or docker/backup.sh change. Then git -C /opt/henniokf pull, add a new variable to docker/.env and start again. Such a change stands in docs/log.md.

Pinning a state

Every image also carries the short commit as a tag. In docker/.env:

HENNIOKF_IMAGE=ghcr.io/arpablo/henniokf:<commit>

Then start again. Back to the newest state: remove the line and start once more.

Without GitHub Actions

If GitHub Actions fails, build the image on the VPS from the clone:

cd /opt/henniokf && git pull && docker/build.sh -t ghcr.io/arpablo/henniokf:latest
docker compose -f /opt/henniokf/docker/compose.vps.yml up -d --pull never

--pull never keeps Compose from replacing the image you just built with the one from the registry. The build needs memory and takes minutes.

The backup

The image can be pulled again at any time, the data in the root directory cannot. In phase 1 that is users/ with the accounts database and the session secret. docker/backup.sh backs them up.

  1. It copies every SQLite database inside the running container with the backup function of SQLite, through better-sqlite3. A plain copy of a running database can be unusable.
  2. It checks every copy with integrity_check.
  3. It packs everything into /srv/henniokf-backup/henniokf-<time>.tar.gz and checks that the archive is readable.
  4. It deletes archives older than 14 days.
  5. Optionally it copies the archive with rsync to a second place.

The application keeps running meanwhile. The script only reads the root directory and ends without error only if the archive is complete and every check passed.

Set it up once, as root, one line for cron:

echo '17 3 * * * root /opt/henniokf/docker/backup.sh >> /var/log/henniokf-backup.log 2>&1' > /etc/cron.d/henniokf-backup

From then on it runs every night at 3:17. Give every project on the same VPS another minute. By hand, for example to try it:

/opt/henniokf/docker/backup.sh
VariableDefaultWhat for
HENNIOKF_DATA/srv/henniokfthe root directory
BACKUP_DIR/srv/henniokf-backupfolder for the archives
BACKUP_DAYS14archives stay this many days
BACKUP_CONTAINERhenniokfthe running container, - for a computer without a container
BACKUP_APP/opt/henniokfthe clone, only with BACKUP_CONTAINER=-
BACKUP_COPY_TOemptyoptionally a target for rsync, such as <user>@<host>:<path>/

A backup on the same VPS protects against own mistakes, not against losing the VPS. That is what BACKUP_COPY_TO is for.

What is backed up stands at the top of the script in two lists:

PARTS=(users)
DATABASES=(users/users.sqlite)

With the later phases more parts come in, such as records and jobs. They go into both lists, see Recipes for extending. Whatever is listed and missing the script skips.

Restoring

docker compose -f /opt/henniokf/docker/compose.vps.yml stop
tar -xzf <archive> -C /srv/henniokf && chown -R 1000:1000 /srv/henniokf
docker compose -f /opt/henniokf/docker/compose.vps.yml start

Useful commands

docker ps                          # which containers run
docker logs --tail 50 henniokf     # the last lines of the log
docker image prune -f              # delete old, unused images
docker exec -it henniokf sh        # a shell in the container

Faults

What you seeCauseWhat helps
docker login or pulling the image failsthe token is fine-grained, lacks read:packages, or expireda token (classic) with only read:packages
network traefik-proxy declared as external, but could not be foundthe network of Traefik has another namethe name in TRAEFIK_NETWORK
invalid certificatethe DNS does not point to the VPS yet, or TRAEFIK_CERTRESOLVER is wrongcheck with dig, read the log of Traefik
404 from TraefikHENNIOKF_HOST or TRAEFIK_ENTRYPOINT is wrongcorrect docker/.env, start again
502 right after the startthe container is not ready yetwait a few seconds
/status reports that a directory cannot be createdthe root directory does not belong to UID 1000chown -R 1000:1000 /srv/henniokf
the first admin cannot be createdHENNIOKF_SYNC_TOKEN empty or typed differentlycheck the value in docker/.env, start again
/status shows the old commit after updating"Image" is not finished or was redlook on GitHub, then start again
the page does not load in a hotel network, in the mobile network it doesa web filter blocks the new domainwork over the mobile network
the backup reports that copying the databases in the container failedthe container does not run or has another namedocker ps, otherwise set BACKUP_CONTAINER

Next: In a web console.