Skip to content

Installing Hive as a testserver

Thierry Kühni edited this page Jan 28, 2024 · 15 revisions

In case you have manufactured a Hive testrack, the following guide shows you how to install the software on the raspberry pi to run the Hive software.

Installing the OS

The Hive testserver is built for use on a headless Raspberry Pi OS. It is recommended to use the Raspberry Pi Imager to automatically download and flash the OS to your SD-Card.

In the imager, select the 64-Bit Raspberry Pi OS Lite version without desktop environment and flash it to your SD-Card. Using the imager's settings you can already enable ssh and set a strong password / use a certificate for later configuration of the Hive testserver.

Once the SD-Card is inserted boot the Raspberry Pi and login via SSH.

Installing the Hive testserver

Prerequisites

There's some tools you need to have installed before being able to run the Hive testserver. First install python and pip to be able to execute the Hive install script:

sudo apt install python3 python3-pip

Toolchains

The Hive testserver needs the ARM and RSCV bare metal toolchains to be able to build the testprogram binaries.

ARM:

Download the ARM bare metal gcc toolchain (AArch32 bare-metal target (arm-none-eabi)) from the ARM website for AArch64 Linux hosts to your Raspberry Pi and install it manually or use the distributed toolchain from the Raspberry Pi OS repository:

sudo apt install gcc-arm-none-eabi

RSICV:

For RISCV targets the gcc riscv-none-elf toolchain is needed. You can either build the toolchain from source (see here for details) or use a pre-built toolchain. A simple way to get a pre-built toolchain is to use xpack. Follow the instructions here to install the pre-built toolchain using xpack.

After installing the toolchains make sure that the binaries are accessible in the PATH so that the Hive testserver can call them.

Running the Hive installer

The Hive installer is a small CLI program that modifies the basic settings of the Raspberry Pi to make it work with the Hive testserver.

Download the cli script to your Raspberry Pi:

TODO

Setup a Python venv:

python3 -m venv hive-setup-venv && source hive-setup-venv/bin/activate

Install its dependencies:

pip3 install -r requirements.txt

Then run the script as superuser in your venv:

sudo ./hive-setup-venv/bin/python3 hive_rpi_setup.py install

The installer contains a wizard which will guide you through the setup process.

First start of the Hive monitor

Once the installer has finished and the Raspberry Pi has rebooted, you can now manually start the monitor binary for the first time to register the first user. The installer has installed the monitor binary in the home directory of the new Hive system user. CD into that directory and execute the monitor binary in init mode. Make sure to execute the binary as the newly created hive user or as superuser:

sudo -u hive ./monitor init

Follow the instructions and create the first admin user for the Hive testrack. This user has access to the testserver backend webapp and is able to create more Hive users for accessing the testserver.

Installing the SSL certificate and key file

The Hive webserver running the backend UI and other services expects an SSL certificate in order to provide secure https connections. You need to store the SSL certificate files cert.pem (containing the certificate) and key.pem (containing the key to the certificate) in the data folder of the monitor binary under the following path: data/webserver/cert/cert.pem and data/webserver/cert/key.pem

Now you can start the monitor the first time to check if everything works as expected:

sudo -u hive ./monitor standalone