Automated agent installation and registration

Note: These steps are the same for all edge device types (architectures).

  1. If you do not already have an API key, create one by following the steps in Creating your API key. This process creates an API key, locates some files, and gathers environment variable values that are needed when you are setting up edge nodes.

  2. Log in to your edge device and set the same environment variables that you obtained in step 1:

    export HZN_EXCHANGE_USER_AUTH=iamapikey:<api-key>
    export HZN_ORG_ID=<your-exchange-organization>
    export HZN_FSS_CSSURL=https://<management-hub-ingress>/edge-css/
    export HZN_EXCHANGE_URL=https://<management-hub-ingress>/edge-exchange/v1

    Note: To prevent errors, the exchange URL should not have a trailing slash.

  3. If you are not using an admin prepared installation bundle, download the script from the Cloud Sync Service (CSS) to your device and make it executable:

    curl -u "$HZN_ORG_ID/$HZN_EXCHANGE_USER_AUTH" -k -o $HZN_FSS_CSSURL/api/v1/objects/IBM/agent_files/
    chmod +x
  4. Run to get the necessary files from CSS (Cloud Sync Service), install and configure the Horizon agent, and register your edge device to run the helloworld sample edge service:

    sudo -s -E ./ -i 'css:' -p IBM/pattern-ibm.helloworld -w '*' -T 120

    To see all available flag descriptions run: ./ -h

    Note: The above single step could be separated into 2 steps with the following commands:

    sudo -s -E ./ -i 'css:' -s
    ```   and
    ```bash {: codeblock}
    hzn register -p IBM/pattern-ibm.helloworld -s '*' -t 120

    Note: On macOS, the agent will be run in a docker container running as root.

  5. View the helloworld output:

    sudo hzn service log -f ibm.helloworld
    # Press Ctrl-c to stop the output display
    ```   **Note**: The `sudo` is needed on this CLI command for a non-root user to read the system log file
  6. If the helloworld edge service does not start, run this command to see error messages:

    hzn eventlog list -f
    # Press Ctrl-c to stop the output display
  7. (optional) Use the hzn command on this edge node to view services, patterns, and deployment policies in the Horizon Exchange. Set your specific information as environment variables in your shell and run these commands:

    eval export $(cat agent-install.cfg)
    hzn exchange service list IBM/
    hzn exchange pattern list IBM/
    hzn exchange deployment listpolicy
  8. Explore all of the hzn command flags and subcommands:

    hzn --help

What's next