.. _hello-world-gui: Hello World tutorial ==================== A simple "Hello World!" application is the quickest way to see CALM at work. This guide walks you step by step through deploying it to a fleet of edge devices with Orchestra. Prerequisites ------------- Before you begin, make sure you have: 1. **A tenant in Orchestra Manager:** see :ref:`om-tenant-overview`. 2. **Edge devices in Orchestra:** your edge devices added to Orchestra Manager. 3. **Docker Engine:** Docker Engine installed on each of your edge devices. For installation instructions, see the official Docker documentation: `Install Docker Engine `_. 4. **Docker Compose file:** the following Docker Compose file (``docker-compose.yml``) saved on your computer: .. code:: yaml services: static-response-server: environment: HTTP_BODY: "Hello World!\n" HTTP_CODE: 200 image: colinodell/static-response-server ports: - 8080:8080 Steps ----- Step 1: Create a new fleet ^^^^^^^^^^^^^^^^^^^^^^^^^^ 1. Open Orchestra Manager. 2. In the sidebar, click **Fleets**. If you haven't created any fleets yet, the page looks like this: .. figure:: images/hello-world-fleets-empty.png :alt: Fleets page with an empty list :width: 100% :align: center 3. Click the **"+"** button in the top right corner. 4. In the **Create new fleet** window, enter a name for your fleet, select the devices you want to include and click **Create**. .. figure:: images/calm-create-fleet.png :alt: Create new fleet window :width: 100% :align: center The fleet's **Overview** opens. .. figure:: images/hello-world-fleet-created.png :alt: Overview tab of the new Hello World fleet :width: 100% :align: center Step 2: Create a composition ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A composition defines your application and manages its versions. Learn more in :ref:`calm-create-composition`. 1. In the sidebar, click **Compositions**. 2. Click the **"+"** button in the top right corner. 3. In the **Create new composition** window, enter a name for your composition and click **Create**. .. figure:: images/hello-world-create-composition.png :alt: Create new composition window :width: 100% :align: center The new composition opens automatically. Step 3: Create the first composition version ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1. Click **Create first version** in the middle of the composition page. 2. Enter a version number according to semantic versioning, for example ``1.0.0``. 3. Add the ``docker-compose.yml`` file you prepared earlier: click **Choose file** or drag the file into the window. 4. Click **Create**. .. figure:: images/hello-world-create-new-version.png :alt: Create new version window with the Hello World file :width: 100% :align: center The composition page now shows its details and the uploaded Docker Compose file. .. figure:: images/hello-world-composition-overview.png :alt: Composition page with version 1.0.0 :width: 100% :align: center Step 4: Add the composition to the fleet ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1. Go to the fleet you created in Step 1 and open the **Compositions** tab. .. figure:: images/hello-world-attach-composition.png :alt: Compositions tab of a fleet with the Add first composition button :width: 100% :align: center 2. Click **Add first composition**. 3. Select your new composition from the list and click **Add**. .. figure:: images/hello-world-choose-composition.png :alt: Add composition window :width: 100% :align: center Step 5: Release your composition ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1. On the fleet page, go to the **Compositions** tab. 2. Select your Hello World composition. .. figure:: images/hello-world-fleet-compositions-tab.png :alt: Create first release button :width: 100% :align: center 3. Click **Create first release**, choose the version you created and click **Release**. .. figure:: images/hello-world-create-new-release.png :alt: Create new release window :width: 100% :align: center Your composition is now being deployed to all devices in the fleet. .. figure:: images/hello-world-composition-version-released.png :alt: Compositions tab of a fleet after the release with the deployment status of the devices :width: 100% :align: center .. _hello-world-check-deployment: Check your deployment --------------------- To make sure your application is running: 1. On the fleet page, go to the **Overview** tab and find the **Devices** table. 2. Click the **ID** of a device in your fleet. 3. The device page opens. Go to the **Terminal** tab and click **Start session**. 4. In the terminal, type ``docker ps`` to see the running containers. 5. Test your Hello World application: .. code:: console $ curl localhost:8080 You should see: .. code:: console :class: no-copybutton Hello World! Using variables --------------- You can use variables to customize your deployments. Let's add a global variable: 1. In the sidebar, click **Variables**. 2. Click the **"+"** button to create a new variable. 3. Set the **Key** to ``HTTP_BODY`` and the **Value** to ``Awesome response``, then click **Create**. Your first global variable appears in the list. 4. Go back to your fleet's **Compositions** tab, select your Hello World composition and click **Restart**. In the **Restart composition** window, click **Restart** again. This restarts the containers and applies the new variable. .. figure:: images/hello-world-restart-composition.png :alt: Restart button on the Compositions tab of a fleet :width: 100% :align: center 5. Test your application again as in :ref:`hello-world-check-deployment`: .. code:: console $ curl localhost:8080 You'll see the updated output: .. code:: console :class: no-copybutton Awesome response That's it! Thank you for following this tutorial. .. note:: If you face any problems or have suggestions, contact us through our `support portal `_ or at support@cthings.co.