Development version
🇬🇧
![]()
This guide was documented for Ubuntu 20.04 LTS (Focal Fossa)
Requirement:
- 8GB RAM or more
- 6 Core CPU or more
- 2GB of Free space or more
Prerequisites:
- Access to Gcalls' Gcalls Plus Webphone docker version and Gcalls' Gcalls Plus Webphone
- nvm
- git
- node
- npm
- Visual Studio Code (or any other code editor you'd prefer, *)
- software-properties-common, apt-transport-https (cho Visual Studio Code)
- curl, wget
- pm2
- docker-compose
- docker
(*) Code editor or IDE is optional => you can 100% finish this guide only using Ubuntu GUI (GNOME as default) and Ubuntu Terminal (GNOME as default) or just Ubuntu Terminal
I. Install necessary softwares, dependencies and tools (skip this step if all prerequisites are sastified)
Using Ubuntu's built-in terminal (GNOME Terminal - Default Terminal) First
```
sudo apt update
```
1. git
sudo apt install git-all
- Kiểm tra git:
git --version
2. curl and wget
sudo apt update
- curl
sudo apt install curl - wget
sudo apt install software-properties-common apt-transport-https wget
3. nvm
Install nvm using curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Or using wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Add to bashrc
source ~/.bashrc
- Check nvm:
nvm -v
4. node and npm
Install node v16
nvm install v16
- Check node and npm:
node -v
npm -v
5. VS Code (optional)
5.1 Update package index and install necessary dependencies (software-properties-common apt-transport-https):
sudo apt update
sudo apt install software-properties-common apt-transport-https wget
5.2 Import GPG key from Microsoft:
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
5.3 Enable VS Code repository:
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
5.4 Once repo has been enabled, install VS Code:
sudo apt install code
- Kiểm tra VS Code:
code -v
6. pm2
- Install pm2:
npm install pm2@latest -g - Kiểm tra pm2:
pm2 --version
7. Docker
- Update packages:
sudo apt-get update
sudo apt-get install - Add keyring ad sourcelist:
sudo mkdir -p /etc/apt/keyrings
cd /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update - Install Docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin - Check Docker:
docker -v
8. docker-compose
- Install docker-compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose - Give executable right to docker-compose:
sudo chmod +x /usr/local/bin/docker-compose - Check docker-compose:
docker-compose -v
II. Install the sourcecode
There're a few ways to get this done:
- Terminal
- Ubuntu GUI and Terminal
- Ubuntu GUI, Terminal and VS Code Terminal
The following guide will show you how it's done via Ubuntu Terminal and/or VS Code Terminal
Open a terminal (Crl+Alt+T)
1. Pick a folder for the source code (e.g: gcalls-community-version)
- If you want to use VS Code:
- Open the folder in VS Code
code . - Open a new Terminal on VS Code
2. Download the repo:
- Initialize:
git init
git clone https://gitlab.com/gcalls-opensource/gcalls-community-version - Access the folder:
cd gcalls-community-version - Update git info and check current branch:
git fetch
git branch - Switch branch:
git checkout Development - Check branch:
git branch - Switch to a new branch (optional):
git checkout -b <your new branch>
4. Install Gcalls Plus Webphone:
- At root
/ofgcalls-community-version, accesssh/non-dockercd sh/non-docker - Run each script one by one to build the whole project
- Install MongoDB
sh installMongo.sh - Install Redis
sh installRedis.sh - Install Postgres
sh install Postgres.sh - Install CouchDB
sh installCouchDB.sh - Install Ngrok
sh instalNgrok.sh - Install Gcalls Plus Webphone
sh runallsh.sh
- Install MongoDB
- Gradually, each service will be online
- Next time, to run Gcalls Plus Webphone, you just need to run the following script:
sh runsh.sh - Check Gcalls Plus Webphone
- Check each service's status
pm2 status - Check each service's real time log
pm2 log <số thứ tự của service xem theo pm2 status>
- Check each service's status
5. Install Keycloak (Authentication Manager) Docker version and Logstash (Logging manager)
Exit non-docker and access log-service/docker
cd ../../log-service/docker
- Initialize docker for LogstashExit
```
docker-compose up -d logstash
```dockerand accessiam-service
cd ../../iam-service
- Initialize docker for Keycloak and Postgres
docker-compose up -dUsername Password Postgres keycloak keycloak@2022 Keycloak admin gadmin@2022 - Check Keycloak and Postgres:It's working if
docker logs -f keycloak --tail 1000Http management interface listening on http://127.0.0.1:9990/managementorAdmin console listening on http://127.0.0.1:9990is present. Press Crl + CIt's working if it's accessible. Exit the containerdocker exec -it iam-service_postgres psql -U keycloakexitLogstash is successfully initialized if the message "Successfully started Logstash API endpoint {:port=>9600}" is displayeddocker logs logstash -f
6. Database
Exit iam-service and access non-docker
cd ../sh/non-docker
6.1 Install
- At
gcalls-community-version/sh/non-docker, run the following script- Install MongoDB
sh installMongo.sh - Install Redis
```
sh installRedis.sh
``` - Install CouchDB
sh installCouchDB.sh
- Install MongoDB
- Check databases
- MongoDB
sudo service mongod status - Redis
```
sudo service redis status
``` - CouchDB
sudo service couchdb status
- MongoDB
6.2 Database Backup (Optional)
6.2.1 MongoDB
Via Ubuntu GUI and Ubuntu Terminal:
- Create a new folder (e.g:
gcalls-example-db):mkdir gcalls-example-db - Access that folder:
cd gcalls-example-db - Download backup data:
wget -O gcalls-example-db.zip --no-check-certificate "https://gstatics.sgp1.digitaloceanspaces.com/contributor-setup-data/myMongoDB.zip" - Check downloaded file:
ls - Unzip file:
unzip gcalls-example-db.zip- Install
unzipif not present on your systemsudo apt install unzip
- Install
- Import data into MongoDB:
mongorestore --db access-service myMongoDB/<path to database backup folder>mongorestore --db <database name> myMongoDB/access-service
mongorestore --db customer-service myMongoDB/customer-service
mongorestore --db integration-manager myMongoDB/integration-manager
mongorestore --db record-service myMongoDB/record-service
mongorestore --db third-party-service myMongoDB/third-party-service
mongorestore --db user-service myMongoDB/user-service
6.2.2 Postgres
Only require Ubuntu GUI (GNOME as default) and Ubuntu Terminal (GNOME Terminal): Note: keycloak database in Postgres must be empty in order to import new data.
- Stop Keycloak:
docker stop keycloak - Docker exec into Postgres:
docker exec -it iam-service_postgres_1 sh - Create a new user:
createuser -U keycloak --interactive - Fill out name and assign the user as a superuser:
Enter name of role to add: postgres
Shall the new role be a superuser? (y/n) y - Access the database as the new user:
psql -U postgres - Delete keycloak database
drop database keycloak - Recreate keycloak database
create database keycloak - Exit psql and docker container
exit\q - Create a new folder and access it:
mkdir postgres
cd postgres - Download backup data
wget -O dumpfile "https://gstatics.sgp1.digitaloceanspaces.com/contributer-setup-data/postgresBackup" - Import into Postgres
cat dumpfile | docker exec -i iam-service_postgres_1 psql -U keycloak
III. Using Gcalls Plus Webphone
- Access localhost:4004 (Gcalls Plus Webphone's Frontend) to use Gcalls Plus Webphone
- Access localhost:8080 (Keycloak's Frontend) to manage accounts/ credentials of all callcenter | username | password | |----------|-------------| | admin | gadmin@2022 |
1. If you didn't import backup data into MongoDB and Postgres
- Sign up for a new callcenter
- Check your email's inbox and click confirm button
- Enter password for your new account
- Sign in with your new callcenter and account For reference Gcalls Plus Webphone tutorial (🇬🇧 - English - Subtitle)
2. If you did import backup data into databases
- Use the account below to sign in: | email | password | callcenter | |----------|-------------|-------------| |gcalls.test@gmail.com| 12345678 | gcallstest |