Build Kaapana

It is important to note that the building of Kaapana (including the cloning of the repository etc.) is completely separated from the actual installation / deployment of the platform. Building the repository, which is described in this chapter, refers to the creation of the required containers and Helm Charts needed for an installation. The results of this build (containers and charts) are usually pushed into a registry and downloaded from there for the installation on the actual deployment server (where the platform will be running).

Important

1) Do you really need to build the project?
Only build the project if you don’t have access to an existing registry containing the Kaapana binaries or if you want to setup your own infrastructure. Registry access can be requested from the DKFZ Kaapana Team via Slack.

2) You don’t need to build the repository on the deployment server!
A typical misconception we often hear is that you need to clone the repository on the deployment server and build it there. That is not the case! The repository can be built on a completely different machine and the results then made available via a registry. Practically, it is even recommended to separate the repository and the deployment server. Of course it is possible to build the repository on the deployment server (and there is also the possibility to work completely without a registry) - but this should be done in rather rare cases.

Build Requirements

Perform these steps on the build machine. The recommended build system is Ubuntu 24.04 (x64). Kaapana can only be built and run on x64 systems. Building on other operating systems or architectures has not been tested and may lead to unexpected issues, for which no official support is provided.

Important

Disk space needed:
For the complete build of the project ~90GB (~110GB including build cache) of container images will be stored at /var/snap/docker/common/var-lib-docker.
When creating offline installation tarball, ~80GB additional disk space is needed.

Before you get started you should be familiar with the basic concepts and components of Kaapana (see What is Kaapana?). You should also have the following packages installed on your build-system.

  1. Dependencies

    sudo apt update && sudo apt install -y nano curl git python3 python3-pip
  2. Clone the repository:

    git clone -b master https://github.com/kaapana/kaapana.git
  3. Python requirements

    python3 -m pip install -r kaapana/build-scripts/requirements.txt

    Tip

    Use a virtual environment for installing Python dependencies.
    This is a recommended best practice.

    On Ubuntu 24.04 and similar distributions, due to changes in Python packaging (see PEP 668), installing packages with pip outside of a virtual environment may result in errors or warnings.

    To avoid issues, create and activate a virtual environment before running the requirements installation:

    Recommended for beginners!

    Creation step (only needed once):

    # Install the 'venv' package if not already installed
    sudo apt install -y python3-venv
    
    # Create the virtual environment (only needed once)
    python3 -m venv kaapana/.venv
    

    Activation step (needed each time you use the Python code):

    # Activate the virtual environment
    source kaapana/.venv/bin/activate
    

    Then install the Python requirements.

  4. Snap

    Check if snap is already installed: snap help --all
    If not run the following commands:
    sudo apt install -y snapd
    A reboot is needed afterwards!
  5. Docker

    sudo snap install docker --classic --channel=latest/stable

  6. In order to execute docker commands as non-root user you need to execute the following steps:

    sudo groupadd docker
    sudo usermod -aG docker $USER
    For more information visit the Docker docs
  7. Helm

    sudo snap install helm --classic --channel=latest/stable

  8. Reboot

    sudo reboot

  9. Test Docker

    docker run hello-world
    -> this should work now without root privileges
  10. Helm plugin

    helm plugin install --verify=false https://github.com/instrumenta/helm-kubeval

Start Build

We recommend building the project using a registry. If you do not have access to an established registry, we recommend using Gitlab, which provides a cost-free option to use a private container registry.

python3 build-scripts/cli.py --default-registry <registry-url> registry-username --registry-pw <registry-password>

Note

  1. If the username and password are not working, you may need to use an access token instead.

  2. Ensure that the username/access token does not contain spaces.

This takes usually (depending on your hardware) around 1h. You can find the build-logs and results at ./kaapana/build

Hint

You can also set parameters as environment variables or store them in a .env file in your working directory. For a full list of all options execute python3 build-scripts/cli --help

The next step will explain how to install the Kubernetes cluster via the kaapanactl.sh script.