Docker 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
- docker-compose
- docker
- curl, wget
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
- Check 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. Docker
- Update packages:
sudo apt-get update
sudo apt-get install - Add keyring and 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
6. 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 sourcecode
There're a few ways to get this done:
- Terminal
- Ubuntu GUI and Terminal
The following guide will show you how it's done via Ubuntu Terminal
Open a terminal (Crl+Alt+T)
1. Pick a folder to store the source code (e.g: source_code)
Create one if desire
mkdir source_code
2. Open the folder:
- Access that folder:
cd source_code
3. Download the repo:
- Initialize:
git init
git clone https://gitlab.com/gcalls-single-node/devops-prod - Acess
devops_prodcd devops_prod - Fetch git info and check current branch:
git fetch
git branch - Switch branch:
git checkout release - Check branch:
git branch
4. Khởi tạo docker:
Go out of devops-prod
cd ..
First, login GitlLab via docker:
docker login https://registry.gitlab.com/gcalls-single-node
docker login https://registry.gitlab.com/gcalls-opensource
Enter username and password for your GitLab account.
4.1 Keycloak (Authentication Manager) and Logstash (Logging manager)
4.1.1 Download the repo:
- Download:
git clone https://gitlab.com/gcalls-opensource/gcalls-community-version - Access
gcalls-community-versioncd gcalls-community-version - Fetch git info:
git fetch - Switch branch to Development:
git checkout Development - Check branch:
git branch - Switch to a new branch (optional, will inherit all commits of the previous branch):
git checkout -b <your new branch>
4.1.2 Initialize docker:
- At root
/ofgcalls-community-version, accesslog-service/docker/cd log-service/docker - Initialize docker for Logstash
docker-compose up -d logstash - At root
/ofgcalls-community-version, accessiam-servicecd iam-service - Initialize docker for Keycloak and Postgres
docker-compose up -dUsername Password Postgres keycloak keycloak@2022 Keycloak admin gadmin@2022 - Check Keycloak, Postgres and Logstash: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
4.1.3 Import data into Postgres for Keycloak (Optional):
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
4.2 Gcalls Plus Webphone Database:
4.2.1 Database installation:
- Exit
gcalls-community-versioncd .. - Access
devops-prodAt root```
cd devops-prod
```/ofdevops-prod, run the following commands - MongoDB:Default account: | username | password | |----------|-------------| | gadmin | Gcalls2021devops |
docker-compose -f dc-mongo0.yml up -d - CouchDB:Default account: | username | password | |----------|-------------| | gadmin | GqMKXwfP73Kw7h6y |
docker-compose -f dc-couchdb.yml up -d - Redis:Check databases:
```
docker-compose -f dc-redis.yml up -d
``` - MongoDB:It's working if it's accessible. Exit the container
docker exec -it mongo0 mongo -u admin -p Gcalls2021devopsexit - Couchdb:It's working if it's accessible. Exit the container
docker exec -it iam-service_postgres_1 psql -U keycloakexit - Redis:It's working if it's accessible. Exit the container
docker exec -it redis redis-cliexit
4.2.2 Import data into MongoDB for Gcalls Plus Webphone (Optional)
Via Ubuntu UI 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
- Copy that file into container:
docker cp GcallsCVDB2 mongo0:/dump - Import data into MongoDB:
docker exec -i mongo0 /usr/bin/mongorestore --username admin --password Gcalls2021devops --db <database name> /dump/<path to database backup folder>docker exec -i mongo0 /usr/bin/mongorestore --username admin --password Gcalls2021devops --db access-service /dump/access-service
docker exec -i mongo0 /usr/bin/mongorestore --username admin --password Gcalls2021devops --db access-service /dump/customer-service
docker exec -i mongo0 /usr/bin/mongorestore --username admin --password Gcalls2021devops --db access-service /dump/integration-manager
docker exec -i mongo0 /usr/bin/mongorestore --username admin --password Gcalls2021devops --db access-service /dump/record-service
docker exec -i mongo0 /usr/bin/mongorestore --username admin --password Gcalls2021devops --db access-service /dump/third-party-service
docker exec -i mongo0 /usr/bin/mongorestore --username admin --password Gcalls2021devops --db access-service /dump/user-service
4.3 Gcalls Plus Webphone:
At root / of devops-prod, run the following commands
- Backend:
docker-compose -f dc-user.yml up -d
docker-compose -f dc-customerService.yml up -d
docker-compose -f dc-3rd.yml up -d
docker-compose -f dc-record.yml up -d
docker-compose -f dc-filter.yml up -d - Middle:
docker-compose -f dc-access.yml up -d
docker-compose -f dc-pbxlog.yml up -d
docker-compose -f dc-mobile.yml up -d
docker-compose -f dc-api.yml up -d
docker-compose -f dc-integration.yml up -d - Frontend:
docker-compose -f dc-webphone.yml up -d
docker-compose -f dc-customerManagement.yml up -d
5. Check docker:
- View running dockers' info:
docker ps - View docker containers' status (run separately):
docker logs <tên của docker container xem trong docker ps>docker logs user-service
docker logs customer-service
docker logs third-party-service
docker logs record-service
docker logs filter-service
docker logs access-service
docker logs pbxlog-service
docker logs mobile-service
docker logs api-management
docker logs integration-manager
docker logs webphone-service
docker logs customer-management
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 callcenters | 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 |