Setting Up UVAP
This instruction page guides through the initial installation of UVAP. This procedure has to be executed only once. For upgrade instructions, see Upgrading UVAP.
Some steps are different on Embedded (arm64/aarch64) and PC/Server (x86_64/amd64) architectures, these are indicated below.
All shell commands in the UVAP Documentation have to run successfully.
Always check the return value of an issued command (use echo $?
). If a
command fails (returns a non-zero return value), do not proceed.
Instead, examine the error message printed by the issued command, and
make any steps necessary for the command to succeed. Contact Ultinous support through
email (sent to support@ultinous.com
) if necessary.
Prerequisite
Before starting the installation, ensure that the hardware and software requirements are met according to System Requirements.
Creating UVAP User
Before installing the components of UVAP, create a user named ultinous
,
and add it to the sudo
group. To do so:
Create
ultinous
user:$ sudo adduser ultinous
Add the user to the
sudo
group:$ sudo adduser ultinous sudo $ sudo adduser ultinous docker
Change user through UI (log out, then log in with
ultinous
user).
Installing NVIDIA Video Driver
PC/Server Only
UVAP requires a specific GPU driver installed to run properly. To install NVIDIA® video driver:
Add the
graphics-drivers/ppa
repository to the APT:$ sudo add-apt-repository ppa:graphics-drivers/ppa $ sudo apt update
Install NVIDIA video driver:
$ sudo apt install nvidia-driver-455
It is possible that an other nvidia-driver is already installed by your system, for example
nvidia-driver-450
. In such cases the above command will report failure. Try the following:$ sudo apt install nvidia-driver-455 nvidia-driver-450-
Note the
-
sign at the end. This mean that that package is to be removed.Reboot the node to use the new driver (and log in with
ultinous
user).
Adding Docker Environment
UVAP uses a containerized solution provided by Docker. This also has to be extended with an NVIDIA driver related add-on.
Add Docker source to the APT repositories:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \ sudo apt-key add - $ sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] \ https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $ sudo apt-get install docker-ce
Add the
ultinous
user todocker
UNIX group:$ sudo adduser ultinous docker
Log out from the graphical environment and log in again, to make the previous step take effect.
PC/Server only On the server machine, enable
nvidia-persistenced
to prevent the sleep state of the GPU:$ cd /etc/systemd/system/ $ sudo mkdir nvidia-persistenced.service.d $ cd nvidia-persistenced.service.d/ $ cat | sudo tee override.conf <<EOF [Service] ExecStart= ExecStart=/usr/bin/nvidia-persistenced --user nvidia-persistenced --verbose EOF $ sudo systemctl daemon-reload $ sudo systemctl restart nvidia-persistenced.service
Install NVIDIA Container Runtime:
$ curl -s -L \ https://nvidia.github.io/nvidia-container-runtime/gpgkey \ | sudo apt-key add - $ distribution=$(. /etc/os-release; echo ${ID}${VERSION_ID}) $ curl -s -L \ https://nvidia.github.io/nvidia-container-runtime/${distribution}/nvidia-container-runtime.list \ | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list $ sudo apt-get update $ sudo apt-get install nvidia-container-runtime $ daemonJson="$(\ sudo cat /etc/docker/daemon.json 2> /dev/null || echo {} \ | jq '. += {"runtimes": {"nvidia": {"path": "/usr/bin/nvidia-container-runtime","runtimeArgs": []}}}' \ )" $ echo "${daemonJson}" | sudo tee /etc/docker/daemon.json $ sudo systemctl restart docker
Test the Docker environment:
$ docker run --rm --runtime nvidia \ nvidia/cuda:10.0-runtime-ubuntu18.04 \ nvidia-smi --query-gpu="gpu_name" --format="csv,noheader"
You should see the list of the names of the GPU devices, for example:
GeForce GTX 1050 Ti GeForce GTX 1060 Ti
After the NVIDIA testing, the
nvidia/cuda
Docker image is unnecessary. Remove the Docker image:$ docker image rm nvidia/cuda:10.0-runtime-ubuntu18.04
Starting Kafka
UVAP provides several sample streams over Kafka® where the integrator can connect to and implement custom solutions based on the outcoming streams. The way how Kafka is started is just an example, which can be easily and quickly carried out. The Kafka developer guide covers the necessary steps to permanently install and configure a Kafka environment that is suitable for production use cases. The following steps must be performed in a single boot up period of the node. After a reboot, start over each step. Ultinous redistributes Kafka. The PC/Server edition of Kafka image is the unmodified image from Confluent Inc, for embedded systems, the ARM64 edition is made similar to the Confluent Inc's image.
Edit
/etc/hosts
file: addzookeeper
andkafka
as name for127.0.0.1
:$ echo -e -n "\n127.0.0.1 zookeeper\n127.0.0.1 kafka\n" | sudo tee -a /etc/hosts
Create a separate internal Docker network:
$ docker network create uvap
Later, for each Docker container created in this network, Docker automatically creates a DNS name (resolvable inside this network). The created DNS name is the name of the Docker container, and has the address of the Docker container.
Start or restart a Zookeeper container:
$ docker rm -f zookeeper # Not necessary if not running $ docker run --net=uvap -d --name=zookeeper \ -e ZOOKEEPER_CLIENT_PORT=2181 ultinous/cp-zookeeper:5.4.0
Start or restart a Kafka container:
$ docker rm -f kafka # Not necessary if not running $ docker run --net=uvap -d -p 9092:9092 --name=kafka \ -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 \ -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092 \ -e KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 \ -e KAFKA_MESSAGE_MAX_BYTES=10485760 \ -e KAFKA_LOG_SEGMENT_DELETE_DELAY_MS=4000 \ -e ZOOKEEPER_CLIENT_PORT=2181 \ ultinous/cp-kafka:5.4.0
Wait 30 seconds then check if the containers are still running:
$ docker container inspect --format '{{.State.Status}}' kafka zookeeper
Expected output:
running running
Test Kafka configuration:
Create a Kafka topic:
$ docker exec kafka kafka-topics --create \ --zookeeper zookeeper:2181 --replication-factor 1 --partitions 1 \ --topic test
Expected output:
Created topic "test".
Test the stream:
$ docker exec kafka /bin/bash -c \ 'RND="${RANDOM}${RANDOM}${RANDOM}"; echo $RND | \ kafka-console-producer --broker-list localhost:9092 --topic test \ > /dev/null && kafka-console-consumer --bootstrap-server \ localhost:9092 --topic test --from-beginning --timeout-ms 10000 \ 2> /dev/null | grep -Fq $RND; if [ $? -eq 0 ]; then echo OK; \ else echo ERROR; fi'
It is expected to print
OK
. Running it the first time can also print a warning which is not a problem and can be ignored.
Downloading Helper Scripts
To make the download and configuration of UVAP related data files easier, clone the UVAP repository and fetch the provided helper scripts:
$ cd ~
$ git clone https://github.com/Ultinous/uvap.git uvap
Check the README file for a brief overview of this repository.
Export UVAP_HOME:
$ export UVAP_HOME=~/uvap
$ echo "export UVAP_HOME=${UVAP_HOME}" >> "${HOME}/.bashrc"
Log in to the Docker account:
$ docker login
Installing UVAP
The following script collects all Docker images for UVAP.
Run the install script:
$ "${UVAP_HOME}/scripts/install.sh"
UVAP Configuration
For guidance on configuring UVAP, see Configuring UVAP.
Additional Tools
The following useful utilities can be handy during testing.
Installing VLC media player
VLC media player is a video playback application that can be used to test live streams or playback a pre-recorded file.
To install VLC:
$ sudo apt-get install vlc
Installing FFmpeg
FFmpeg is a command line tool which can convert between different video formats and codecs.
To install ffmpeg:
$ sudo apt-get install ffmpeg