Exporting edgeSDK Microservices to Other Devices

In this guide you will learn how to export microservice images from one node to another under the same account.


Prerequisites

You will need the following software installed on your system.

  • edgeSDK v1.2.4+
  • edgeSDK is installed on your target development platform and associated to your developer account
    • To learn how to install edgeSDK on your target development platform:
    • For account association, please visit here.
  • The want-to-export microservice is deployed correctly.
    • You can move to this page for instruction on deploying edgeSDK microservice.
  • You might also need mSuperDrive installed, please refer to this page for instruction on how to install mSuperDrive microservice.

Instructions

edgeSDK allows developers to export microservice images to mCM container on other edgeSDK nodes. In order to export images, developers first need to get EdgeHmac Code via "getEdgeHmacCode" for the targeted node, which must associated under the same account. In order to obtain the nodeID of targeted node, developers need to obtain nodeID by calling mSuperDrive with account cluster information.

You can find an example curl command for account cluster query below: (replace everything with <> with your own parameters in following commands)

curl -i -H 'Authorization: Bearer <yourAccessTokenHere>' 'http://localhost:8083/superdrive/v1/drives?type=account'

In the response, you can find id of target node, as an example:

NodeID curl response

By using the nodeID of the targeted node, developer can execute the following use case to get "getEdgeHmacCode" for targeted node:

NodeID response Diagram


  1. Application send requests "getEdgeHmacCode" from local edgeNode1 using the nodeID of the targeted node to obtain the HMAC code associated to the microservice.


    curl -X POST http://<NODE1_IP_ADDRESS>:8083/jsonrpc/v1 -d '{"jsonrpc": "2.0", "method": "getEdgeHmacCode", "params": ["<yourAccessTokenHere>", "999999999999", "<NODE2_NODE_ID>", "/mcm/v1/images/<microservice_name>/tarball"]}'

  2. edgeNode1 returns code that describes the retrieval of tarball from edgeNode2.


  3. Application can request tarball from edgeNode2 using the following code:

    Note: "... --output file.tar" will save the image binary into a file called "file.tar", feel free to change the name of the file

    curl -X GET 'http://<NODE2_IP_ADDRESS>:8083/mcm/v1/images/<microservice_name>/tarball?hmac=<HMAC_CODE>' --output file.tar 

  4. edgeNode2 returns image.

You can install and initialize the image by following the "Initialize microservice" steps provided here.


Summary

  • First deploy microservice image to edgeNode2 by following the instructions on here.
  • Check that want-to-export image is created under ~/edge/.edge-mcm/tars/ directory
  • Get edgeHmacCode from Node1 ( Note : Use valid expiry date parameter)
  • GET image from Node2 using HMAC code
  • After image is downloaded, you can use mCM deploy and use the exported new microservice.