Skip to content

Restore Imager worker

rgaudin edited this page Dec 10, 2025 · 4 revisions

Restoring from a blank machine / VM

We suppose you have a freshly installed Debian machine / VM

Scaleway

On Scaleway, machines are configured with 2 RAID1 volumes for /boot and /. With the current setup, we want the two 1TB SSD to be on RAID0 for cache+building dir.

# /!\ following is example only. assumes /dev/md1 is composed of /dev/sda3 and /dev/sdb3

# check status of md1
mdadm --detail /dev/md1
# we need to wait until it's clean (synced)

# change level to zero. will remove one member
mdadm /dev/md1 --grow --level=0
# check the name of the device that got removed
mdadm --detail /dev/md1
# and add it back
mdadm /dev/md1 --grow --raid-devices=2 --add /dev/sda3
# should answer that it's now RAID4.
# Wait for it to rebuild again and indicates raid0 with 2 members
mdadm --detail /dev/md1
mdadm --detail /dev/md1

# then resize the filesystem to grow up to the array size
resize2fs -f -p /dev/md1

Basic machine configuration

Follow the normal node setup procedure (up to what is specific to k8s): https://github.com/kiwix/k8s/wiki/Machine-and-k8s-node-Setup

Docker

Install Docker by following documentation at https://docs.docker.com/engine/install/debian/

Imager configuration

Restore the imager configuration at /etc/imager.config ; this file contains secret values (to connect to S3) so it is kept by admins in their Key Vault

Sample file:

USERNAME="--------------"
PASSWORD="--------------"
CONTAINER="imager-worker"
IMAGE="ghcr.io/offspot/imager-worker:latest"
#IMAGE="ghcr.io/offspot/cardshop-worker:imager"
S3_ACCESS_KEY="-------------"
S3_SECRET_KEY="--------------------"

Restore the startup script from https://github.com/offspot/imager-service/blob/main/contrib/imager-worker-restart.sh to /usr/local/bin/imager-worker-restart

curl -L -o /usr/local/bin/imager-worker-restart https://raw.githubusercontent.com/offspot/imager-service/main/contrib/imager-worker-restart.sh
chmod +x /usr/local/bin/imager-worker-restart
mkdir -p /data/imager

Cache policy

Restore the startup script from https://raw.githubusercontent.com/offspot/imager-service/main/contrib/cache-policy.yaml to /data/cache/policy.yaml

mkdir -p /data/cache
curl -L -o /data/cache/policy.yaml https://raw.githubusercontent.com/offspot/imager-service/main/contrib/cache-policy.yaml

Add worker IP to Wasabi whitelist

If worker IP has changed, update the Wasabi policy containing IP whitelists (remove old worker IP / add new worker IP): arn:aws:iam::100000050990:policy/CardshopWorkers

Running

imager-worker-restart

Clone this wiki locally