### Server Installation Script Example Source: https://kaapana.readthedocs.io/en/stable/glossary.html This script is used to install dependencies on the server. It is deprecated and replaced by kaapanactl. ```bash ./kaapana/server-installation/server_installation.sh ``` -------------------------------- ### Install Poetry and Project Dependencies Source: https://kaapana.readthedocs.io/en/stable/installation_guide/build.html Installs Poetry and then installs project dependencies using Poetry. This is a one-time setup step. ```bash # Install Poetry pip install poetry # Create and activate the environment (only needed once) poetry install ``` -------------------------------- ### Install Pipenv and Project Dependencies Source: https://kaapana.readthedocs.io/en/stable/installation_guide/build.html Installs Pipenv and then installs project dependencies using Pipenv. This is a one-time setup step. ```bash # Install pipenv pip install pipenv # Create and activate the environment (only needed once) pipenv install ``` -------------------------------- ### Install Docker on Ubuntu Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Install Docker on Ubuntu using snap. A reboot is required after installation. ```bash sudo apt install -y snapd ``` -------------------------------- ### Install Docker using Snap Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Install the Docker package using snap. This command installs the classic Docker version. ```bash sudo snap install docker --classic --channel=latest/stable ``` -------------------------------- ### Download New Installation Script 0.4.0 Source: https://kaapana.readthedocs.io/en/stable/migration_guide/migration_guide_0.4.html Download the server installation script for the new platform version 0.4.0. This script is used to install the MicroK8s cluster. ```bash curl https://codebase.helmholtz.cloud/kaapana/kaapana/-/raw/0.4.0/server-installation/server_installation.sh -o server-installation-0.4.0.sh ``` -------------------------------- ### Install Server Dependencies (Online) Source: https://kaapana.readthedocs.io/en/stable/installation_guide/server_installation.html Execute the kaapanactl.sh script with sudo to install server dependencies. This command assumes an online installation. ```bash sudo ./kaapanactl.sh install ``` -------------------------------- ### Test Docker Installation Source: https://kaapana.readthedocs.io/en/stable/installation_guide/build.html Runs a simple 'hello-world' container to verify that Docker is installed and functioning correctly, especially for non-root users. ```bash docker run hello-world ``` -------------------------------- ### Install Docker on AlmaLinux Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Install Docker on AlmaLinux using snap. This involves installing EPEL release first. A reboot is required after installation. ```bash sudo dnf install -y epel-release && sudo dnf install -y snapd ``` -------------------------------- ### Download and Install MicroK8s Cluster 0.4.0 Source: https://kaapana.readthedocs.io/en/stable/_sources/migration_guide/migration_guide_0.4.rst.txt Download the installation script for version 0.4.0 and then use it to install the MicroK8s cluster. This sets up the environment for the new platform version. ```shell curl https://codebase.helmholtz.cloud/kaapana/kaapana/-/raw/0.4.0/server-installation/server_installation.sh -o server-installation-0.4.0.sh ``` ```shell sudo ./server-installation-0.4.0.sh ``` -------------------------------- ### Install Longhorn via Helm Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/kaapana_storage.rst.txt Installs Longhorn using Helm, adding the repository, updating it, and performing the installation in the 'longhorn-system' namespace. Ensure to use the correct kubelet root directory for your microk8s setup. ```bash helm repo add longhorn https://charts.longhorn.io helm repo update helm install longhorn longhorn/longhorn \ --namespace longhorn-system \ --create-namespace \ --version 1.10.1 \ --set csi.kubeletRootDir="/var/snap/microk8s/common/var/lib/kubelet" ``` -------------------------------- ### Install Helm Chart Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/application_dev_guide.rst.txt Installs a Helm chart from a local TGZ file. Use this for direct deployment. ```bash helm install hello-world-chart hello-world-chart-0.1.0.tgz ``` -------------------------------- ### Install Helm using Snap Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Install the Helm package manager using snap. This command installs the classic Helm version. ```bash sudo snap install helm --classic --channel=latest/stable ``` -------------------------------- ### Install Dependencies on Ubuntu Source: https://kaapana.readthedocs.io/en/stable/installation_guide/build.html Installs essential build dependencies on Ubuntu systems using apt. ```bash sudo apt update && sudo apt install -y nano curl git python3 python3-pip ``` -------------------------------- ### Install Black Formatter Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/black_formatter.rst.txt Install Black using pip. It requires Python 3.8+. ```bash pip install black ``` -------------------------------- ### Install Kaapana Server (Online) Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/server_installation.rst.txt Execute the kaapanactl.sh script with the 'install' command to set up Kaapana and its dependencies when an internet connection is available. ```bash sudo ./kaapanactl.sh install ``` -------------------------------- ### Install Black and Pre-commit Hook Source: https://kaapana.readthedocs.io/en/stable/development_guide/black_formatter.html Install the pre-commit package and then run it to set up the pre-commit hook for code formatting checks. ```bash pip install pre-commit && pre-commit ``` -------------------------------- ### Install Ubuntu Dependencies Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Installs essential packages for building Kaapana on Ubuntu systems. Run this before cloning the repository. ```bash sudo apt update && sudo apt install -y nano curl git python3 python3-pip ``` -------------------------------- ### Install Docker via Snap Source: https://kaapana.readthedocs.io/en/stable/installation_guide/build.html Installs the Docker engine using snap, ensuring the classic confinement and the latest stable channel. ```bash sudo snap install docker --classic --channel=latest/stable ``` -------------------------------- ### Install Snapd on Ubuntu Source: https://kaapana.readthedocs.io/en/stable/installation_guide/build.html Installs the snapd package manager on Ubuntu systems if it is not already installed. A reboot is required after installation. ```bash sudo apt install -y snapd ``` -------------------------------- ### Download Server Installation Script 0.3.5 Source: https://kaapana.readthedocs.io/en/stable/migration_guide/migration_guide_0.4.html Download the server installation script for version 0.3.5. This script is used for uninstalling the MicroK8s cluster. ```bash curl https://codebase.helmholtz.cloud/kaapana/kaapana/-/raw/0.3.5/server-installation/server_installation.sh -o server-installation-0.3.5.sh ``` -------------------------------- ### Start New Container with Update Scripts Mounted Source: https://kaapana.readthedocs.io/en/stable/migration_guide/migration_guide_0.3.html Starts a new database container, mounting the update scripts directory as a volume. ```bash docker run --name db \ -it --rm \ -p 5432:5432 \ -e POSTGRES_DB=pacsdb \ -e POSTGRES_USER=pacs \ -e POSTGRES_PASSWORD=pacs \ -v ${FAST_DATA_DIR}/postgres-dcm4che9.6:/var/lib/postgresql/data \ -v /path/to/repository/dcm4chee-arc-light/dcm4chee-arc-entity/src/main/resources/sql/psql:/update \ -d ``` -------------------------------- ### Install Helm Chart Locally Source: https://kaapana.readthedocs.io/en/stable/development_guide/application_dev_guide.html Install a packaged Helm chart onto your Kubernetes cluster. ```bash helm install hello-world-chart hello-world-chart-0.1.0.tgz ``` -------------------------------- ### Install Helm Chart with Private Registry Source: https://kaapana.readthedocs.io/en/stable/development_guide/application_dev_guide.html Install a Helm chart, specifying details for a private container registry. ```bash helm install --set-string global.registry_url= --set-string global.credentials_registry_username= --set-string global.credentials_registry_password= hello-world-chart hello-world-chart-0.1.0.tgz ``` -------------------------------- ### Install AlmaLinux Dependencies Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Installs essential packages for building Kaapana on AlmaLinux systems. Run this before cloning the repository. ```bash sudo dnf update && sudo dnf install -y nano curl git python3 python3-pip ``` -------------------------------- ### Install Dependencies on AlmaLinux Source: https://kaapana.readthedocs.io/en/stable/installation_guide/build.html Installs essential build dependencies on AlmaLinux systems using dnf. ```bash sudo dnf update && sudo dnf install -y nano curl git python3 python3-pip ``` -------------------------------- ### Start Existing dcm4che-Postgres Container (v0.2.x) Source: https://kaapana.readthedocs.io/en/stable/_sources/migration_guide/migration_guide_0.3.rst.txt Starts a dcm4che-Postgres container for version 0.2.x. Ensure it accesses the correct database but does not interact with dcm4che. ```shell docker run --name db \ -it --rm \ -p 5432:5432 \ -e POSTGRES_DB=pacsdb \ -e POSTGRES_USER=pacs \ -e POSTGRES_PASSWORD=pacs \ -v ${SLOW_DATA_DIR}/postgres-dcm4che:/var/lib/postgresql/data \ -d ``` -------------------------------- ### Example seg_info.json for NIfTI Segmentations Source: https://kaapana.readthedocs.io/en/stable/_sources/user_guide/workflow_management_system/data_upload.rst.txt Minimal example of seg_info.json for providing segmentation metadata, including algorithm name and label information. ```json { "algorithm": "Ground truth", "seg_info": [ { "label_name": "prostate", "label_int": "1" } ] } ``` -------------------------------- ### Test Docker Installation Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Run a test container to verify that Docker is installed and functioning correctly, especially after configuring non-root user access. ```bash docker run hello-world ``` -------------------------------- ### Start Local Docker Registry Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Start a local Docker registry container with basic authentication enabled. This registry is persistent as long as the container is running. ```bash docker run -d -p 5000:5000 --restart unless-stopped --name registry -v "$(pwd)"/auth:/auth -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd registry:2.8.3 ``` -------------------------------- ### Start New Container with Update Scripts Source: https://kaapana.readthedocs.io/en/stable/_sources/migration_guide/migration_guide_0.3.rst.txt Starts a new PostgreSQL container, mounting the data directory and the dcm4che update scripts volume. ```shell docker run --name db \ -it --rm \ -p 5432:5432 \ -e POSTGRES_DB=pacsdb \ -e POSTGRES_USER=pacs \ -e POSTGRES_PASSWORD=pacs \ -v ${FAST_DATA_DIR}/postgres-dcm4che9.6:/var/lib/postgresql/data \ -v /path/to/repository/dcm4chee-arc-light/dcm4chee-arc-entity/src/main/resources/sql/psql:/update \ -d ``` -------------------------------- ### Install Task API CLI Source: https://kaapana.readthedocs.io/en/stable/development_guide/processing_container_dev_guide.html Install the task-api package from the Kaapana repository using pip. This command is used to set up the CLI for local development. ```bash python3 -m pip install "task-api@git+https://codebase.helmholtz.cloud/kaapana/kaapana.git@develop#subdirectory=lib/task_api" ``` -------------------------------- ### Pull and Install Helm Chart from Repository Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/application_dev_guide.rst.txt Pulls a Helm chart from an OCI repository and then installs it. Useful for deploying charts hosted remotely. ```bash helm pull oci:///hello-world-chart --version 0.1.0 helm install hello-world-chart hello-world-chart-0.1.0.tgz ``` -------------------------------- ### Install and Use Pre-commit Hook Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/black_formatter.rst.txt Install the pre-commit hook to automatically check and format files before committing. This ensures adherence to Black's formatting standards. ```bash pip install pre-commit && pre-commit ``` -------------------------------- ### Add Sleep Command to Installation Script Source: https://kaapana.readthedocs.io/en/stable/faq/server_installation_issues.html Insert a 'sleep 60' command into the installation script immediately after 'snap install microk8s' and 'microk8s start' to provide additional time for microk8s to initialize, potentially preventing installation failures. ```bash sleep 60 ``` -------------------------------- ### Start Kaapana Build Process Source: https://kaapana.readthedocs.io/en/stable/installation_guide/advanced_build_system.html Execute the main build script for Kaapana. Replace placeholders with your registry username and password. ```bash python3 build-scripts/start_build.py -u -p ``` -------------------------------- ### Help for Build Script Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Run this command to view all available options for the build script, which can be useful for customizing the build process. ```bash python3 build-scripts/cli --help ``` -------------------------------- ### Get Kubernetes Pods Source: https://kaapana.readthedocs.io/en/stable/development_guide/application_dev_guide.html Lists all pods running in the Kubernetes cluster across all namespaces. Useful for verifying if your application pod has started successfully. ```bash kubectl get pods -A ``` -------------------------------- ### Example Kaapana Dockerfile for a Workflow Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/how_to_Dockerfile.rst.txt This Dockerfile sets up a Python environment, installs dependencies using a constraints file, copies the workflow script, and defines the execution command. It includes labels for organization. ```docker # Dockerfile # Base Image - Using a slim and small-sized Python base image FROM python:3.9.16-slim # LABELS - To organize Kaapana Docker images LABEL REGISTRY="example-registry" LABEL IMAGE="example-dockerfile-workflow" LABEL VERSION="0.1.0" LABEL BUILD_IGNORE="False" # Setting up the working directory WORKDIR /app # Update pip first and install the necessary Python packages using constraints file COPY files/requirements.txt . RUN pip install --upgrade pip && \ pip install -c https://codebase.helmholtz.cloud/kaapana/constraints/-/raw/0.4.0/constraints.txt -r requirements.txt # Copy only the necessary script to be executed COPY files/example-workflow.py . # Define the command to execute the script CMD ["python3","-u","example-workflow.py"] ``` -------------------------------- ### Install Snapd on AlmaLinux Source: https://kaapana.readthedocs.io/en/stable/installation_guide/build.html Installs the snapd package manager on AlmaLinux systems if it is not already installed. A reboot is required after installation. ```bash sudo dnf install -y epel-release && sudo dnf install -y snapd ``` -------------------------------- ### Initialize Kaapana Development Environment Source: https://kaapana.readthedocs.io/en/stable/_sources/user_guide/extensions.rst.txt Run this script to build base images and push them to the local registry. It also copies an example pyradiomics extractor DAG. ```bash cd /kaapana/app ./init.sh ``` -------------------------------- ### Build Offline Installer Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Execute this command to build the offline installer for the Kubernetes cluster. The installer and tarball will be generated in specified directories. ```bash python3 build-scripts/cli.py --build-only --create-offline-installation --default-registry offline ``` -------------------------------- ### Install MicroK8s Cluster 0.4.0 Source: https://kaapana.readthedocs.io/en/stable/migration_guide/migration_guide_0.4.html Install the MicroK8s cluster using the downloaded server installation script for version 0.4.0. Requires root permissions. ```bash sudo ./server-installation-0.4.0.sh ``` -------------------------------- ### Install Python Requirements Source: https://kaapana.readthedocs.io/en/stable/installation_guide/build.html Installs Python dependencies required for building Kaapana. ```bash python3 -m pip install -r kaapana/build-scripts/requirements.txt ``` -------------------------------- ### Build and Push DAG Installer Image Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/workflow_extension_with_custom_registry.rst.txt Builds and pushes the DAG installer image containing the Airflow code to your custom registry. The version `0.0.0` is required to match the default in the DAG installer chart. ```bash docker build -t ://dag-otsus-method:0.0.0 . docker push ://dag-otsus-method:0.0.0 ``` -------------------------------- ### Build Base Images Locally Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/workflow_dev_guide.rst.txt Builds the base images for CPU, GPU, and installer components using Docker or Podman. Ensure you are in the Kaapana repository root directory. ```bash docker/podman build -t local-only/base-python-cpu:latest data-processing/base-images/base-python-cpu ``` ```bash docker/podman build -t local-only/base-python-gpu:latest data-processing/base-images/base-python-gpu ``` ```bash docker/podman build -t local-only/base-installer:latest services/utils/base-installer ``` -------------------------------- ### Example Processing Container Configuration Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/processing_container_dev_guide.rst.txt A sample JSON configuration for a processing container, including its name, description, templates, environment variables, and command. ```json { "name": "my_algorithm", "description": "Example processing-container for demonstration", "templates": [ { "identifier": "default", "description": "Performs example data processing.", "inputs": [], "outputs": [ {"name": "channel1", "mounted_path": "/home/channel1"}, {"name": "channel2", "mounted_path": "/home/channel2"} ], "env": [ { "name": "TIME_SLEEP", "value": "5", "type": "int", "description": "Number of seconds to sleep before finishing.", "adjustable": true } ], "command": ["python3", "-u", "start.py"] } ] } ``` -------------------------------- ### Install Python Dependencies Source: https://kaapana.readthedocs.io/en/stable/development_guide/application_dev_guide.html Installs the necessary Python packages for the Flask application. Ensure requirements.txt is present. ```bash pip install -r requirements.txt ``` -------------------------------- ### Build and Push Extension Images with EDK Source: https://kaapana.readthedocs.io/en/stable/development_guide/workflow_dev_guide.html Uses EDK scripts to build all base images and push them to the local registry. This method is recommended for local development. ```bash ./init.sh ``` ```bash ./build_extension.sh --dir /kaapana/app/dag/ ``` -------------------------------- ### Run Database Migration Script Source: https://kaapana.readthedocs.io/en/stable/_sources/migration_guide/migration_guide_0.4.rst.txt Make the migration script executable and then run it with root permissions. This script backs up existing databases and prepares for the new version. ```shell sudo chmod +x ./migration_0.3.x-0.4.x.sh ``` ```shell sudo ./migration_0.3.x-0.4.x.sh ``` -------------------------------- ### Transfer Data to New Kaapana Installation Source: https://kaapana.readthedocs.io/en/stable/_sources/migration_guide/migration_guide_0.2.rst.txt After deploying the new Kaapana version, transfer data from the old installation's PACS and Minio directories to the new ones. Ensure to remove existing empty directories in the new installation before copying. ```shell sudo rm -rf /home/kaapana/dcm4che sudo rm -rf /home/kaapana/postgres-dcm4che sudo rm -rf /home/kaapana/minio sudo cp -r /home/kaapana_0.1.3/dcm4che /home/kaapana/dcm4che sudo cp -r /home/kaapana_0.1.3/postgres-dcm4che /home/kaapana/postgres-dcm4che sudo cp -r /home/kaapana_0.1.3/minio /home/kaapana/minio ``` -------------------------------- ### Build Base Images Separately Source: https://kaapana.readthedocs.io/en/stable/development_guide/workflow_dev_guide.html Builds individual base images for CPU, GPU, and installer components. Ensure you are in the Kaapana repository root directory. ```bash cd docker/podman build -t local-only/base-python-cpu:latest data-processing/base-images/base-python-cpu ``` ```bash docker/podman build -t local-only/base-python-gpu:latest data-processing/base-images/base-python-gpu ``` ```bash docker/podman build -t local-only/base-installer:latest services/utils/base-installer ``` -------------------------------- ### Example DAG with KaapanaBaseOperator Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/processing_container_dev_guide.rst.txt Illustrates a basic DAG structure using the legacy KaapanaBaseOperator, showing how workflow directories and environment variables were automatically mounted. ```python dag = DAG(dag_id="my_dag") get_input = GetInputOperator(dag=dag) my_algorithm = MyAlgorithmOperator(dag=dag, input_operator=get_input) get_input >> my_algorithm ``` -------------------------------- ### Check Microk8s Status Source: https://kaapana.readthedocs.io/en/stable/_sources/faq/server_installation_issues.rst.txt This conditional check can be used before re-running an installation script if it was terminated after Microk8s installation but before configuration. ```bash # if microk8s status > /dev/null if false ``` -------------------------------- ### Task JSON Example Source: https://kaapana.readthedocs.io/en/stable/development_guide/processing_container_dev_guide.html A minimal `task.json` example for local execution. It defines task name, API version, Docker image, task template, input/output bindings, and environment variables. ```json { "name": "example-task", "api_version": 1, "image": "kaapana/example:latest", "taskTemplate": "example", "inputs": [ {"name": "channel1", "input": {"host_path": "./data/input1"}}, {"name": "channel2", "input": {"host_path": "./data/input2"}} ], "outputs": [ {"name": "results", "input": {"host_path": "./data/output"}} ], "env": [ {"name": "DUMMY", "value": "5"} ] } ``` -------------------------------- ### Build with Remote Registry Source: https://kaapana.readthedocs.io/en/stable/installation_guide/build.html Use this command to build the project when a remote registry is available. Replace placeholders with your registry URL, username, and password or access token. Ensure the username/access token does not contain spaces. ```bash python3 build-scripts/cli.py --default-registry registry-username --registry-pw ``` -------------------------------- ### Install Flask Requirements Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/application_dev_guide.rst.txt Installs the necessary Python packages for a Flask application. Run this command in your project directory. ```bash pip install -r requirements.txt ``` -------------------------------- ### Verify Longhorn Installation Source: https://kaapana.readthedocs.io/en/stable/installation_guide/kaapana_storage.html Checks the status of Longhorn pods and lists available storage classes to confirm a successful installation. ```bash kubectl get pods -n longhorn-system -o wide ``` ```bash kubectl get storageclass ``` -------------------------------- ### Pull and Install Helm Chart from OCI Repository Source: https://kaapana.readthedocs.io/en/stable/development_guide/application_dev_guide.html Pull a Helm chart from an OCI repository and then install it onto your cluster. ```bash helm pull oci:///hello-world-chart --version 0.1.0 helm install hello-world-chart hello-world-chart-0.1.0.tgz ``` -------------------------------- ### Minimal Example Task JSON Source: https://kaapana.readthedocs.io/en/stable/_sources/development_guide/processing_container_dev_guide.rst.txt A basic task.json configuration for local execution. It defines task name, image, inputs, outputs, and environment variables. ```json { "name": "example-task", "api_version": 1, "image": "kaapana/example:latest", "taskTemplate": "example", "inputs": [ {"name": "channel1", "input": {"host_path": "./data/input1"}}, {"name": "channel2", "input": {"host_path": "./data/input2"}} ], "outputs": [ {"name": "results", "input": {"host_path": "./data/output"}} ], "env": [ {"name": "DUMMY", "value": "5"} ] } ``` -------------------------------- ### Install Python Requirements Source: https://kaapana.readthedocs.io/en/stable/_sources/installation_guide/build.rst.txt Installs the Python dependencies required for building Kaapana. It's recommended to do this within a virtual environment. ```bash python3 -m pip install -r kaapana/build-scripts/requirements.txt ``` -------------------------------- ### Verify GPU Driver Installation Source: https://kaapana.readthedocs.io/en/stable/_sources/faq/microk8s_gpu_issues.rst.txt Run this command to check if your NVIDIA GPU drivers are correctly installed and recognized by the system. ```bash nvidia-smi ```