IOTA: The IOTA Data Marketplace: a technical introduction

  • Monday, 25 February 2019 19:41
Part 5: Checkout and Deploy your applicationhttps://data.iota.orgIn the previous article in this series, we talked about cloud backend configuration. Today we will learn how to checkout, build and deploy your version of the Data Marketplace application.1. Install Node.js and NPM package managerPlease check this page to see how to install Node.js2. Install Firebase toolsYou need to install Firebase CLI in order to deploy your application to Firebase.The Firebase CLI (GitHub) provides a variety of tools for managing, viewing, and deploying to Firebase projects.Once you’ve installed Node.js, you can install the Firebase CLI using npm (the Node Package Manager) by running the following command:npm install -g firebase-toolsYou should now have a globally available firebase command available from any terminal window on your machine.3. Firebase LoginOnce you’ve installed the Firebase CLI, sign in using your Google account:firebase loginThis command connects your local machine to your Firebase account and grants access to your projects.To test that authentication worked, you can run firebase list to see a list of all of your Firebase projects.4. Checkout projectCheckout the latest version of the Data Marketplace into a folder on your machine.If you are familiar with Git, you can clone the repository by running the following command inside a folder, where you want this project to reside.git clone [email protected]:iotaledger/data-marketplace.gitAlternatively you can go to the open sourced project page and download the latest release as shown on the screenshot below:5. Install packagesAfter you cloned or downloaded and unzipped the project, you need to install required packages. Please open a Terminal/Console application, navigate to the folder with the project source code and run the following command:npm run install-allThis operation can take several minutes, please do not interrupt it.6. Get Firebase project configurationProceed to the https://console.firebase.google.com and select your project.Click on the gear wheel icon and select “Project settings”.Scroll down on the page to the “Your apps” section. Click on the right circle “Add Firebase to your web app” (marked with red border on the screenshot below) to display project configuration.Please consider the 4 lines of the project configuration as shown on the screenshot below. You’ll need it to connect your app with the backend.7. Update config.jsonOpen the project folder, find a file named “config.json.example” in the “src” folder and rename it to “config.json”.Open the “config.json” and replace values for apiKey, authDomain, databaseURL, and projectId with values that you retrieved from Firebase.For the last parameter, domain, please replace only the placeholder XXXXXXXXXXXXXXXXX with the value of projectId. So your final config file should look as the one shown below (with your valid api key and unique project ID)8. Deploy projectTo deploy the application to firebase, you will need to have your project ID one more time.Run the following command:npm run deploy YOUR_PROJECT_IDPlease replace YOUR_PROJECT_ID with the real ID of your project.In my example the command will look like npm run deploy data-marketplace-demo.This operation can take several minutes, please do not interrupt it.Once it is ready, you can start using your application.Proceed to the https://YOUR_PROJECT_ID.firebaseapp.com to see it in action.Please replace YOUR_PROJECT_ID with the real ID of your project.In my example the URL will look like https://data-marketplace-demo.firebaseapp.com9. Adjust function max allowed runtimes to prevent timeouts.Some functions of the application can run longer that the default allowed runtime of 60 sec. If the function is interrupted, the operation can not be successfully completed and might result in data inconsistency. Therefore I suggest to adjust function runtimes to prevent this from happening. This can be done in a few steps:1. Open https://console.cloud.google.com/functions/list, from the dropdown menu on the very top of the page select your project.1. Open https://console.cloud.google.com/functions/list, from the dropdown menu on the very top of the page select your project.2. You will be presented with a list of functions. Please follow steps 3–7 for every of these functions: newDevice, setWallet, queryStream, purchaseData, purchaseStream.2. You will be presented with a list of functions. Please follow steps 3–7 for every of these functions: newDevice, setWallet, queryStream, purchaseData, purchaseStream3. Click on the function name, you will be redirected to a function details page. Click on the Edit button3. Click on the function name, you will be redirected to a function details page. Click on the Edit button4. On the Edit screen scroll to the very bottom of the page, then click More4. On the Edit screen scroll to the very bottom of the page, then click More5. In the Advanced options adjust the Timeout value. I recommend to set a value between 360 and 540 seconds. Press Save button on the very bottom.5. In the Advanced options adjust the Timeout value. I recommend to set a value between 360 and 540 seconds. Press Save button on the very bottom.6. Wait until the function is updated. A blue spinner will indicate the progress.6. Wait until the function is updated. A blue spinner will indicate the progress.7. Once the function is updated, return to the functions list by pressing the Cloud Functions button, and proceed with the next function.7. Once the function is updated, return to the functions list by pressing the Cloud Functions button, and proceed with the next function.Part 1: IOTA Data Marketplace — UpdatePart 2: Sensor OnboardingPart 3: Publishing Sensor DataPart 4: Cloud Backend ConfigurationPart 5: Checkout and DeployThe IOTA Data Marketplace: a technical introduction was originally published in IOTA on Medium, where people are continuing the conversation by highlighting and responding to this story.

Additional Info

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.

Disclaimer: As a news and information platform, also aggregate headlines from other sites, and republish small text snippets and images. We always link to original content on other sites, and thus follow a 'Fair Use' policy. For further content, we take great care to only publish original material, but since part of the content is user generated, we cannot guarantee this 100%. If you believe we violate this policy in any particular case, please contact us and we'll take appropriate action immediately.

Our main goal is to make crypto grow by making news and information more accessible for the masses.