From 524d8ec42d9c84a6a78b5d271e4ea2c416df1d07 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Tue, 5 Jan 2021 22:36:24 +0100 Subject: [PATCH] HACKING: Add Containers section Describes how to set up and run the containers for local testing. --- HACKING.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/HACKING.md b/HACKING.md index eaaa27b27..13a61ea98 100644 --- a/HACKING.md +++ b/HACKING.md @@ -1,5 +1,7 @@ # Hacking on osbuild-composer +## Virtual Machine + *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: @@ -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. [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