.. _wirepas-tutorial-gui:
=================================
Wirepas services deployment (GUI)
=================================
With CALM, you can deploy the Wirepas gateway services to all your gateways at once,
instead of setting up each gateway separately. This guide walks you step by step through
deploying the Wirepas stack to a fleet of edge devices with Orchestra.
.. TODO video: the 2.0 video (https://www.youtube.com/embed/2rrmctobjC4) shows the old
platform, so it isn't embedded here. Add a "Video tutorial" section when a video of
the new platform is available.
Before you begin
----------------
Make sure you have the following:
1. **A tenant in Orchestra Manager:** see :ref:`om-tenant-overview`.
2. **Edge devices onboarded:** your devices added to Orchestra Manager.
3. **Docker Engine installed:** each edge device needs Docker Engine. Get it here:
`Install Docker Engine `_.
4. **Docker Compose file prepared:** save the following YAML configuration as
``docker-compose.yml``. You'll use it shortly.
.. include:: ../../../../shared/wirepas-docker-compose.rst
5. **Variables gathered:** you'll need values for these variables during the deployment:
* ``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``
* ``WM_GW_SINK_UART_PORT``
Deployment steps
----------------
The deployment is divided into several stages.
Step 1: Create a new fleet
^^^^^^^^^^^^^^^^^^^^^^^^^^
Fleets group your devices for easier management. To set one up:
1. **Open Orchestra Manager:** sign in to Orchestra Manager.
2. **Go to Fleets:** in the sidebar, click **Fleets**.
.. figure:: images/fleets.png
:alt: Fleets page
:width: 100%
:align: center
3. **Add a new fleet:** click the **"+"** button in the top right corner.
4. **Configure the fleet:** give your fleet a descriptive name, select the target
devices for your Wirepas deployment and click **Create**.
The fleet's **Overview** opens. For more details, see :ref:`calm-create-fleet`.
Step 2: Create a composition
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Think of a composition as the blueprint for your application.
1. **Go to Compositions:** in the sidebar, click **Compositions**.
.. figure:: images/compositions.png
:alt: Compositions page
:width: 100%
:align: center
2. **Create a composition:** click the **"+"** button in the top right corner, enter a
name for your composition in the window and click **Create**.
Step 3: Create the first composition version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Each composition can have several versions, so you can manage updates effectively.
1. **Start creating the version:** click **Create first version** on the composition
page.
2. **Specify the version:** use semantic versioning, for example ``1.0.0``.
3. **Upload the Docker Compose file:** click **Choose file** and select the
``docker-compose.yml`` file you prepared earlier, or drag it into the window. Then
click **Create**.
The composition page now shows its details and the uploaded Docker Compose file. For
more details, see :ref:`calm-create-composition`.
Step 4: Add the composition to the fleet
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Now, link your composition to the target fleet of devices.
1. **Go to your fleet:** go back to the fleet you created in Step 1 and open the
**Compositions** tab.
2. **Add the composition:** click **Add first composition**.
.. figure:: images/attach-composition.png
:alt: Compositions tab of a fleet with the Add first composition button
:width: 100%
:align: center
3. **Select the composition:** choose your new composition from the list and click
**Add**.
Step 5: Set fleet-level variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Variables customize your deployment.
* **Variable levels in Orchestra:**
* **Device**: unique to a single device
* **Fleet**: applies to all devices in a fleet
* **Global**: applies to all fleets and devices
* **Inheritance:** variables inherit values from broader levels:
Global > Fleet > Device. More specific settings override broader ones.
Set the variables common to all gateways in the fleet:
1. **Go to fleet variables:** on your fleet's page, open the **Variables** tab.
2. **Add a new variable:** click the **"+"** button.
3. **Add the MQTT hostname:** start with ``WM_SERVICES_MQTT_HOSTNAME``, enter your actual
hostname as the value and click **Create**.
4. **Add the other variables:** repeat the process for these variables with their values:
* ``WM_SERVICES_MQTT_USERNAME``
* ``WM_SERVICES_MQTT_PASSWORD``
* ``WM_SERVICES_MQTT_PORT``
* ``WM_GW_MODEL``
* ``WM_GW_VERSION``
.. note:: If several fleets use the same MQTT broker, you can add the
``WM_SERVICES_MQTT_*`` variables as global variables instead (sidebar > **Variables**).
Step 6: Set device-level variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Set the variables that are different on each device:
1. **Go to device variables:** go to a device in your fleet and open its **Variables**
tab.
2. **Confirm inheritance:** check that the variables from the fleet are inherited
correctly.
3. **Add the gateway ID:** add the ``WM_GW_ID`` variable, specific to this device.
4. **Add the sink port:** add the ``WM_GW_SINK_UART_PORT`` variable. To get its value,
run ``ls -l /dev/serial/by-id`` on the device. Example value: ``/dev/ttyACM0``.
5. **Repeat for other devices:** assign a unique ``WM_GW_ID`` to each device in your
fleet.
Step 7: Release your composition
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Time to deploy!
1. **Go to Compositions:** on your fleet page, open the **Compositions** tab.
2. **Select and release:** choose your Wirepas composition, click
**Create first release**, choose version ``1.0.0`` and click **Release**.
Orchestra starts deploying your composition to all devices in the fleet. For more
details, see :ref:`calm-create-release`.
Checking deployment success
---------------------------
1. **Go to device details:** on your fleet's **Overview** tab, click a device's **ID** in
the **Devices** table to see its details.
2. **Open the terminal:** in the device details, go to the **Terminal** tab and click
**Start session**.
3. **List containers:** run ``docker ps`` to view the active containers. This confirms
that the deployment succeeded.
Next steps
----------
Next, you can :ref:`configure the sink via CLI `.
Need help?
----------
Contact us through our `support portal `_ or at
support@cthings.co if you run into any issues.