Tutorial : Local Edge Testing using EdgeXR EdgeBox

EdgeXR makes it easy for Developers who want to experience the power of Edge Computing. With just 3 lines of code and their laptop, Developers can immediately take advantage of the EdgeXR Platform and Services to create and deploy their applications onto a cloudlet, thereby simulating the deployment onto a cloudlet. EdgeXR developed EdgeBox to demonstrate how easy it is to use our Platform for edge computing applications, where after you deployed, you can ensure the highest performance of your applications through continuous testing and end-to-end validation, all done locally and with zero impact on any existing networking infrastructure. Try out EdgeBox today and see how easy it is to bring your edge applications closer to your users.

Watch the Video:

With EdgeBox, you can:

  • Experience the power of edge computing
  • Quickly spin up edge sites
  • Perform things like functional testing on your edge applications through our easy-to-use EdgeXR Console.
  • Build a CI/CD pipeline (coming soon)

Prerequisites

  • Linux: Ubuntu 18.04 or MacOS: 10.14 (Mojave) or later
  • EdgeXR account with login credentials
  • Docker installed. The EdgeXR Docker registry is used to connect EdgeBox to the EdgeXR Console. You will use the same EdgeXR login credentials to log into the Docker registry for MobilegeX
  • Python3 installed

Step 1 Install EdgeBox locally on your laptop

  1. At the terminal prompt, type pip3 install edgebox. If you’ve already installed EdgeBox and need to upgrade, simply type pip3 install --upgrade edgebox.
    2, Log into your EdgeXR Docker registry by typing in docker login -u <username> docker.cloud.edgexr.org and the Password prompt will appear.
  2. Once you enter your password, you should see a Login Succeeded message. If you were unsuccessful, try entering your credentials again.

Step 2 Create an EdgeBox

  1. At the terminal prompt, type edgebox create testedge. You can give your EdgeBox any name. For this tutorial, we will name it testedge.
  2. A series of questions will appear in the terminal to complete the EdgeBox configuration process.
    a. Console Host: Use the same username you used to login to your Docker login.
    b. Console username for console.mobilegex.com ("name"): The username used to login to the EdgeXR Console.
    c. Console password for console.cloud.edgexr.org: The password used to login to the MobilegeX Console.
    d. Region: Select your desired region closest to you. e. Cloudlet Org: Type in a Cloudlet Org from the list. f. Cloudlet: Use the default or rename it.
    g. Latitude and Longitude: Provide one for your cloudlet, or use the default. EdgeXR will then map the geolocation of that cloudlet to applications that want to connect to it.

Note: If you reached this point and the download fails, go back and run the edgebox create command again.

  1. Review your configuration, and if everything looks good, Type Y at the Continue? prompt. The process to create your cloudlet will begin.

Once you see Cloudlet is up at the Terminal prompt, the cloudlet is now running on your laptop.

Cloudlet status in Terminal
Cloudlet status in Terminal

EdgeBox Commands

For a list of available EdgeBox commands, simply type edgebox --help.

The following commands are available:

$ edgebox --help
usage: edgebox [-h] [--debug] [--confdir CONFDIR] {create,delete,list,show,startall,version} ...
positional arguments:
 {create,delete,list,show,github,startall,version}
                       sub-command help
   create              create edgeboxes
   delete              delete edgeboxes
   list                list edgeboxes
   show                show edgebox details
   startall            start all active edgeboxes
   version             display version  

Step 3 Verifying the Cloudlet

  1. Log in to your EdgeXR Console.
  2. Navigate to the Organizations page. You should see an Operator Organization already created, named edgebox-cloudlet-name.
  3. Click Manage for that Operator Organization and navigate to the Cloudlets menu on the left-navigation.
  4. In the map view, scroll over to the region where you created your cloudlet and verify that it exists.

Verifying Cloudlet
Verifying Cloudlet

Step 4 Create an Application to Deploy onto the Cloudlet

  1. On the EdgeXR Console, return to the Organizations page where you will create a Developers Organization.
  2. Click the right arrow for Developers, as shown below.

Create Developer Organization
Create Developer Organization

The Create Organization screen opens.

Create Organization screen
Create Organization screen

  1. Populate all required fields, name your Developer Organization, and click Create.
  2. Optionally, you can add users to your Organization. Otherwise, skip this step.
  3. Click Return to Organizations.

You are now ready to add your Developer Organization to the cloudlet.

Step 5 Add Developer Organization to Cloudlet

Follow the steps below to add your Developer Organization to your cloudlet.

  1. On the EdgeXR Console, with the Operator Organization selected, navigate to the Cloudlet Pools menu on the left navigation.
    From the Cloudlet Pools page, you can see that a cloudlet pool has already been created for your cloudlet, named edgebox-cloudlet-name-pool.
  2. Click the Actions menu, and scroll down to Invite Organization.
    The Organizations page opens.
  3. For Organization, type in the name of the Developer Organization that you previously created.
  4. Click Create Invitation. The invite will be sent out, and received by your Developer Organization.
  5. Return to the Organizations page and switch to the Developer Organization by clicking Manage.
  6. Navigate to the Cloudlet Pools menu, where under the Status column, you will see the Pending state. This is the pending invite sent from the cloudlet pool created previously for the Operator Organization.
  7. Under the Actions menu, click Accept, and then click Yes to confirm. After accepting the invite, the status within the Cloudlet Pools page will change to Accepted.

The Developer Organization can now create applications on EdgeBox.

Step 6 Create and Deploy Applications on EdgeBox

  1. Return to the EdgeXR Console and navigate to the Apps menu on the left navigation. The Create Apps page opens.
  2. Populate all the required fields.
    a. Region: Select the same region you specified in Step 2 Create an EdgeBox.
    b. App Name: Type in the app name as facedetection, which is the name of the sample app we provided in https://hub.docker.com/r/mobiledgexsamples/edge-face-detection.
    c. App Version: Type in 2.2.
    d. Deployment Type: Select docker from the drop-down list.
    e. Image Path: Provide the image path as registry.hub.docker.com/mobiledgexsamples/edge-face-detection:2.2.
    f. Default Flavor: Select US>m4.small as the default size.
    g. Ports: Define the ports you wish to open. For the face detection sample app used, specify the first TCP port as 8008, and the second TCP port as 8011.
  3. Click Create.
  4. Navigate to the Apps page and verify the App definition was created successfully.
  5. Once verified, under the Actions menu, scroll down and select Create Instance to spin up an application instance. The Create App Instances page opens.
  6. Populate all required fields.
    a. Operator: Select edgebox-cloudlet-name-org.
    b. Cloudlet: Select edgebox-cloudlet-name.
    c. Auto Cluster Instance: Enable this option.
  7. Click Create. You will see Progress status appear showing the process of spinning up the application instance while it runs through the process of setting up a cluster as well as the docker container.

Progress Bar
Progress Bar

  1. Navigate to the App Instances menu on the left navigation to open the Apps Instance page. You should see the application instance being monitored by the EdgeXR Platform.
  2. Click on the App Instance and the following page appears.

App Instances URI
App Instances URI

  1. Scroll down the page until you see URI, then copy and paste the URI address into a browser using port 8008.
  2. You should see the Computer Vision Face Detection application working.

Computer Vision Face Detection
Computer Vision Face Detection

Since this Docker instance is running locally, you can switch to a localhost:8008, where you can set up a pseudo HTTPS connection and use the webcam to run face detection.

That’s it! You have successfully set up EdgeBox.