# Setup Test Environment for CI/CD This document outlines the steps to set up a test environment for OPEA CI/CD from scratch. The environment will be used to run tests and ensure code quality before PR merge and Release. ## Install Habana Driver (Gaudi Only) 1. Driver and software installation https://docs.habana.ai/en/latest/Installation_Guide/Driver_Installation.html 2. Firmware upgrade https://docs.habana.ai/en/latest/Installation_Guide/Firmware_Upgrade.html ## Install Docker ```shell sudo apt update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin sudo systemctl enable docker.service sudo systemctl daemon-reload sudo systemctl start docker ``` ### Troubleshooting Docker Installation 1. Issue: E: Unable to locate package docker-compose-plugin **solution:** ```shell curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install -y docker-compose-plugin ``` 2. Issue: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.45/containers/json": dial unix /var/run/docker.sock: connect: permission denied **solution:** ```shell # option1. sudo usermod -a -G docker xxx # option2. sudo chmod 666 /var/run/docker.sock ``` 3. Issue: ulimit -n setting. [optional] **solution:** ```shell cat << EOF | tee /etc/systemd/system/containerd.service.d/override.conf [Service] LimitNOFILE=infinity EOF sudo systemctl restart containerd.service ``` 4. Issue: control the maximum number of memory mapped areas that a process can have. [optional] **solution:** ```shell echo "vm.max_map_count=262144" | sudo tee -a /etc/sysctl.conf sudo sysctl -p sysctl vm.max_map_count # check ``` ## Install Conda For e2e test env setup. ```shell wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh ``` ## Install K8S 1. Use kubeadm to setup k8s cluster. https://github.com/opea-project/docs/blob/main/guide/installation/k8s_install/k8s_install_kubeadm.md 2. Install Habana plugins (Gaudi Only) https://docs.habana.ai/en/latest/Installation_Guide/Additional_Installation/Kubernetes_Installation/Intel_Gaudi_Kubernetes_Device_Plugin.html ### Some Test Code after Installation ```shell kubectl get nodes -o wide kubectl get pods -A kubectl get cs kubectl describe node kubectl describe pod ``` Test for Gaudi: ```shell cat <