How to clone the taxary webfile files from git to server?

From PheonixSolutions
Jump to navigation Jump to search

1. Git clone for Frontend and Backend.

 cd /var/www/ ( You can choose whatever path you want )
 git clone https://git.pheonixsolutions.com/root/taxary.git
 git clone https://git.pheonixsolutions.com/root/taxary_fe.git

After cloning, folders will be created like in the screenshot

2. First we will set up the backend code. Go into the taxary and create a .env file. Include the db credentials like below.

 cd taxary
 vi .env

Copy and paste the below.

 PORT = 4006
 OTP_KEY = 5dd572c3-87c0-11ea-9fa5-0200cd936042
 DBLINK = mongodb://127.0.0.1:27017/Taxary_be
 JWT_SECRET=abcfghistuvwxyz123456789
 JWT_TIMEOUT_DURATION="2d"
 AUTHSOURCE = admin
 USER = admin
 PASS = ******

Note:- Modify the username and password as per your wish.

3. Install node js (required node version) and pm2. You can ask the developer for the version.

 Example:-

https://computingforgeeks.com/how-to-install-nodejs-on-ubuntu-debian-linux-mint/ npm install -g pm2

4. Install node modules with the below command and follow the below steps to start the service..

cd /var/www/taxary

 # To install nodemodules
npm install

#To start the backend
pm2 start server.js --name taxary_be_prod

#To check the status
pm2 status
#To restart the service or application
pm2 restart 0
Or
pm2 restart taxary_be_prod


5. Install the mongodb by following the link below.

https://docs.mongodb.com/manual/administration/install-on-linux/

6. After installing mongodb. Follow the below commands.

 mongo( you will be entering in to mongo)
 use admin;
Remember, If you don't use the admin database the below creation wont work. You will end up with errors.
db.createUser( {user: “admin",pwd: “password",roles: [ { role: "userAdminAnyDatabase", db:”admin" },{ role: "dbAdminAnyDatabase", db: “admin" },{ role:"readWriteAnyDatabase", db: “admin" },{ role: 'root', db: 'admin' } ]})
If you forget to give root access to the user, you can execute like belo
use admin;
db.grantRolesToUser('admin', [{ role: 'root', db: 'admin' }])
To check the privileges of the user
db.getUser("admin")
To delete or drop the user db.dropUser("admin", {w: "majority", wtimeout: 5000})

Note:- In the above screenshot I have enabled authentication and used the “mongo -u admin -p” command. Initially you can directly login with “mongo” command.