-
Notifications
You must be signed in to change notification settings - Fork 4
Oxinode Web Application
To install the SGBD MySQl that is used in the web application it is necessary Run in terminal
sudo apt-get install mysql-server
Next, we will make our Mysql server more secure. This is where you allow remote connections, Define the password, etc.
In most questions, a yes is answered
sudo mysql_secure_installation
Create the database that will be used to store the data
mysql -u [user] -p
mysql> create database [name];
Nvm is recommended to have multiple versions of Node js installed in addition to its easy installation
Run in terminal
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash
Close and return the terminal or run this command to Reinitialize your terminal session.
Finally install the latest stable version of Node js
$ nvm install --lts
(Skip this step if nvm is installed)
To install nodejs on Ubuntu 18.04LTS run the following command in the terminal
sudo apt-get update
sudo apt-get install nodejs npm
If your OS is not Ubuntu
The following address shows the links to download Node js according to your OS Node js
It is recommended to install the Yarn package manager to correctly replicate the installation of the web application
In the case of Ubuntu 18.04LTS run the command
curl -o- -L https://yarnpkg.com/install.sh | bash
It is recommended to close and open the console again to have the commands
If you have another operating system or more documentation, check the following installation manual for Yarn
Git is recommended for easy cloning of repositories
sudo apt-get install git
It is necessary to have an account in cloudinary for the storage of the images used for the user's profile
Register if you do not have an account in Cloudinary
It is a process manager for the JavaScript Node.js runtime. that will help us keep our code running in the background
If you have npm installed
npm i pm2 -g
or with yarn
yarn global add pm2
Clone the public repository from the oxinode
git clone https://github.com/Agro-iot/iot2tangle.oxinode.git
Install dependencies
cd /iot2tangle.oxinode/Oxinode-Web-Application/Oxinode-backend
yarn install
Edit the configuration file of the DB connection to put the credentials
nano ./src/DB/configDB.ts
database: "yourdatabasename",
host: "youripaddress",
password: "yourpassword",
username: "yourusername",
port: "yourportaddress",
Edit the .env file to put the cloudinary credentials
ssl = on means that you have an SSL certificate and you must specify the routes in private_key, certificate and ca
ssl = off means that there is no ssl and an http server is generated
Put the cloudinary credentials
Place the hotmail email that will be used to send the emails with the topics to the users in the variable mail_topics
# Mail used to send topics by email
email_topicos = your email // [email protected]
password_email_topicos = your password email
nano ./.env
Modify the util.ts file to modify the MQTT broker credentials to modify the port and host. If you do not have an mqtt Broker, we provide you with a guide on how to obtain one here
nano ./src/Utils/Utils.ts
// mqtt credentials
mqtt.connect ('mqtt: // ipbroker'
port: "yourportaddress"
host: 'ipbroker'
Build the backend If you have yarn
yarn build
or with npm
npm run build
To start it in the background if you have PM2
pm2 start build
On the contrary
node build
The default backend port is 3001
cd /iot2tangle.oxinode/Oxinode-Web-Application/Oxinode-server-frontend
yarn install
Edit the .env file
ssl = on means that you have an SSL certificate and you must specify the routes in private_key, certificate and ca
ssl = off means that there is no ssl and an http server is generated
nano ./.env
Install dependencies
cd /iot2tangle.oxinode/Oxinode-Web-Application/Oxinode-frontend
yarn install
Edit the .env file to specify the hostname or backend ip and port
Example: https://myip:3001 o http://mydomain.com:3001
nano ./src/env.tsx
Compile the frontend
yarn build
Copy the contents of the build folder that is inside Oxinode-frontend to the public folder that is inside Oxinode-server-frontend
We go to:
cd /iot2tangle.oxinode/Oxinode-Web-Application/Oxinode-server-frontend
If you have it pm2
pm2 start ./src
If you don't have
node ./src
Enter your ip or hostname and register, user guide - Oxinode-Web