open-horizon / examples

Code examples you can use with Horizon.
Apache License 2.0
40 stars 65 forks source link

Write script to automate the Gather info and files step #243

Closed bmpotter closed 4 years ago

bmpotter commented 4 years ago

Not sure yet where this script should live.

t-fine commented 4 years ago

For now I added the script to the tools directory in the open-horizon git repo, but that was just so I could save it in GitHub.

https://github.com/t-fine/examples/blob/gather-script/tools/edgeDeviceFiles.sh

t-fine commented 4 years ago

Requirements:

t-fine commented 4 years ago

--------------- Knowledge Center Doc Changes -------------------

https://www-03preprod.ibm.com/support/knowledgecenter/SSFKVV_3.2.1/devices/installing/install.html

Gather the necessary information and files

The script in this section only needs to be executed once for each edge node device type, but must be performed on an x86 host (Linux, macOS, or Windows). If your edge device is a different architecture (for example arm or arm64), then run the script in this section on an x86 host and copy the resulting tar file to your edge device.

  1. Install the IBM Cloud Pak CLI (cloudctl) and the Kubernetes CLI (kubectl) by following the steps in Installing cloudctl (LINK: https://www.ibm.com/support/knowledgecenter/SSBS6K_3.2.1/manage_cluster/install_cli.html ).

Alternatively, you can install kubectl using your package manager. For more information about installing kubectl with your package manager, see Install and set up kubectl (LINK: https://kubernetes.io/docs/tasks/tools/install-kubectl/ ).

  1. After cloudctl is installed, ask your IBM cluster administrator for the URL for the cluster, username, and password. Export these values as environment variables:

    export CLUSTER_URL=<cluster-url>
    export USER=<username>
    export PW=<password>
  2. Download the latest version of the edgeDeviceFiles.sh:

    curl -O https://raw.githubusercontent.com/open-horizon/examples/master/tools/edgeDeviceFiles.sh && \
    chmod +x edgeDeviceFiles.sh
  3. Run the script to gather the necessary files to register an edge node with the edgeDeviceFiles.sh script.

    • Supported <edge-device-type> values: 32-bit-ARM , 64-bit-ARM , x86_64-Linux , macOS
    • -t: create an agentInstallFiles-<edge-device-type>.tar.gz file containing all gathered files. If this flag is not set, the gathered files will be placed in the current directory.
    • -k: create a new $USER-API-Key. If this flag is not set, the existing api keys will be checked for $USER-API-Key and creation will be skipped if one exists.
    • -d <distribution>: when installing on 64-bit-ARM or x86_64-Linux: you can specify -d xenial for the older version of Ubuntu, instead of the default bionic. The -d flag is ignored with all other values.
./edgeDeviceFiles.sh <edge-device-type> -t 
Rene-Ch1 commented 4 years ago

This might be related to https://github.ibm.com/Edge-Fabric/docs/issues/228

bmpotter commented 4 years ago

Tested/used this multiple times and it worked like a champ!