Change default port of Hybrid Chat
In this document, we will guide you on how you can change the default port of Hybrid Chat deployed on Docker in Linux (CentOS) Environment, Before you follow this document, you need to make sure the following conditions are satisfied.
- You have deployed Hybrid Chat older version, i.e. 3.13 or older in CentOS in Docker Engine
- You should have the port allowed in the firewall of Network and CentOS.
Update the Ngnix configuration file.
First of all, you need to navigate to the Nginx directory and make a backup of the conf
file and then update the https-singleton.conf
file.
If the solution is deployed in HA, we need to implement the following steps on primary node file i.e. http.primary.conf
and
http.secondary.conf
on secondary node instead of https-singleton.conf
cd /path/to/hc/docker/nginx
take a backup of the current configuration file.
cp https-singleton.conf https-singleton.conf_backup
then open the file https-singleton.conf
and update it
vi https-singleton.conf
You would see a snippet of something like below.
server {
listen 443 ssl;
server_name chatsolution.expertflow.com;
# OWASP Recommended secure headers
# HTTP Strict Transport Security (HSTS)
we need to change the 443 port to the port of your desire. Say, here we change it to 8443.
server {
listen 8443 ssl;
server_name chatsolution.expertflow.com;
# OWASP Recommended secure headers
# HTTP Strict Transport Security (HSTS)
Now, look keenly for the server block with port 8443, we need to change it to something other than 8443 like 9443.
server {
listen 9443 ssl;
server_name chatsolution.expertflow.com;
location = / {
rewrite ^ /customer-gadget/ permanent;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
Save the file https-singleton.conf
and remove the nginx container by efutils service
and then run it by efutils profile.
efutils service
Please select Expertflow Service Container:
1) expertflow_activemq_1 13) expertflow_ecm-services_1
2) expertflow_agent-gadget_1 14) expertflow_file-engine_1
Please select:3
Please select action for expertflow_app-gateway_1
1) up
2) stop
3) kill
4) restart
5) rm
Please select: 5
efutils profile
Please select Expertflow Service Profile
1) agent-gadget 6) db-connector 11) portainer
2) amq 7) eabc 12) routing
3) campaigns 8) hc-server 13) service-gateway
4) ccm 9) mongo 14) umm
5) customer-gadget 10) mysql
Please select:13
Please select action for service-gateway
1) up
2) down
3) restart
4) ps
Please select:1
performing up -d operation on service-gateway
Update the Hybrid Chat Environment Variables
Before updating port in environment variables of Hybrid Chat, you must efutils all down
the solution. Navigate to the directory where HC is cloned and run the following directory in chat-solution
folder.
efutils all down
Make sure all the components are down by running
efutils status
When all the containers are sopped and removed, Make the changes in the following components of chat solution.
In the directory of docker/environment-variable
, make the following changes in .env files.
sed -e 's/<FQDN>/<FQDN>:<PORT>/g' *
For instance if your FQDN is devops242.ef.com and you want to change the port from 443 to 8443, the above command will yield into the following command:
sed -e 's/devops242.ef.com/devops242.ef.com:8443/g' *
Now up the HC solution
efutils all up
Now navigate to the directory where the web widget is deployed and edit the config.js file and change the customer gadget URL.
const customer_widget_url = "https://FQDN:8443/customer-gadget/";
That's it. Now you should have the Hybrid Chat running at the port of 8443. Access the agent gadget by accessing the following URL
https://FQDN:8443/agent-gadget