Skip to content

Latest commit

 

History

History
73 lines (50 loc) · 2.89 KB

README.md

File metadata and controls

73 lines (50 loc) · 2.89 KB

Horizon Hello World Example Edge Service

This is a simple example of using and creating a Horizon edge service.

Preconditions for Using the Hello World Example Edge Service

If you haven't done so already, you must do these steps before proceeding with the helloworld example:

  1. Install the Horizon management infrastructure (exchange and agbot).

  2. Install the Horizon agent on your edge device and configure it to point to your Horizon exchange.

  3. As part of the infrasctucture installation process for IBM Edge Computing Manager a file called agent-install.cfg was created that contains the values for HZN_ORG_ID and the exchange and css url values. Locate this file and set those environment variables in your shell now:

eval export $(cat agent-install.cfg)
  • Note: if for some reason you disconnected from ssh or your command line closes, run the above command again to set the required environment variables.
  1. In addition to the file above, an API key associated with your Horizon instance would have been created, set the exchange user credentials, and verify them:
export HZN_EXCHANGE_USER_AUTH=iamapikey:<horizon-API-key>
hzn exchange user list
  1. Choose an ID and token for your edge node, create it, and verify it:
export HZN_EXCHANGE_NODE_AUTH="<choose-any-node-id>:<choose-any-node-token>"
hzn exchange node create -n $HZN_EXCHANGE_NODE_AUTH
hzn exchange node confirm
  1. If you have not done so already, unregister your node before moving on:
hzn unregister -f

Using the Hello World Example Edge Service with Deployment Pattern

  1. Register your edge node with Horizon to use the helloworld pattern:
hzn register -p IBM/pattern-ibm.helloworld -s ibm.helloworld --serviceorg IBM
  • Note: using the -s flag with the hzn register command will cause Horizon to wait until agreements are formed and the service is running on your edge node to exit, or alert you of any errors encountered during the registration process.
  1. After the agreement is made, list the docker container edge service that has been started as a result:
sudo docker ps
  1. See the helloworld service output:
hzn service log -f ibm.helloworld
  • Note: Press Ctrl C to stop the command output.
  1. Unregister your edge node (which will also stop the myhelloworld service):
hzn unregister -f