Previously, I’ve modified the blog post from 2022-01 to update the installation to bookworm. This is a rewrite, based on trixie.
Steps to install openQA (a local copy of openqa.debian.net)
The goal is to install openQA in a local virtual machine with the capacity to run 2 workers.
Prepare the openQA server
- Use qemu with a recent netinst image (at time of writing: trixie 13.1.0 from here). The (non-default) settings for qemu are:
- Memory: 8192MiB (this is enough for openqa (1GiB), 1 big (4GiB) and 1 small worker (2GiB)
- Storage: 80GiB HD, Disk bus=SATA
- Add Hardware/Filesystem: Driver=virtio-9p, Source path=/media/fast Target path=/external_iso_files, Export filesystem as readonly mount=Checked
- Install to the harddisk, using the default answers, except for the following:
- Region: matching my own region and country, but still using en_US.UTF-8 as locale
- Username: user
- Hostname: openqa
- Proxy: http://192.168.122.1:3142 (my local apt-cacher-ng)
- Software: GNOME + ssh server
- Use dep822 for apt (user=root)
apt --yes modernize-sources
rm /etc/apt/sources.list~
rm /etc/apt/sources.list.bak
- Prepare to use fasttrack.debian.net (user=root)
apt-get install fasttrack-archive-keyring
- Activate fasttrack.debian.net (user=root)
cat << EOF > /etc/apt/sources.list.d/fasttrack.sources
Types: deb
URIs: https://fasttrack.debian.net/debian-fasttrack/
Suites: trixie-fasttrack
Components: main
Signed-By: /usr/share/keyrings/fasttrack-archive-keyring.gpg
EOF
- Install required and preferred packages (user=root)
rm /etc/apt/apt.conf # This contains the proxy that was used during the installer
apt-get update # Update the package list
apt-get install auto-apt-proxy
apt-get install aptitude # For looking at package dependencies etc.
apt-get install --yes ansible ssh-askpass rsync # For the configuration of the openqa server
- Install the Debian package openqa and friends (user=root)
apt-get install --yes -t trixie-fasttrack openqa openqa-worker
- Configure openqa (for non-ssl) (user=root)
/usr/share/openqa/script/configure-web-proxy
a2dissite 000-default
a2ensite openqa
systemctl reload apache2
- Configure the login procedure (user=root)
cat << EOF > /etc/openqa/openqa.ini.d/50-download_domains.ini
[global]
# Allowed domains for ISO_URL
download_domains = reproducible-builds.org debian.org
EOF
cat << EOF > /etc/openqa/openqa.ini.d/50-auth.ini
[auth]
# Simple authentication
method = Fake
EOF
- Apply the Debian branding (user=root)
mkdir -p /usr/share/openqa/templates/webapi/branding/openqa.debian.net
cat << EOF > /usr/share/openqa/templates/webapi/branding/openqa.debian.net/sponsorbox.html.ep
<div class="text-end" id="sponsorbox">
<a href="https://www.debian.org" title="Debian"> <img alt="Debian" src="https://www.debian.org/logos/openlogo.svg"> </a>
</div>
EOF
cat << EOF > /usr/share/openqa/templates/webapi/branding/openqa.debian.net/docbox.html.ep
<h1>Welcome to the openQA instance of Debian</h1>
<p>Life is too short for manual testing!</p>
<p><a class="btn btn-primary btn-lg" href="http://open.qa" role="button">Learn more »</a> <a class="btn btn-primary btn-lg" href="https://rclobus.nl/blog/?p=440" role="button">Install your own copy of openQA »</a> <a class="btn btn-primary btn-lg" href="https://rclobus.nl/blog/?p=487" role="button">Work together on tests »</a></p>
EOF
cat << EOF > /etc/openqa/openqa.ini.d/50-branding.ini
[global]
branding=openqa.debian.net
EOF
- Restart the openQA webui (user=root)
systemctl reload openqa-webui
- Download and prepare the tests (user=root)
su geekotest -s /bin/bash
cd /var/lib/openqa/share/tests
git clone https://salsa.debian.org/qa/openqa/openqa-tests-debian.git debian
ln -s debian debian-live
ln -s debian debian-edu
ln -s debian kali
ln -s debian windows
exit # To become root again
- (Re-)generate the default API key on the openQA server, valid for 24 hours (user=user)
openqa-cli api --apibase http://localhost -X GET login | grep "Logged in as"
- Configure the API key, to avoid providing the values on each
openqa-cli command (user=user)
mkdir ~/.config/openqa
cat << EOF >> ~/.config/openqa/client.conf
[localhost]
key = 1234567890ABCDEF
secret = 1234567890ABCDEF
EOF
- Create a new SSH key for Ansible (user=user)
ssh-keygen -t ed25519 -C "VM Debian-openQA"
cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
ssh localhost # Accept the fingerprint with 'yes'
exit # Close the ssh connection
- Configure the openQA server using Ansible (user=user)
cd /var/lib/openqa/share/tests/debian/configuration
# Ugly, needs improvement: create the groups manually and remove the deleted ids
# At the time of writing this, the highest id was 24
for i in $(seq 1 24); do openqa-cli api -X POST job_groups name=dummy_group$i; done
for i in $(seq 1 9) 15; do openqa-cli api -X DELETE job_groups/$i; done
ansible-playbook configure_openqa.yaml -i server_localhost.yaml
- Mount the pre-existing ISOs that have been made available in qemu (user=root)
echo "/external_iso_files /var/lib/openqa/share/factory/iso 9p trans=virtio,ro 0 0" >> /etc/fstab
systemctl daemon-reload
mount /var/lib/openqa/share/factory/iso
Note: this mount point must be unmounted before updating openqa with apt-get
Prepare the openqa-worker
- Disable the (currently) not needed slirp VDE service (user=root)
systemctl disable openqa-slirpvde
- Use the proxy when running installers under openQA (user=root)
cat << EOF > /etc/openqa/workers.ini.d/50-http_proxy.ini
[global]
# Use the proxy (apt-cacher-ng) from the host
HTTP_PROXY = http://192.168.122.1:3142/
# The value http://localhost:9/ could be used for a 'network-access-denied' setting
EOF
- Configure worker 2 with more memory (user=root)
cat << EOF > /etc/openqa/workers.ini.d/55-bigmem-worker.ini
# x86_64 worker for jobs that require more memory
[2]
WORKER_CLASS=qemu_x86_64,qemu_x86_64_bigmem
EOF
- Configure a worker for arm64 (via emulation, slow!) (user=root)
cat << EOF > /etc/openqa/workers.ini.d/60-arm-worker.ini
# arm64 worker
[10]
WORKER_CLASS=qemu_aarch64
QEMU_NO_KVM=1
QEMUCPU=max
QEMUMACHINE=virt,usb=off
EOF
- Configure the secrets (user=root)
cat << EOF > /etc/openqa/client.conf
[localhost]
key = 1234567890ABCDEF
secret = 1234567890ABCDEF
EOF
chown _openqa-worker /etc/openqa/client.conf
chmod 0400 /etc/openqa/client.conf
- Start the cache service (user=root)
systemctl restart openqa-worker-cacheservice
systemctl restart openqa-worker-cacheservice-minion
- Enable the workers (user=root)
systemctl enable openqa-worker@1
systemctl enable openqa-worker@2
systemctl enable openqa-worker@10
- Start the workers (user=root)
systemctl start openqa-worker@1
systemctl start openqa-worker@2
systemctl start openqa-worker@10
Run the first tests
Basic test (amd64)
- Download the netinst image (on the host)
cd /media/fast
wcurl https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-13.1.0-amd64-netinst.iso
- Run the netinst tests (user=user)
openqa-cli api -X POST isos ISO=debian-13.1.0-amd64-netinst.iso DISTRI=debian VERSION=stable FLAVOR=netinst-iso ARCH=x86_64 BUILD=1310
Cross-test (arm64)
- Install the suitable qemu package (user=root)
apt-get install qemu-system-arm
- Download the netinst image (on the host)
cd /media/fast
wcurl https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-13.1.0-arm64-netinst.iso
- Run the netinst tests (user=user)
openqa-cli api -X POST isos ISO=debian-13.1.0-arm64-netinst.iso DISTRI=debian VERSION=stable FLAVOR=netinst-iso ARCH=aarch64 BUILD=1310
A live image (amd64)
- Download the live image (on the host)
cd /media/fast
wcurl https://get.debian.org/images/release/current-live/amd64/iso-hybrid/debian-live-13.1.0-amd64-gnome.iso
- Run the tests (user=user)
openqa-cli api -X POST isos ISO=debian-live-13.1.0-amd64-gnome.iso DISTRI=debian-live VERSION=trixie FLAVOR=gnome ARCH=x86_64 BUILD=1310 CHECKSUM=1886e3fcfdbe60d01ed5e878e143e56ca0443afa8a655404cf3bc057f39a622c
Look at the running builds in openQA
Start firefox and go to ‘http://localhost’ (not https)
Reset the openQA database (to be able to redo some steps)
If you need to reset the database and start from scratch (but you can keep the installed packages and configuration) follow the next steps.
Warning: this will remove all content from the database
- Stop all services (user=root)
systemctl stop openqa-webui
systemctl stop openqa-gru
systemctl stop openqa-websockets
systemctl stop openqa-scheduler
- Drop the database (user=geekotest)
dropdb openqa
There should not be a line like ‘DETAIL: There are N other sessions using the database.’, otherwise a few more openqa-related services need to be stopped
- Regenerate the empty database (user=root)
systemctl start openqa-webui
- Redo the steps with Ansible (see above)
Assumptions
In this blog article, I’ve made the following assumptions:
- On the host, the ISO files are stored in
/media/fast
- On the host,
apt-cacher-ng is running and available inside the VM at 192.168.122.1:3142
Missing sections
- Example command line for cloning an existing job from openqa.debian.net
What’s next?
Create and modify tests: https://rclobus.nl/blog/?p=487