akbennett / lava-docker

Deploying LAVA in a docker image
6 stars 9 forks source link

Debian LAVA docker-container

Designed to build and run a debian-based Docker container with LAVA pre-installed and pre-configured.

Note: At this time, running LAVA in Docker is not formally supported by Linaro or the LAVA team, but the team is exploring the ease of use that docker and containers enable.

To build a new image locally

It may be desired to edit the Dockerfile. This requires locally rebuilding the Docker Image. To build an image locally, execute the following from the directory you cloned the repo:

sudo docker build --pull -t lavadev .

Where lavadev is the Docker image name and can be chosen at the time of build.

To run the image

To run the image from a host terminal / command line execute the following:

sudo docker run -it -v /boot:/boot -v /lib/modules:/lib/modules -v $PWD/fileshare:/opt/fileshare -v /dev/bus/usb:/dev/bus/usb -v /PATH/TO/id_rsa_lava.pub:/home/lava/.ssh/authorized_keys:ro --device=/dev/ttyUSB0 -p 8000:80 -p 2022:22 -h <HOSTNAME> --privileged lavadev

Where HOSTNAME is the hostname used during the container build process (check the docker build log), as that is the name used for the lava-slave. You can use lava-docker as the pre-built container hostname.

In the above command:

A quick test

A script is included in the image to verify that the install was successful. It will kick off several QEMU tests within LAVA. Once kicked off from the command line, progress of the tests can also be monitored from the LAVA web user interface. To execute this command from the container command line, enter /submittestjob.sh. Point your browser to https://localhost:8000/scheduler/alljobs to view the job status.

Pushing jobs from your local host

You can also use the submit python helpers to submit test jobs to the running container. To submit jobs from your host machine you first need to extract the LAVA api key that was defined when building the container, then just use the same scripts that are available in this repository.

Extract the LAVA api key:

sudo docker run lavadev cat /apikey.txt
ss1c4huo3qw9mqnysm367buth09yuqwkohfd3hct0f62dwstmggpdexg1hrrwck5w0g1oxo3nqnx0ny6n38b1uxeo4s8ii6gz1jiles3zhjo1qiyyr0qzqk51prt7sb7

Submit a custom job from your host machine:

echo ss1c4huo3qw9mqnysm367buth09yuqwkohfd3hct0f62dwstmggpdexg1hrrwck5w0g1oxo3nqnx0ny6n38b1uxeo4s8ii6gz1jiles3zhjo1qiyyr0qzqk51prt7sb7 > apikey.txt
./submit.py -k apikey.txt --port 8000 kvm-qemu-aarch64.json
./submityaml.py -k apikey.txt --port 8000 -p qemu.yaml

Running the container as a background service

Edit the Dockerfile to execute the lava-server and output the log files by default (CMD /start.sh && tail -f /var/log/lava-*/*), and detach the running container:

sudo docker run -d -v /boot:/boot -v /lib/modules:/lib/modules -v $PWD/fileshare:/opt/fileshare -v /dev/bus/usb:/dev/bus/usb -v /PATH/TO/id_rsa_lava.pub:/home/lava/.ssh/authorized_keys:ro --device=/dev/ttyUSB0 -p 8000:80 -p 2022:22 -h lava-docker --privileged lavadev

To access the LAVA service log files just run docker logs:

sudo docker logs -f lavadev

Alternative Configuration Options

Known Issues / Warnings

Interesting Docker hub tags