To run this automatically use the ansible repo: https://pagure.io/ansible-openqa-cloud
This repository contains scripts to manually build and run a containerized deployment of openQA. The containers are specifically designed to leverage cloud resources and are customized to support Fedora release and update testing.
data/: The full database shared with the container host. Database logs are indata/log.
/home/fedora/openqa-containers/openqa-database/build-database-image.sh
/home/fedora/openqa-containers/openqa-database/start-openqa-database.sh
/home/fedora/openqa-containers/openqa-database/stop-openqa-database.sh
sudo cp /home/fedora/openqa-containers/openqa-database/openqa-database.service /etc/systemd/system/;
sudo cp /home/fedora/openqa-containers/openqa-database/start-openqa-database.sh /usr/bin/start-openqa-database.sh;
sudo cp /home/fedora/openqa-containers/openqa-database/stop-openqa-database.sh /usr/bin/stop-openqa-database.sh;
sudo systemctl daemon-reload;
sudo systemctl start openqa-database;
The openqa-webserver container runs a backend web server on non-privileged port 8080.
The openqa-webserver container shares these directories with its host:
-
tests/: The full os-autoinst-distri-fedora repository. -
testresults -
images: screenshots -
logs: httpd access and error logs -
hdd/: holds OS images for testing.hdd/fixed: Images in this subdir are exempt from cleanup. Store images that are manually created through createhdds in this subdir.
Note:
- Createhdds has to be run on a Fedora host machine.
- If the host machine is already virtualized as in a cloud instances, it must support nested virtualization, which you can check for by the presence of
/dev/kvm - If copying the images generated by
createhddsfrom another machine, keep them small by preserving sparse allocation. Don't use sftp or scp; instead, use:rsync -avz --sparse fedora@171.1.1.1:<source dir> <dest>/hdd/fixed
Host packages necessary to run createhdds:
sudo dnf install -y python3-libguestfs libvirt-devel virt-install fedfind vim git edk2-ovmf
Helper script to create images for hdd directory:
./run_createhdds.sh -
iso/: holds iso files for testing.iso/fixed: Images in this subdir are exempt from cleanup.cloudinit.isois stored here.
In the openqa-webserver/conf subdirectory copy client.conf.template to client.conf and fill in host and api keys/secrets.
cp /home/fedora/openqa-containers/openqa-webserver/conf/client.conf.template /home/fedora/openqa-containers/openqa-webserver/conf/client.conf;
/home/fedora/openqa-containers/openqa-webserver/build-webserver-image.sh
DETACHED=yes /home/fedora/openqa-containers/openqa-webserver/start-openqa-webserver.sh
The webserver runs as fedora user so make sure that the user will survive closing the session:
sudo loginctl enable-linger fedora
Copy service files and scripts where systemd expects to find them:
sudo cp /home/fedora/openqa-containers/openqa-webserver/openqa-webserver.service /etc/systemd/system/;
sudo cp /home/fedora/openqa-containers/openqa-webserver/start-openqa-webserver.sh /usr/bin/start-openqa-webserver.sh;
sudo systemctl daemon-reload;
sudo systemctl start openqa-webserver;
Verify:
journalctl -f
curl localhost:8080
Logs: /home/fedora/openqa-containers/openqa-webserver/logs
Login through the web UI using a Fedora Account.
https://accounts.fedoraproject.org
To create the first administrator in a new database, from within the openqa-webserver container:
su geekotest; /usr/share/openqa/script/create_admin fake_admin
Manually login through the web UI, then load the tests from inside the openqa-webserver container:
cd /var/lib/openqa/share/tests/fedora/;
./fifloader.py --load templates.fif.json templates-updates.fif.json;Reload the tests:
cd /var/lib/openqa/share/tests/fedora/;
su geekotest -c "git pull";
./fifloader.py --load -u templates.fif.json templates-updates.fif.jsonUse the reverse-proxy container to expose standard HTTP and HTTPS ports. It is the only container that needs to be run as root. It's not necessary to run this container if you're running this locally or without ssl/tls certificates and can use non-privileged ports instead.
If all certificate configurations are removed from the config files, then mod_md will fetch certificates from the MDCertificateAuthority as specified in openqa-proxy-ssl.conf.
If successful then /home/fedora/openqa-containers/openqa-reverse-proxy/log/error_log should say:
AH10085: Init: openqa.fedorainfracloud.org:443 will respond with '503 Service Unavailable' for now. There are no SSL certificates configured and no other module contributed any.
AH00489: Apache/2.4.58 (Fedora Linux) OpenSSL/3.0.9 configured -- resuming normal operations
AH00094: Command line: 'httpd -D SSL'
AH10059: The Managed Domain openqa.fedorainfracloud.org has been setup and changes will be activated on next (graceful) server restart.
Kill the httpd process and restart the server:
httpd -DSSL
Error log should say:
AH00489: Apache/2.4.58 (Fedora Linux) OpenSSL/3.0.9 configured -- resuming normal operations
Remove old symlinks:
rm /etc/httpd/conf.d/privkey.pem;
rm /etc/httpd/conf.d/pubcert.pem;
Copy the new certificates into the config directory within the openqa-reverse-proxy container:
cp /var/lib/httpd/md/domains/openqa.fedorainfracloud.org/privkey.pem /etc/httpd/conf.d/privkey.pem;
cp /var/lib/httpd/md/domains/openqa.fedorainfracloud.org/pubcert.pem /etc/httpd/conf.d/pubcert.pem;
Also copy the new certificates into the config directory so that they will be available to the host when the container stops:
cp /var/lib/httpd/md/domains/openqa.fedorainfracloud.org/privkey.pem /conf/privkey.pem;
cp /var/lib/httpd/md/domains/openqa.fedorainfracloud.org/pubcert.pem /conf/pubcert.pem;
Makes copies of the configuration templates:
cp /home/fedora/openqa-containers/openqa-reverse-proxy/conf/openqa-proxy.conf.template /home/fedora/openqa-containers/openqa-reverse-proxy/conf/openqa-proxy.conf;
cp /home/fedora/openqa-containers/openqa-reverse-proxy/conf/openqa-proxy-ssl.conf.template /home/fedora/openqa-containers/openqa-reverse-proxy/conf/openqa-proxy-ssl.conf;
- Configure the ServerName to the public ip of the host, if the ServerName isn't
openqa.fedorainfracloud.org - Configure all of the rewrite and proxy rules to pass traffic to the private ip of the host
hostname -I - If applicable, place the private ssl/tls certificate key into
/home/fedora/openqa-containers/openqa-reverse-proxy/conf/. Otherwise local certificates will be generated and used.Note: check and change the SELinux context of of keys if necessary
sudo chcon -t container_file_t /home/fedora/openqa-containers/openqa-reverse-proxy/conf/privkey.pem;
sudo chcon -t container_file_t /home/fedora/openqa-containers/openqa-reverse-proxy/conf/pubcert.pem;
ls -laZ /home/fedora/openqa-containers/openqa-reverse-proxy/conf/;
.
Pull the apache server container:
sudo podman pull quay.io/fedora/httpd-24:latest
Start the service:
sudo cp /home/fedora/openqa-containers/openqa-reverse-proxy/openqa-reverse-proxy.service /etc/systemd/system/;
sudo cp /home/fedora/openqa-containers/openqa-reverse-proxy/start-openqa-reverse-proxy.sh /usr/bin/;
sudo systemctl daemon-reload;
sudo systemctl start openqa-reverse-proxy.service;
Verify:
journalctl -f
curl localhost
Logs: /home/fedora/openqa-containers/openqa-reverse-proxy/logs
The openqa-consumer uses fedora-messaging to listen for new builds on the public fedora messaging service and schedules tests for those builds using fedora-openqa.
fedora-messaging
fedora-openqa
Create sure these subdirectories on the host in openqa-consumer/:
mkdir -p /home/fedora/openqa-containers/openqa-consumer/fedora-messaging-logs;
mkdir -p /home/fedora/openqa-containers/openqa-consumer/fedora-openqa;
Make local copies of the config files:
cp /home/fedora/openqa-containers/openqa-consumer/conf/client.conf.template /home/fedora/openqa-containers/openqa-consumer/conf/client.conf;
cp /home/fedora/openqa-containers/openqa-consumer/conf/fedora_openqa_scheduler.toml.template /home/fedora/openqa-containers/openqa-consumer/conf/fedora_openqa_scheduler.toml;
client.confneeds the openqa-webserver plus api keys/secrets. This will authorizefedora-openqa.pyto schedule tests.fedora_openqa_scheduler.tomlalso needs theopenqa_hostnameto be set to webserver ip if not using the defaultopenqa.fedorainfracloud.org. It's not necessary to change the queue ids, because these will be configured by/init_openqa_consumer.sheach time the consumer is run.
/home/fedora/openqa-containers/openqa-consumer/build-consumer-image.sh
Run the ExecStart command available in the openqa-consumer.service config.
Note add to the podman run command the --detach or --tty option depending on whether you want to see the standard output Note define
USE_HTTPS=falseif the webserver does not have valid certificates
sudo cp /home/fedora/openqa-containers/openqa-consumer/openqa-consumer.service /etc/systemd/system/;
sudo systemctl daemon-reload;
sudo systemctl start openqa-consumer;Verify:
journalctl -f
Logs: /home/fedora/openqa-containers/openqa-consumer/fedora-messaging-logs
The openqa-consumer container will schedule tests automatically. To schedule tests manually get a BUILDURL from the "Settings" tab of any test by clicking through the test's coloured dot https://openqa.fedoraproject.org/:
podman exec -it openqa-consumer /bin/bash
source /venv/bin/activate
fedora-openqa fcosbuild -f https://builds.coreos.fedoraproject.org/prod/streams/testing-devel/builds/39.20240401.20.0/x86_64
fedora-openqa compose -f https://odcs.fedoraproject.org/composes/odcs-29778
fedora-openqa compose -f https://kojipkgs.fedoraproject.org/compose/rawhide/Fedora-Rawhide-20240401.n.0/compose
fedora-openqa update -f FEDORA-2024-937be154d8Alternatively, tests can also be schduled manually with openqa-cli, but using this tool requires a manual check of the variables expected by the tests as set out in os-autoinst-distri-fedora/templates.fif.jsontemplates.fif.json.
For example, these commands schedule two tests that must be run in parallel:
openqa-cli api -X POST isos \
ARCH=x86_64 \
BUILD=Fedora-Rawhide-20240206.n.0 \
UP1REL=39 \
DISTRI=fedora \
FLAVOR=universal \
TEST=upgrade_server_domain_controller \
VERSION=Rawhide
openqa-cli api -X POST isos \
ARCH=x86_64 \
BUILD=Fedora-Rawhide-20240206.n.0 \
UP1REL=39 \
DISTRI=fedora \
FLAVOR=universal \
TEST=upgrade_realmd_client \
VERSION=RawhideUse openqa-cli to cancel jobs:
for JOB_ID in {226..342}; do openqa-cli api -X POST jobs/$JOB_ID/cancel; doneThe openqa-worker container shares this directory with its host:
tests/: The full os-autoinst-distri-fedora repository.
cp /home/fedora/openqa-containers/openqa-worker/conf/client.conf.template /home/fedora/openqa-containers/openqa-worker/conf/client.conf;
cp /home/fedora/openqa-containers/openqa-worker/conf/workers.ini.template /home/fedora/openqa-containers/openqa-worker/conf/workers.ini;
- In
client.confand fill in host and api keys/secrets. - In
workers.iniand fill in these values:
| workers.ini | |
|---|---|
HOST = http://172.31.1.1 |
The openqa-webserver host. It's wrong to use localhost since this is the container's localhost. Add port 8080 if not using openqa-reverse-proxy. |
WORKER_HOSTNAME = 172.31.1.1 |
For developer mode: the worker's location for receiving livelog. Don't use localhost |
AUTOINST_URL_HOSTNAME = 172.31.1.1 |
For logging: the worker's location for receiving qemu logs. This is only important for parallel tests. |
To build the openqa worker image:
cd /home/fedora/openqa-containers/openqa-worker/;
./build-worker-image.sh
The script ./start-openqa-worker.sh will kill any existing workers and then start ten new workers by default.
Change the default behaviour by defining values on the command line e.g.
| Example | |
|---|---|
KEEP_EXISTING_WORKERS=yes NUMBER_OF_WORKERS=3 ./start-openqa-worker.sh |
Run three more workers without killing the existing workers. |
NUMBER_OF_WORKERS=0 ./start-openqa-worker.sh |
Stop all existing workers. |
openqa-worker service runs as fedora user so make sure that the user will survive closing the session:
sudo loginctl enable-linger fedora
First set up, but don't start, the openqa-worker.timer to restart the openqa-worker.service workers every 12 hours to avoid filling up the disk with their asset caches.
sudo cp /home/fedora/openqa-containers/openqa-worker/openqa-worker.timer /usr/lib/systemd/system/openqa-worker.timer;
sudo rm -rf /etc/systemd/system/timers.target.wants/openqa-worker.timer;
sudo ln -s /usr/lib/systemd/system/openqa-worker.timer /etc/systemd/system/timers.target.wants/;Next set up, but don't start, the openqa-worker.service:
sudo cp /home/fedora/openqa-containers/openqa-worker/openqa-worker@.service /etc/systemd/system/;
sudo cp /home/fedora/openqa-containers/openqa-worker/start-openqa-worker.sh /usr/bin/start-openqa-worker.sh;
sudo systemctl daemon-reload;Finally, start the timer followed by the workers:
sudo systemctl start openqa-worker.timer;
sudo systemctl start openqa-worker@1.service;The openqa-worker.service will exit, but verify the workers and their ports with podman ps -a.
See also journalctl -f and sudo systemctl status openqa-worker and systemctl list-timers --all; .