# Installation Guide

#### Database Server Setup

* Install docker version 18.\* from repository.

```
sudo apt-get update
```

```
sudo apt-get install \ apt-transport-https \ ca-certificates \
curl \
gnupg-agent \
Software-properties-common
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FjQmw8A5h8fBP6BKH9ZN6%2Fimage.png?alt=media&#x26;token=5d635e27-0e90-47e3-96de-6a50c5f363ee" alt=""><figcaption></figcaption></figure>

```
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FUbBgVTLRZrZC5Non4ppo%2Fimage.png?alt=media&#x26;token=34c42568-71d3-4900-b681-0f061cb4416b" alt=""><figcaption></figcaption></figure>

```
sudo apt-key fingerprint 0EBFCD88
```

```
sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FAMu9ikfjtyKu8gVYAqL6%2Fimage.png?alt=media&#x26;token=5cd15482-40ee-4fbf-959b-71fad2d1a6ed" alt=""><figcaption></figcaption></figure>

* Check if the docker is installed in the machine by running the following command

```
sudo docker -v
```

* Other images needed from docker hub is : **Mongo 4.0.0**

```
docker pull mongo:4.0.0
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FDHfo4T4InxCgsYLvACAg%2Fimage.png?alt=media&#x26;token=785c2afb-2549-4ce6-86af-e52a4600dd01" alt=""><figcaption></figcaption></figure>

* Load and run Mongo Docker image by navigating to the download directory

```
docker run -d --name simplifyDB -p 27017:27017 -v ~/simplifyqa_db:/data/db -e MONGO_INITDB_ROOT_USERNAME=<admin-username> -e MONGO_INITDB_ROOT_PASSWORD=<admin-password> mongo:4.0.0
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FidTS6mZk1pho0ffI28nD%2Fimage.png?alt=media&#x26;token=4261633e-9cfb-4b79-b747-63c4758c1551" alt=""><figcaption></figcaption></figure>

* Run the following command to create User in mongoDB

```
docker exec -it simplifyDB mongo -u <admin-username> -p <admin-password>
--authenticationDatabase admin --eval "db.createUser({user: '<db-username>', pwd: '<db-password>', roles:[{role:'readWrite', db: 'bolt'},{role:'dbAdmin', db: 'bolt'}]});" bolt

```

> Boltupload and mongodata will be provided in email. Unzip the Provided files.

* Verify if the docker is up and running by executing the following command

```
sudo docker ps -a
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FuJDCm8PQsIH6niTe9o33%2Fimage.png?alt=media&#x26;token=756f9b82-9822-4f83-a649-f3754784576f" alt=""><figcaption></figcaption></figure>

#### Application Server Setup

* Install docker v18.\* from repository and check docker version

```
sudo docker -v
```

* Other images needed from docker hub are: RabbitMQ:3-Management and Node:12

```
1.	docker pull rabbitmq:3-management
2.	docker pull node:12

```

* Download the docker image simplifyqa.tar and rabbitmq.tar file from the secure lnk using the following command

```
docker load -i <filename>.tar
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2F3VwKnJ2X28NWOcq7WrSL%2Fimage.png?alt=media&#x26;token=e03f56de-8243-417b-8d09-aa9f1e02fbe4" alt=""><figcaption></figcaption></figure>

> Note: tar files would be provided over email.

#### Backup Server Setup

The db dump path from the file system will be configured for backup purposes.&#x20;

**App Server Configuration**

* Execute the following command to run our Application

```
docker run -d -p 4011:4011 -v /root/boltupload:/root/boltupload -v
/root/simplifyQA/projectconfig.js:/simplifyqaweb/config/projectconfig.js -v
/root/simplifyQA/logs/qaserver.log:/var/log/simplifyqa.log -v /etc/hosts:/etc/hosts simplifyqaweb

```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FwWGOtdQ3VFnwBTLMad0e%2Fimage.png?alt=media&#x26;token=4ee9bd10-2a83-45b2-80ee-b5071d477933" alt=""><figcaption></figcaption></figure>

* Run the following command to check running containers

```
docker ps
```

* Update projectconfig.js in application server with below content

```

