Exercise 2: Uploading the snap to Rigado Gateway
Exercise 3: Verifying the Device Configuration
Secure Cold Chain solution for Pharma addresses the challenges and concerns of the pharmaceutical companies, by providing near real-time tracking of the temperature sensitive consignments in a transparent and immutable manner throughout the supply chain, by combining IoT and Blockchain. The solution provides actionable insights for all the stakeholders through real time data capture, comprehensive analytics and immutable access with increased granularity (product, box, carton, or pallet level), thus helping in achieving business transformation and reaping the associated benefits.
You were asked to build the snap, upload it to the Rigado Gateway and verify the device configuration. After completing this lab, you will be able to:
-
Understand how to build a snap in Ubuntu OS using Rasberry Pi3
-
Understand how to uoload the snap using Rigado portal
-
Understand how to verify the device configurations in Azure portal
-
Azure Portal access with Owner permission.
-
You need to have the following devices :
- Raspberry Pi3
- Rigado Cascade-500 IoT Gateway
- You need to have developer account to remotely deploy your snap using https://app.rigado.com/
-
Familiar with Azure IoT services and Device configurations.
Note: You should have access to Azure portal with Owner permission to complete this Training Lab
Scenario
This exercise explains about how to build the snap using snapcraft.
The main tasks for this exercise are as follows:
- Building the Snap
Below listed are the steps to be followed to build and deploy snap to Rigado Cascade-500 IoT Gateway.
a. Development Host - This computer or virtual machine should have Ubuntu 16.04 LTS and will be used to edit source files, test scripts, and interact with the snapcraft CLI. It may have any architecture (amd64, x86, etc). This device must have an HCI0 interface with BLE enabled.
b. Build Host - NodeJS snaps are not cross-compilable, so this build computer must have an armhf processor architecture and have enough resources to build the snap. The Raspberry Pi 3 is recommended because it has the armhf architecture, and can run the Ubuntu Core OS (which simplifies the build process).
I. Setting up the Development Host
-
Install Node.js (>=6.11.4).
-
Install required libraries with the following command:
$ sudo apt update
$ sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev g++ python2.7 git build-essential curl libssl-dev npm
-
Download the project (codebase of Gateway) to your development host and navigate to the project and enter the following command:
$ npm install
-
This will install all the dependencies which are required for the project mentioned in package.json file.
-
For now, the Node.js plugin for snapcraft doesn’t support a cross-platform build. Raspberry Pi is required for building the snap. For installation of Raspberry Pi follow the steps mentioned in the link https://docs.rigado.com/en/latest/creating-apps/prereqs.html#developer-prereqs-rpi.
-
Once Raspberry Pi is set up, login by using the following command:
$ ssh abc@175.21.10.9 [IP address of the RaspberryPi]
-
Copy the project folder from your local to Raspberry Pi
$ scp -r user@175.21.10.4:/home/user/Project-Titan/.
-
Install Classic
$ sudo snap install --beta --devmode classic
-
Once Classic is installed, switch to classic mode by entering the following command:
$ cd Gateway Source Code
$ sudo classic
-
In Classic mode, install snapcraft:
$ sudo apt update
$ sudo apt install snapcraft build-essential git
-
Once snapcraft is installed [in classic mode] navigate to the project folder, where the snapcraft.yaml file is present, change the version number to the higher number than the one present in the file.
NOTE: if you’re building the snap multiple times make sure that the version should be updated to the next number in snapcraft.yaml file. Ex: If version is 1.9.10 make it as 1.9.11 for the next build.
- You should change the function App Url(API_endpoint) and IoT Hub connection string(IoT Hub name) url in Config.json file for before building the snap.
Note: You can take the URL from the output section of ARM template.
Note: If the Deployment type is Standard or Premium, you have to provide Traffic Manager URL
Note: If you want to re-build the snap you need to delete the following folders
To build the snap, enter the following command
$ sudo snapcraft
- Once the snap is built, it will create an abc_test_1.0.1_armhf.snap file. Copy this snap from the build host [i.e Raspberry Pi] to development host [i.e. Ubuntu 16.04 machine] using the following command:
$ scp abc_test_1.0.1_armhf.snap <user@175.21.10.4:/home/user/>
This will copy the snap to Local at the path mentioned.
Scenario
This exercise explains about how to upload the snap using Rigado developer portal.
The main tasks for this exercise are as follows:
- Uploading the snap to Rigado Gateway
-
Switch to Development host and login to https://app.rigado.com/.
-
Navigate to Apps page and click on create app and enter a unique name for the app and upload the snap as your first revision.
Create new App
Application created successfully
Create Bundle for the specific Application.
Bundle created successfully and add tag to that bundle
Select an App and add app to that Bundle then save it.
Navigate to created App and upload the Snap by following the below steps.
Note: The name of the app must be same as the name mentioned in snapcraft.yaml of the project
- When it’s done uploading, a modal will ask you if you want to release the app revision to a channel. Select the edge channel and click the RELEASE button.
Scenario
This exercise explains about how to verify the device configuration using Azure portal.
The main tasks for this exercise are as follows:
- Verifying the Device Configuration
- Go to Azure Portal.
- Click on the Resource Group and Navigate to the IoT Hub resource.
- Click on the IoT Hub and Navigate to the IoT Hub Overview, here you can see the IoT Hub Message count.
- Click on the IoT devices in IoT Hub, here you can see the Gateway Device Id.
- Click on the Gateway
- Click on the Device twin
- Once all the above configurations are correct you can see the device status as connected as shown below






























