Skip to content

Host setup

In order to integrate a new target to the dAIEdge-VLab, you need to set up a host machine that will run the different services to comply with the dAIEdge-VLab architecture. This section will guide you through the process of setting up your host machine and registering it to the dAIEdge-VLab.

Tips: It is recommended to use a dedicated machine for the host setup.

Installation

The installation process is mostly automated and can be done in a few steps. The installation script will install the necessary software and configure the host machine to be able to run the dAIEdge-VLab services.

Clone the node repository

First, you need to clone the node repository that contains the installation script and the configuration files for the host machine. You can clone the repository using the following command:

git clone https://gitlab.com/daiedge/poc_virtuallab/daiedge-node.git 

Install dependecies

Once the repository is cloned, you need to navigate to the daiedge-node directory and run the installation script. The script will install the necessary software and configure the host machine to be able to run the dAIEdge-VLab services. You can run the installation script using the following command:

cd daiedge-node
chmod +x install.sh
./install.sh
Warning: The install.sh script pulls the latest version of the Nomad and Consul binaries from the official Hashicorp releases. Make sure the version installed is 1.x and not 2.x for compatibility reasons. If the version installed is not compatible, you can manually download the compatible version from the official Hashicorp releases. The installation script will be updated in the near future to ensure that the correct version is installed.

Setup the Host

After the installation is complete, you need to set up the host machine by running the setup script. The setup script will try to join the dAIEdge-VLab cluster and register the host machine to the dAIEdge-VLab. It will also try to automatically open the port 51820 for the cluster communication.

You have two options to setup the Host machine:

  • Regular Host: This option will set up the host machine as a full node that can run all the services of the dAIEdge-VLab and can be also used as the cluster leader. This option is recommended if you want to run a full node and have the resources to do so.
  • Minimal Host: This option will set up the host machine as a minimal node that can only run the necessary services to join the cluster and communicate with the other nodes. This option is recommended if you want to run a minimal node and have limited resources.

First, you need to make the setup script executable by running the following command:

chmod +x ./setup-node.sh

To setup the host machine as a regular host, you can run the following command:

./setup-node.sh server

To setup the host machine as a minimal host, you can run the following command:

./setup-node.sh minimal-host

Verify the setup

After the setup is complete, you can verify that the host machine is registered to the dAIEdge-VLab cluster by running the following command:

ifconfig

You should see a new network interface called wg0 that is used for the cluster communication.

You can also check the connectivity between the nodes by pinging the other nodes in the cluster using their IP addresses. The IP addresses of the nodes can be found in the output of the following command:

consul members

The output should show the list of nodes that are registered to the cluster, including the new host machine that you just set up. The output should look something like this:

Node                             Address          Status  Type    Build   Protocol  DC   Partition  Segment
SI-TICA-WS08                     10.200.0.8:8301  alive   server  1.22.6  2         dc1  default    <all>
maick-HP-Z2-Tower-G9-PC          10.200.0.1:8301  alive   server  1.20.6  2         dc1  default    <all>
ml4ag-OptiPlex-7060              10.200.0.2:8301  alive   server  1.21.0  2         dc1  default    <all>
nuc                              10.200.0.6:8301  alive   server  1.22.2  2         dc1  default    <all>
raspberrypi-vlab                 10.200.0.5:8301  alive   client  1.22.4  2         dc1  default    <default>
rpi5-desktop                     10.200.0.7:8301  alive   client  1.22.6  2         dc1  default    <default>

If you can ping the other nodes and see the new host machine in the cluster members list, then the communication between the nodes is working correctly and the host machine is successfully registered to the dAIEdge-VLab cluster.

You can also check the status of the cluster by running the following command:

systemctl status consul
systemctl status nomad

If they are running correctly, you should see the status as active (running). This means that the host machine is successfully set up and registered to the dAIEdge-VLab cluster.

Troubleshooting

If you encounter any issues during the installation or setup process, you can check the logs of the scripts to see if there are any errors.

One quick way to fix issues is to run the scirpt clear-setup.sh that will clear the setup and allow you to start the setup process from scratch. You can run the script using the following command:

chmod +x ./clear-setup.sh
./clear-setup.sh
# Rerun the setup-node.sh script after clearing the setup

Common issues that you might encounter include:

  • Network Issue: Your host machine is not accessible from the outside network. This occurs when the automatic port opening fails. In this case sou must manually open the port 51820 on your router and forward it to the host machine’s IP address. This will allow the host machine to communicate with the other nodes in the cluster.
  • Permissions Issue: The installation or setup scripts do not have the necessary permissions to run. In this case, you can try running the scripts with sudo to give them the necessary permissions.
  • Permission Issue for /opt/venv: The installation script needs to write to the /opt/venv directory, if it does not have the necessary permissions, you can try changing the ownership of the directory to the user that is running the script. You can do this by running the following command:
sudo chown -R $USER:$USER /opt/venv

If you encounter any other issues, you can check the logs of the scripts to see if there are any errors that can help you identify the problem. You can also reach out to the dAIEdge-VLab maintainers for further assistance.