Wirepas Services Tutorial¶
Here we will show you step-by-step how to deploy wirepas stack to a fleet of edge devices.
Video Tutorial¶
Pre-requisites¶
Have Orchestra subscription (more).
Add all your edge devices to Orchestra Manager (more) or make sure the Orchestra Daemon (orchestrad) installed is version 1.4.13 or above (Updating Orchestra Daemon).
Install Docker Engine on your edge devices (Install Docker Engine).
Make sure your Docker Compose file
docker-compose.yml
is ready and correct before proceeding. Copy the docker file from here.
docker-compose.yml
version: "3.7"
volumes:
dbus-volume:
driver: local
services:
dbus-service:
image: wirepas/gateway_dbus_service:v1.4.5
container_name: dbus-service
restart: always
volumes:
- dbus-volume:/var/run/dbus
logging:
driver: journald
transport-wbs-service:
image: wirepas/gateway_transport_service:v1.4.5
container_name: transport-wbs-service
environment:
WM_GW_ID: --will-be-overridden--
WM_GW_MODEL: --will-be-overridden--
WM_GW_VERSION: --will-be-overridden--
WM_SERVICES_MQTT_HOSTNAME: --will-be-overridden--
WM_SERVICES_MQTT_PORT: --will-be-overridden--
WM_SERVICES_MQTT_USERNAME: --will-be-overridden--
WM_SERVICES_MQTT_PASSWORD: --will-be-overridden--
restart: always
depends_on:
- dbus-service
volumes:
- dbus-volume:/var/run/dbus
logging:
driver: journald
sink-service:
image: wirepas/gateway_sink_service:v1.4.5
container_name: sink-service
restart: always
privileged: true
depends_on:
- dbus-service
environment:
WM_GW_SINK_BAUDRATE: 125000
WM_GW_SINK_ID: 1
WM_GW_SINK_UART_PORT: --will-be-overridden--
volumes:
- dbus-volume:/var/run/dbus
logging:
driver: journald
Prepare variables:
WM_SERVICES_MQTT_USERNAME
WM_SERVICES_MQTT_PASSWORD
WM_SERVICES_MQTT_HOSTNAME
WM_SERVICES_MQTT_PORT
WM_GW_MODEL
WM_GW_VERSION
WM_GW_ID
Steps¶
Step 1: List All Fleets¶
Begin by listing all the fleets in your system. This helps you identify existing fleets before proceeding to create a new one (more: List).
$ ocli calm fleet list
Step 2: Create a New Fleet¶
Now, create a fleet where you will deploy your compositions. Include all of the devices you want to deploy wirepas application on (more: Create).
$ ocli calm fleet create --name "name" --description "desc"
Step 3: Create a Composition¶
Next, create a composition. It defines your app and will store the versioning of this app (more: Create).
$ ocli calm composition create -n "name"
Step 4: Create a Composition Version¶
After creating the composition, create a composition version for it. This version will be linked to specific configurations in your compose file. (more: Create).
Note
Make sure your Docker Compose file docker-compose.yml
is ready and correct before proceeding.
$ ocli calm composition-version create -f <path to docker compose .yaml file> -v <version e.g. 1.0.0> -d "description" <composition_id>
Step 5: Attach Composition to the Fleet¶
Now, attach the composition you just created to your fleet. This step ensures that the fleet is ready to deploy the specified services (more: Attach).
$ ocli calm fleet attach composition -r <composition_id> <fleet_id>
Step 6: Attach Devices to Your Fleet¶
Add the required devices to your fleet. These devices will run the services defined in your composition (more: Attach).
Note
Use the arrow keys to navigate the list of devices, press Space to select devices, and hit Enter to confirm your selections.
$ ocli calm fleet attach device <fleet_id>
Step 7: Choose Composition Version¶
List all versions of your composition to select the one to be released.
$ ocli calm composition-version list <composition_id>
Step 8: Set Up Required Variables for the Composition¶
Configure the necessary environment variables for your composition. Input each variable one by one as needed for your application (more: Create).
Tip
Double-check each variable to ensure it’s correct before proceeding.
First variable:
WM_SERVICES_MQTT_PASSWORD
$ ocli calm variable create -k <key> -v <value> -d <description> -r <composition_id> composition
Second variable:
WM_SERVICES_MQTT_USERNAME
$ ocli calm variable create -k <key> -v <value> -d "description" -r <composition_id> composition
Continue inputting each variable:
WM_SERVICES_MQTT_HOSTNAME
WM_SERVICES_MQTT_PORT
WM_GW_MODEL
WM_GW_VERSION
Last variable:
WM_GW_ID
Unlike other variables, WM_GW_ID
is device-specific and cannot be set at the composition level. Each device must have a unique WM_GW_ID
.
Let’s create this device-specific variable now:
$ ocli calm variable create -k <key> -v <value> -d "description" -r <device_id> device
Note
If you adding more devices to fleet at once you have to configure WM_GW_ID for each device.
Once all variables are added, verify that everything is correctly configured (more: List).
$ ocli calm variable list composition -r <composition_id>
And you can verify devices variables:
$ ocli calm variable list device -r <device_id>
Step 9: List All Composition Versions¶
List all versions of your composition. This helps you identify the correct version to release (more: List).
$ ocli calm composition-version list <composition_id>
Step 10: Release Your Composition¶
Finally, release the desired composition version to your fleet. This will deploy the services across the devices in the fleet (more: Release).
$ ocli calm release create -v <composition_version_id> -f <fleet_id>
Step 11: Check The Release¶
After few minutes let’s check if the release succeeded. Use the fleet get command (more: Get).
$ ocli calm fleet get <fleet_id>
You Wirepas application is running!
Note
If you are facing any problems or have suggestions please contact us through our Customer Portal.
Next steps¶
Next, you can Configuring Sink via CLI on Gateway.