HACKING: Add Containers section

Describes how to set up and run the containers for local testing.
This commit is contained in:
Achilleas Koutsou 2021-01-05 22:36:24 +01:00 committed by Tom Gundersen
parent adf399ddf7
commit 524d8ec42d

View file

@ -1,5 +1,7 @@
# Hacking on osbuild-composer # Hacking on osbuild-composer
## Virtual Machine
*osbuild-composer* cannot be run from the source tree, but has to be installed *osbuild-composer* cannot be run from the source tree, but has to be installed
onto a system. We recommend doing this by building rpms, with: onto a system. We recommend doing this by building rpms, with:
@ -42,3 +44,37 @@ For a quick compile and debug cycle, we recommend iterating code using thorough
unit tests before going through the full workflow described above. unit tests before going through the full workflow described above.
[1]: https://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29 [1]: https://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29
## Containers
*osbuild-composer* and *osbuild-composer-worker* can be run using Docker
containers. Building and starting containers is generally faster than building
RPMs and installing them in a VM, so this method is more convenient for
developing and testing changes quickly.
Each service (*composer* and *worker*) requires a configuration file and a set
of certificates. Use the [`tools/gen-certs.sh`](./tools/gen-certs.sh) script to
generate the certificates (using the test OpenSSL config file):
./tools/gen-certs.sh ./test/data/x509/openssl.cnf ./containers/config ./containers/config/ca
The services also require a config file (each) which they expect to be in the
same directory. The following test files can be copied into it:
cp ./test/data/composer/osbuild-composer.toml ./test/data/composer/osbuild-worker.toml ./containers/config/
The `containers/config` directory will be mounted inside both containers (see
the [`docker-composer.yml`](./distribution/docker-compose.yml) file).
To start the containers, change into the `distribution/` directory and run:
docker-compose up
You can send requests to the *osbuild-composer* container directly using the
generated certificate and client key. For example, from the project root, run:
curl -k --cert ./containers/config/client-crt.pem --key ./containers/config/client-key.pem https://172.30.0.10:9196/api/composer-koji/v1/status
To rebuild the containers after a change, add the `--build` flag to the `docker-compose` command:
docker-compose up --build