This open source mIoT microservice created by the mimik team is an example IoT (Internet of Thing) solution for developers to share sensor payloads and notifications across sensors and devices. More specifically, this edgeSDK microservice has the following functionality:
-
Uploading sensor's data payload to other sensors or devices on the network.
-
A new notification will be pushed to other devices after the payload is received.
For latest update: https://developer.mimik.com/resources/tutorials/develop
Please visit the releases section of this GitHub page to download the ready-to-deploy container image file of this microservice.
-
Please make sure that you have downloaded the latest edgeSDK and it is running correctly on your targeted development platform.
-
Please check that you have performed all the following prerequisite steps to setup you edgeSDK on your targeted platform:
- Register yourself on mimik's developer portal and add your application information to the portal to get authorization of edgeSDK access. Note: For information about Redirect URL, please go to link.
Attention: Please safe keep your App-ID and Redirect URL for OAuth authorization later on. - Get your edgeSDK access token from following OAuth tool of your targeted platform:
Please read this on how to use the OAuth tool: Instruction on How to use the OAuth tool.
OAuthtool application
Attention: Please safe keep your edgeSDK access token for later deployment use. - If you have not downloaded the latest built version of the microservice at here, please download it now.
- Register yourself on mimik's developer portal and add your application information to the portal to get authorization of edgeSDK access. Note: For information about Redirect URL, please go to link.
-
Now you are ready to deploy this microservice on the edgeSDK, please run the following command on the bash terminal:
Note: For Windows user, please download Cygwin or Git Bash to perform this.
Attention: Please run the following commend under the same directory of your downloaded microservice file.The following curl command is for deploying this microservice to the edgeSDK:
curl -i -H 'Authorization: Bearer **Replace withYourToken**' -F "image=@iot-v1.tar" http://localhost:8083/mcm/v1/imagesThe following curl command is for specifying the environment variable:
Note: You can always specify your own PUB_TOPIC and PUB_URI below to handle notifications and categorize the data payload.
curl -i -H 'Authorization: Bearer **ReplacewithYourToken**' -d '{"name": "iot-v1", "image": "iot-v1", "env": {"MCM.BASE_API_PATH": "/iot/v1", "MATCH": "iot-v1", "uMDS": "http://127.0.0.1:8083/mds/v1", "PUB_URI": "iot/v1/notification", "PUB_TOPIC": "Data"} }' http://localhost:8083/mcm/v1/containers -
The output of the above command will return status code of 200 after the deployment is successful.
-
Now you can read about the APIs in this microservice and check their functionalities on SwaggerHub.
Tools that you need:
- Latest Docker Community Edition for your target development platform(s)
- Latest NPM
- Latest Node.js
- Latest edgeSDK
Steps to build:
-
Clone the microservice project from GitHub somewhere accessible on your home directory. This guide will start from the Downloads folder
cd ~/Downloadsgit clone https://github.com/mimikgit/mIoT.git -
Navigate to the directory of the cloned repository.
-
Install dependencies:
npm install -
Next run build script:
npm run-script build -
Verify that index.js is copied under /build directory.
Attention: You will need to have the root permission to perform the following task.
-
Change owner group of the build script in the deploy directory
sudo chmod a+x deploy/build.sh -
Run build script to create an image for the container under deploy directory:
cd deploy/ && ./build.sh -
Verify that a tar file of mimik container image is created as iot-v1.tar under deploy directory
-
Now you can redirect back to the deployment section and deploy your newly built microservice.
- src/ the main source code for the microservice
- build/ the compiled javascript (after running build scripts)
- deploy/ image file for the container
For more details about the src/ directory, please visit the README file under the src/ directory.