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 Tenant.

  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:

    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:

    Fleets page with an empty list
  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.

    Create new fleet window

    The fleet’s Overview opens.

    Overview tab of the new Hello World fleet

Step 2: Create a composition

A composition defines your application and manages its versions. Learn more in Create a 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.

    Create new composition window

    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.

    Create new version window with the Hello World file

    The composition page now shows its details and the uploaded Docker Compose file.

    Composition page with version 1.0.0

Step 4: Add the composition to the fleet

  1. Go to the fleet you created in Step 1 and open the Compositions tab.

    Compositions tab of a fleet with the Add first composition button
  2. Click Add first composition.

  3. Select your new composition from the list and click Add.

    Add composition window

Step 5: Release your composition

  1. On the fleet page, go to the Compositions tab.

  2. Select your Hello World composition.

    Create first release button
  3. Click Create first release, choose the version you created and click Release.

    Create new release window

    Your composition is now being deployed to all devices in the fleet.

    Compositions tab of a fleet after the release with the deployment status of the devices

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:

    $ curl localhost:8080
    

    You should see:

    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.

    Restart button on the Compositions tab of a fleet
  5. Test your application again as in Check your deployment:

    $ curl localhost:8080
    

    You’ll see the updated output:

    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.