Using LAVA & SQUAD with Docker Compose
This repository attempts to provide a reference implementation of deploying LAVA using it's officially distributed docker containers and SQUAD using it's containers.
Install the following.
No configuration should be necessary when running a simple qemu worker.
Note: current master branch contains configuration specific to author's personal LAB. This is limited to:
- ser2net configuration file
- devices connected to ser2net container
make: Deploy following containers:
- lava server
- lava dispatcher
- lava dispatcher http server
- lava dispatcher tftp server
- squad frontend
- squad worker
- squad listener
A user (username admin, password admin) for lava server will automatically be deployed, as well as a qemu device-type and a qemu-01 device. Its health check should run automatically.
SQUAD user 'admin' will be created but it's assigned no password. This is due to missing feature in SQUAD. There will be group 'example' and project 'example' created. LAVA CI backend configured to work with lava server container will also be created. All tokens are exchanged automatically during setup.
make clean: Permanently delete the containers and volumes.
Once up, go to your http://localhost:8080 and log in with admin:admin. You should see qemu-01's health-check running and it should finish successfully. SQUAD frontend operate on port 8000 (http://localhost:8000). Port changes are required as lava dispatched http server occupies port 80.
Back up pgsql from its docker volume
sudo tar cvzf lava-server-pgdata-$(date +%Y%m%d).tgz /var/lib/docker/volumes/lava-server-pgdata
Back up SQUAD home
sudo tar cvzf squad-home-$(date +%Y%m%d).tgz /var/lib/docker/volumes/squad-home
Change the FROM line if any containers are being rebuilt, such as ./server-docker/Dockerfile
The design goal of this repository is to demonstrate how to use the official LAVA and SQUAD docker containers in a native way. Ideally, this means without having to rebuild or modify the containers in any way. In the events that the containers or their entrypoints do need modifications, patches should be pushed upstream to provide interfaces for the given functionality. As the official containers mature, this repository should become more simple.
There are 13 containers defined in docker-compose.yml:
This is an official postgres container, and runs using a docker volume. Using an official postgres container is a lot easier than using the postgres that comes with the lava-server container. This set-up makes data persistant by default, and makes backups easy (if desired).
Note that ./server-overlay/etc/lava-server/instance.conf provides connection details to this database for lava-server.
This is a squid container that serves as an http proxy to the LAVA dispatcher. Its purpose is to cache downloads to a docker volume, to improve performance and prevent duplicate downloads. This is enabled in ./server-overlay/etc/lava-server/env.yaml
This is lava-server (lava master). In order to provision a qemu device automatically, a script at ./server-overlay/root/provision.sh is run at boot time to add a superuser (admin/admin) and a qemu device and qemu worker. The lava-server container's entrypoint.sh needed to be modified to support this functionality - a feature that could be added upstream (see discussion at pkg/docker MR#10 for details).
Several other files are mounted into the container. settings.conf is provided, as well as device and health-check directories.
The lava dispatcher is run using the official container directly. However, to use an actual board container modifications would have to be made in a similar way as they were made to lava-server. Example modifications were done in master branch
This is official httpd container with modified webserver confing. It's used to provide LAVA features like transfer_overlaiy. Container can be shared between multiple dispatchers.
This container launches tftpd-hpa server to provide dispatcher with ability to run TFTP boot type jobs. Container can be shared between multiple dispatchers.
This container runs ser2net providing serial connectivity for dispatcher. Container can be shared between multiple dispatchers
Official rabbitmq container providing messaging queue for SQUAD
This container uses SQUAD image to do initial setup:
- create/migrate database structure for SQUAD
- create SQUAD users
- create example group and project
- configure LAVA CI backend that connects to previously configured LAVA master
This container doesn't restart once it's job is complete
SQUAD frontend. Provides web UI for SQUAD
This container runs SQUAD Celery worker. All SQUAD background tasks are executed here
This container runs SQUAD's "listen" command. It connects to all CI backends that provide notification service. In this case it connects to LAVA master ZMQ publisher.
Scheduler triggers periodic background tasks defined in SQUAD's settings.