1."dburl": "mongodb://<username>:<password>@dbserverIP:27017/bolt" 
2."dblogUrl": "mongodb://<username>:<password>@dbserverIP:27017/bolt" 
3."serverUrl": "http://serverIP:4011"
4."executionIp": "serverIP:4011", 
5."rabbitUrl":"amqp://<username>:<password>@serverIP:5671"

```

**Email Configuration**

* Update SMTP E-mail configuration in both projectconfig.js file in application project as well as simplifyRabbitMQ .

```
"email": "no-reply@companyname.com",
"mail_perpose_forgot": "Generating forgot password", 
"mail_perpose_new": "Generating new password", 
"mail_subject_new": "Welcome to company name", 
"mail_subject_forgot": "New password to login", 
"smtp_host": "SMTP hostname",
"smtp_port": SMTP Port, 
"secure":true/false, 
"mail_from":"from-email",
"simplify3x_username": "email",//for smtp authentication 
"simplify3x_password": "password"

```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FPP8IJxsR5I5v8kfp6iZI%2Fimage.png?alt=media&#x26;token=d2cd2595-b242-43f0-9022-7e26dd3f5d17" alt=""><figcaption></figcaption></figure>

**MQ Configuration**

* Eecute the below command to run RabbitMQ:3-Management Docker Image

```
docker run -d --hostname rabbitmq --name qarabbitmq -e RABBITMQ_DEFAULT_USER=<username> -e RABBITMQ_DEFAULT_PASS=<password>
-p 5671:5672 -p 15671:15672 rabbitmq:3-management
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FM4eol8zszNAfPCTVvMeM%2Fimage.png?alt=media&#x26;token=d2d49a34-a803-4edb-b1f5-3a78f6ca26ef" alt=""><figcaption></figcaption></figure>

* Execute the below command to for changes to be made in SimplifyQARabbitMQ projectonfig.js file before running the simplifyRabbitMQ Docker image

```
1."dburl": "mongodb://<username>:<password>@dbserverIP:27017/bolt" 
2."rabbitUrl":"amqp://<username>:<password>@serverIP:5671"
3. “serverUrl": "http://serverIP:4011”

```

* Execute the simplifyRabbitMQ Docker Image

```
docker run -d -v
/root/simplify-RabbitMQ/projectconfig.js:/simplifyqarabbitmq/configuration/projectc onfig.js -v
/root/simplify-RabbitMQ/logs/simplifyqarabbitmq.log:/var/log/simplifyqarabbitmq.log simplifyqarabbitmq
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FhtvuLoOWLcxYmGCAgJcX%2Fimage.png?alt=media&#x26;token=bc01268c-6f10-4f1f-bffa-be80e951e907" alt=""><figcaption></figcaption></figure>

* Create file simplifyqarabbitmq.log within logs directory

```
mkdir logs
```

> **Note:** In this Example have mounted projectconfig.js file outside the project folder of both simplifyQA application and SimplifyQA rabbitMQ.

ssh username\@Ipaddress&#x20;

ubuntu 18.04 machine

#### Troubleshooting on-premise deployment

* Execute the below command to view the SimplifyQA app logs

```
File Location: projectfolder/logs/qaserver.logs
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2FT45LTwR7mRebagzec6W2%2Fimage.png?alt=media&#x26;token=521c6339-a489-4115-a4f3-b97dfeba54e9" alt=""><figcaption></figcaption></figure>

* Execute the below command to view the SimplifyQA RabbitMQ logs

```
File Location: projectfolder/logs/simplifyqarabbitmq.log
```

<figure><img src="https://2640723101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMxErCxeVwmOt7GY9s22U%2Fuploads%2F7aAyjAcE9goRWS9xmRzu%2Fimage.png?alt=media&#x26;token=37aebe08-9913-4c5b-9f29-4607efa64a97" alt=""><figcaption></figcaption></figure>
