How to Start a FidesInnova IoT Node
o install the back-end and front-end components of the FidesInnova platform, including both the web app and mobile app, you can follow the steps below. These instructions assume that you have a basic understanding of setting up development environments and are familiar with JavaScript, Node.js, and related technologies.
How to Install BackEnd
1- Prepare operating system
First of all install Ubuntu 20.04 LTS on your server.
2- Install MongoDB
Step 1 — Installing MongoDB
Install MongoDB version 4.4
Step 2 — Starting the MongoDB Service and Testing the Database
Note: For managing the MongoDB Service you can use the following commands:
3- Install nginx web server
How to take SSL by certbot
After creating certificates you have to copy
fullchain.pem
,privkey.pem
files into/etc/nginx/ssl
Update the nginx.conf
file in /etc/nginx/nginx.conf
nginx.conf
file in /etc/nginx/nginx.conf
Make sure to edit
server_name
to subdomain.yourdomain.comMake sure to create the certificate for domain and all subdomains
Restart Nginx
4- Installation of Node.js (Version 20.9.0) and NestJS on Ubuntu
5- Configure Firewall
Allow connections
Install ufw
Allow OpenSSH connection
Allow nginx connection
Allow Mobile App to connect to the server through port 3000
Allow Web App to connect to the server through port 4000
Allow Admin Web App to connect to the server through port 4000
Allow IoT devices to connect to the MQTT broker through port 8883
Enable firewall
Check the firewall status
6- Clone the project
Install git
In the root directory clone the project
7- Prepare app host configuration
In project root folder, create
.env
file and edit parameters based on your node URL info
Inside the .env
file, past the parameters.
Update these parameters:
From
/etc/nginx/ssl
, copy the filesfullchain.pem
,privkey.pem
and rename them:fullchain.pem
intowebpublic.pem
privkey.pem
intowebprivate.pem
put ssl certificate files in following directory:
8- Device Installation Data
During the installation process in the mobile app, the following devices will be displayed based on the data provided in the fidesinnova_node_iot/backend/src/data/devices.json
file. Each device is represented by an image and a title:
fileName:
Refers to the image file that should be placed in the/fidesinnova_node_iot/backend/uploads/device
directory. This image will be displayed in the mobile app.title:
The name of the device as it will appear in the mobile app's device installation list.type:
The device type, which is used by the node supervisor to categorize the devices.
9- Installation of packages
In the project root directory run the following commands to install npm packages and then, build the project:
10- Run the project with pm2
install pm2
Run the project with pm2
11- Running the project in developer mode
development
watch mode (For developers)
production mode (For developers)
For first run of the app or after pull the project from GitHub or any change in project's code, before run following command you must run the app with
npm run start
once.
unit tests
e2e tests
test coverage
How to Install WebApp
Note:
The program's source is situated in the folder "Source_webapp". After building it from the source, you can place it in the "Runner_webapp/frontend". The runner section has already been executed on the server following the provided instructions.
If you are a Node owner, contact FidesInnova team at info@fidesinnova.io to add your Web App URL address to FidesInnova website.
1- Installation of packages
2- Prepare app configuration
In project root folder, create
.env
file and edit parameters based on your node URL info
Inside the .env
file, past the parameters.
Make sure to add
/app/
to the end of theVITE_URL
path!Enter your node name in
VITE_NODE_NAME
for showing in website
To obtain a new certificate for the admin
domain:
From
/etc/letsencrypt/live/admin.<Your Domain>
, copy the filesfullchain.pem
,privkey.pem
and rename them:fullchain.pem
intowebpublic.pem
privkey.pem
intowebprivate.pem
fullchain.pem
intofullchainadmin.pem
privkey.pem
intoprivkeyadmin.pem
Put SSL certificate files in the following path:
3- Build
**The build artifacts will be stored in the iot_node_backend_web_app/web_app/Source_webapp/build/
directory, you must copy the contents of the build
folder into the iot_node_backend_web_app/web_app/Runner_webapp/frontend
. **
4- Configure Firewall
Allow Web App to connect to the server through port 4000
5- Install npm packages for Runner
In project root folder, create
.env
file and edit parameters based on your node URL info
Inside the .env
file, past the parameters.
6- Run the project with pm2
7- Running the project in developer mode
Build the project
Run the program
production mode (For developers)
How to Install Admin WebApp
Note:
The program's source is situated in the folder "Source_webapp". After building it from the source, you can place it in the "Runner_webapp/frontend". The runner section has already been executed on the server following the provided instructions.
If you are a Node owner, contact FidesInnova team at info@fidesinnova.io to add your Admin Web App URL address to FidesInnova website.
1- Installation of packages
2- Prepare app configuration
In project root folder, create
.env
file and edit parameters based on your node URL info
Inside the .env
file, past the parameters.
Make sure to add
/app/
to the end of theVITE_URL
path!Enter your node name in
VITE_NODE_NAME
for showing in website
From
/etc/nginx/ssl
, copy the filesfullchain.pem
,privkey.pem
and rename them:fullchain.pem
intowebpublic.pem
privkey.pem
intowebprivate.pem
Put SSL certificate files in the following path:
3- Build
**The build artifacts will be stored in the iot_node_backend_web_app/admin_web_app/Source_webapp/build/
directory, you must copy the contents of the build
folder into the iot_node_backend_web_app/admin_web_app/Runner_webapp/frontend
. **
4- Configure Firewall
Allow Admin Web App to connect to the server through port 5000
5- Install npm packages for Runner
In project root folder, create
.env
file and edit parameters based on node URL info
Inside the .env
file, past the parameters.
6- Run the project with pm2
7- Running the project in developer mode
Build the project
Run the program
production mode (For developers)
Last updated