Connector deployment
How to deploy connectors for production.
Connectors are the backbone of an automation setup and a robust deployment is essential for smooth operation. The optimal deployment process can vary depending on the connector and some may even require a specific operating system. UniteLabs is open for standard-compliant third party or open-source connectors which can have a deviating deployment process.
All connectors developed by UniteLabs are based on the UniteLabs Connector Development Kit (CDK) which promotes connector containerization with Docker. If a UniteLabs connector requires a specific operating system caused by limitations incurred by the vendor hard- or software, a specific deployment instruction is provided that may deviate from the general deployment instructions below.
1. Prepare Docker
Deploying connectors via Docker presents an efficient solution for achieving operating system agnosticism, catering to a wide range of platforms including microcontrollers and computers. Leveraging Docker ensures consistent execution environments, mitigating compatibility challenges and facilitating a seamless deployment processes.
Before delving into the Docker deployment specifics, it's essential to understand the fundamentals of Docker and establish necessary prerequisites. More information on installing Docker on various operating systems is found in the Docker documentation.
These setup instructions are specific to a Docker installation under Unix.
Set up Docker’s apt repository:
sudo apt install vim ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
Install the additional Docker packages:
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Grant the user (default: unitelabs
) access to Docker:
sudo usermod -a -G docker unitelabs
Configure Docker to start on boot with systemd:
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
2. Authenticate Docker
This step is required for UniteLabs connectors: To enable Docker to pull the connector image, Docker needs access to the UniteLabs Artifactory: A username (Tenant UUID) and password (GitLab deploy token) are required.
- Username: 32 characters separated by dashes in UUID4 format, e.g. 56ae938f-484c-41cc-ae54-e4f9b8814fb7.
- Password: 22 characters separated by dashes, e.g. ahjt-Lk-e1swOPZcWYYGh-mKJ
Authenticate Docker using the command below. This allows the docker daemon to pull private Docker images (You may need to restart the machine!). The Docker daemon must be running for this!
sudo reboot
echo "<password>" | docker login registry.gitlab.com --username <username> --password-stdin <password>
3. Create a Docker Compose file
Docker Compose is used to manage deployments more efficiently, especially when dealing with the deployment of multiple connector applications on the same system. Problems that are tackled by using Docker Compose include automatic restarts on connector crashes or reboots as well as log rotation and memory management.
When docker
is available and installed correctly, create a docker-compose.yml file. This is typically done by a UniteLabs representative. The default path for this file is /home/unitelabs/docker-compose.yml
.
services:
hamilton-microlab-star:
image: registry.gitlab.com/unitelabs/connectors/hamilton-star:2cd5f877
restart: always
environment:
ENVIRONMENT: production
SILA_SERVER__HOST: 0.0.0.0
SILA_SERVER__PORT: 50051
SILA_SERVER__UUID: e1c7147d-a11f-4ac5-9518-df4f62ac6e1c
CLOUD_SERVER_ENDPOINT__ENDPOINT: ca91c49c-ca1-40b7-9b93-46b69861f367.unitelabs.io:443
CLOUD_SERVER_ENDPOINT__SECURE: True
SIMULATION: false
privileged: true
volumes:
- /dev/bus/usb:/dev/bus/usb
Depending on the connector, some resources of the host system must be made available such as serial and USB ports. Apart from the Server and cloud-endpoint specific environmental variables, the connector may accept additional environmental variables. These are generally documented in the connector documentation.
The connector image is pulled from the UniteLabs GitLab container registry. A version can be specified using the
trailing hash of the registry URL. The latest
tag can be used to pull the most recent stable image. Multiple
connectors (services) can be defined in the same docker-compose file.
4. Manage connector containers
Start the containers with:
docker compose up -d
Running containers can be listed with docker ps
. The logs of each container can be accessed with docker logs <container ID>
. Individual containers can be restarted and stopped using the basic Docker commands docker stop <container ID>
and docker restart <container ID>
.