Platform v6.4.3- Deployment Process (Docker Swarm)

Purpose of this document is to provide guideline for deploying SmartOps Platform in a docker swarm environment for azure. The document contains prerequisites for installation and detailed instructions to deploy SmartOps along with FAQs and post deployment validation steps.

Contents

  1. Setup Docker Swarm Cluster
  2. Deployment Timings
  3. Preparation Activities
    1. Setup Resource Group and Networks
    2. Creating Docker Swarm Node VMs
    3. Instructions for Proxy Enabled and Client Environments
    4. Initialize Swarm Cluster
    5. Label Swarm Cluster Nodes – (Automated steps- For information of Installation engineers)
    6. Infra Node fix for Elasticsearch - (Automated steps- For information of Installation engineers)
    7. Configure Azure Application Gateway – SmartOps
  4. Pre-Deployment Activity
  5. Deploy SmartOps
    1. Deploy Log Monitoring Stack
  6. Post-Deployment Activity
    1. Additional Config Steps in Deployment
    2. Check and Update Keycloak Config, add User and Protocol Mapper
    3. Create Keycloak Protocol Mapper
    4. Get Offline token and update the stack files
    5. Update the stacks with new token or NER Service ID and redeploy app stacks
    6. Setting up Indices for Kibana Logs
    7. Configure Azure Load Balancer for External access of RabbitMQ in TLS enabled channel
  7. Post Deployment Checks & Validations
    1. Validate Deployment
    2. Perform Post Deployment Configurations
    3. Validate Application Access
  8. URLs for accessing application features
  9. Archive Release artifacts (Production or Client Environments)
  10. AD Integration

Setup Docker Swarm Cluster

Follow the below instructions to set up docker swarm environment and to complete the prerequisites for deploying SmartOps application.

Picture 21

Deployment Timings

Timings will vary based on the environment and network

Activities

Duration

Preparation Activities

 -

Setup Resource Group and Networks

15 minutes

Creating Docker Swarm Node VMs

30 minutes

Instructions for Proxy Enabled and Client Environments

15 minutes

Initialize Swarm Cluster

5 minutes

Configure Azure Application Gateway

30 minutes

Pre-Deployment Activity

NA

Deploy SmartOps

75 minutes

Deploy Log Monitoring Stack

10 minutes

Post-Deployment Activity

20 minutes

Post Deployment Checks & Validations

 

Validate Deployment

25 minutes

Perform Post Deployment Configurations

15 minutes

Archive Release artifact (Production or Client Environments)

10 minutes

 

Preparation Activities

Following are the preparation activities:

Setup Resource Group and Networks

Creating Docker Swarm Node VMs

 

VM

Type

CPU/Memory

Disk Size

Type

OS / Data

App - 1

Standard D16s v3

16 vcpus, 64 GB

256 GB

Premium SSD

OS

App - 2

Standard D16s v3

16 vcpus, 64 GB

256 GB

Premium SSD

OS

Infra - 1

Standard D16s v3

16 vcpus, 64 GB

512 GB

Premium SSD

OS

 

*Accelerated Networking should be enabled in VM NICs for better performance of cluster.

Create the VMs with authentication mechanism as SSH public key

 

https://docs.microsoft.com/en-us/azure/virtual-machines/linux/quick-create-cli?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json

 

Variable

Description

RESOURCE_GROUP

Azure Resource Group

VNET_NAME

Azure Virtural Network Name Created within that Resource Group to associate with VM

SUBNET_NAME

Azure Sub Network Name Created within that Resource Group to associate with VM

NSG_NAME

Network Security Group Name if already created, or else it will be created as part of this script

ENV_PREFIX

Environment Prefix - Example: engg, sales, delivery etc

ENV_ID

Environment ID - Example: dev, qa, stage, prod etc

PURPOSE

Environment Purpose - Example: smartops, pwf-invoice, pwf-monitoring etc

KEYFILE

Create the public key and provide the filename. Ensure this file is placed in same location

ENV_TAG

Tag to be attached to these resources

BUSINESS_UNIT_TAG

Tag to be attached to these resources

AZ_LOCATION

Azure Location where resources to be created

 

Place install_dependencies.sh and docker-setup.sh scripts and public key file in same location where the vm creation script(smartops-suite-vm-setup.sh) is being executed. install_dependencies.sh and docker-setup.sh files will install all prerequisite softwares required to deploy the application. The failure in execution of this script causes failure in installation of SmartOps.

 

VM Names are set as vm-ENV_PREFIX-ENV_ID-PURPOSE-<Sequence>

 

Refer the above script with adequate input parameters to create 3 VMs with the names as below. The names are just for reference. Team can decide the naming convention of VMs to be followed.

vm-smartopsengg-dev-smartops-app-001, vm-smartopsengg-dev-smartops-app-002, vm-smartopsengg-dev-smartops-infra-001

As the model files are installed from jumpbox for previous deployments, please make sure that azcopy is installed in App1 VM before installation.

Instructions for Proxy Enabled and Client Environments

mkdir -p /etc/systemd/system/docker.service.d

sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf

#Add below configuration if not there already by replacing the proxy server and port for the environment.

[Service]

Environment="HTTP_PROXY=http://172.27.71.42:9401"

Environment="HTTPS_PROXY=http://172.27.71.42:9401"

sudo systemctl daemon-reload

sudo systemctl show --property Environment docker

sudo systemctl restart docker

 

# To initiate swarm cluster, run the following command:

docker swarm init

 

ssh <APP-001>

docker swarm join-token manager

# To add a manager node to this swarm, run the following command:

docker swarm join --token SWMTKN-1-2g2y0i29v726ephzrnrvcw0wnbhj0wnnos90adxepoajlfda08-btqj81s4j30xupd8gaf2tzesm 172.27.0.14:2377

 

Note: Find more info about setting up a docker swarm cluster here and other links in the website.

ssh <App-002 VM>

docker swarm join --token SWMTKN-1-2g2y0i29v726ephzrnrvcw0wnbhj0wnnos90adxepoajlfda08-btqj81s4j30xupd8gaf2tzesm 172.27.0.14:2377

exit

ssh <Infra-001 VM>

docker swarm join --token SWMTKN-1-2g2y0i29v726ephzrnrvcw0wnbhj0wnnos90adxepoajlfda08-btqj81s4j30xupd8gaf2tzesm 172.27.0.14:2377

exit

docker node ls

Result:

ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION

oout8h6cf8z42pu03xb44xv66 * vm-smartopsengg-dev-app-001 Ready Active Leader 19.03.8

l39k1xair19wfm225bphuslpg vm-smartopsengg-dev-app-002 Ready Active Reachable 19.03.8

z08tkuqp232tb5kjp4c87ce5g vm-smartopsengg-dev-infra-001 Ready Active Reachable 19.03.8

Infra Node fix for Elasticsearch - (Automated steps- For information of Installation engineers)

Apply below command to Infra Node VM if not reflected already. This is required for Elasticsearch

log in to the Infra VM (where the elastic search has installed) and validate if max map count is set

Reference: https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html

sudo sysctl -w vm.max_map_count=262144

#view the content of /etc/sysctl.conf and execute only if below entry is not present.
‎#viewing the content of /etc/sysctl.conf

cat /etc/sysctl.conf

sudo bash -c 'echo "vm.max_map_count=262144" >> /etc/sysctl.conf'

 

Configure Azure Application Gateway – SmartOps

Reference:

https://docs.microsoft.com/en-us/azure/application-gateway/overview

https://docs.microsoft.com/en-us/azure/application-gateway/quick-create-portal

 

Pre-Deployment Activity

Deploy SmartOps

tar -xvf smartops-platform-R6.4.3.tar.gz
cd <package_name>/installer/

sh init.sh

 

 
vi config.ini

 

 

Variable

Description

PWF_OR_PRODUCT_NAME

Name of the Packaged Workflow or Product. Here value is smartops-platform

DNS_NAME

DNS for the environment.
Example. https://smartops-dev.eastus.cloudapp.azure.com

PWF_OR_PRODUCT_DNS_SUFFIX

Suffix corresponding to deployment requirement. Leave it blank for SmartOps Platform .

INFRA_VM_NAME

Virtual Machine name(s) for Node Labelling. Provide the VM Name provisioned for SmartOps Infra Setup.
In case of multiple VMs, provide all the VMs with comma separated, and without any space in between.
Example: vm-smartopsengg-dev-infra-001,vm-smartopsengg-dev-infra-002

APP_VM_NAMES

Virtual Machine name(s) for Node Labelling. Provide the VM Name provisioned for SmartOps App Setup.
In case of multiple VMs, provide all the VMs with comma separated, and without any space in between.
Example: vm-smartopsengg-dev-app-001,vm-smartopsengg-dev-app-002

VESPA_VM_NAMES

Virtual Machine name(s) for Node Labelling. Provide the VM Name provisioned for DU Vespa Setup.
In case of separate VMs, provide all the VMs with comma separated, and without any space in between.
By default, it will be same as app VMs for SmartOps Platform.

MON_VM_NAME

Virtual Machine name(s) for Node Labelling. Provide the VM Name provisioned for Log monitoring Setup.

INFRAVM_IP

IP address of INFRA_VM

APPVM_IPS

app VMs' Ip address(es) (comma separated without any space in between)

VESPAVM_IPS

vespa VMs' Ip address(es) (comma separated without any space in between)

RELATIVE_PATH

Indicates the location of stack-repo directory containing stack files. By default it will be ../

HOME_PATH

Indicates the location where model files are downloaded. By default, it will be smartops

PROXY_SERVER

Proxy server settings : http://<proxy_host>:<port> if proxy is enabled. Leave it blank if Proxy is not required.

DEPLOY_OR_UPGRADE

Flag to indicate if deploy from scratch or upgrade from existing release.
DEPLOY_OR_UPGRADE = deploy

OFFLINE_TOKEN

Offline Token to be used for deployment.
Leave it blank for the first time and provide token once generated to upgrade

CLONES_STUDIO_UPLOAD_DIALOGUE_STATUS

Set this value to true for SmartOps Platform

MYSQL_ROOT_PASSWORD

Root Password for MySQL Database. By default, it is set as 5up3ru53r_sql_Sm.
This is applicable during first deployment when we set up the database.
In case of upgrade, please provide existing password.

MONGO_ADMIN_PASSWORD

Admin Password for MongoDB. By default, it is set as 5up3ru53r_mon_sm

POSTGRESQL_PASSWORD

Password for PostgreSQL. By default, it is set as postgres

MINIO_SECRET_KEY

Secret Key for Minio. By default it is set as 5up3ru53r_min_sm

RABBIT_MQ_ADMIN_PASSWORD

Rabbit MQ Admin Password. By default, it is set as admin

RABBIT_MQ_ADMIN_PWD_HASH_VALUE

Rabbit MQ Admin Password Hash Value.
BY default yj5MnG4b1HtIeiGaaWTs2kt9Pt+eK1uq0WkFXYf5HGuCn0jQ for default password admin.
In case of any changes to the password, update this value with corresponding HASH Value.

NER_SERVICE_ID

NER Project ID Created in Conversation Designer to integrate with Smart Sense. You can leave this blank if not used.

 

Eg: sed -i "s,gateway.zscaler.net,http://172.67.17.50,g" config/*/*.env

sed -i "s,PROXY_PORT=9400,PROXY_PORT=8500,g" config/*/*.env

 

cd ~/<package_name>/stack-repo/

sed -i "s,PROXY_ENABLED=false,PROXY_ENABLED=true,g" config/*/*.env

sed -i "s,gateway.zscaler.net,<PROXY_SERVER>,g" config/*/*.env

sed -i "s,PROXY_PORT=9400,PROXY_PORT=<PROXY_PORT >,g" config/*/*.env

 

Execute the following command to start deployment. The deployment takes 60+ minutes to complete

cd ~/<package_name>/installer/

./deploy.sh

 

Note: When deploying the services for first time, all the images are getting downloaded from image registry. So, there could be failures/delay in startup. If you see certain services failing after waiting for a period, you can try to redeploy using stop-start-stacks.sh for those specific stacks present in <package_name>/ stack-repo, or force update specific services. E.g is shown below.

./stop-start-stacks.sh <stack-name>

docker service update <stack-name>_<service-name> --force

 

Refer Post Deployment Checks & Validations for more validation steps on deployment

Deploy Log Monitoring Stack

Variable

Description

logmon_dns_suffix

Empty for Smartops platform

mysql_root_password

5up3ru53r_sql_Sm

grafana_email_user

Email id for Grafana SMTP user

grafana_email_password

Email user password for Grafana SMTP user

 

./install-env.sh

docker stack ps smartops-logmon

docker service ls | grep smartops-logmon

*** To know the service is up and running, use below command docker service ps <service_name>. service name is available from above command *****

docker service ps smartops-logmon_alertmanager-monitor

 

 

Post-Deployment Activity

Additional Config Steps in Deployment

It is necessary to add the domain and Active Directory (if enabled) in proxy to allow the access via Application

Once app-gateway is up and running you can access the application in browser with the url >/

Before starting to use the application, certain config steps are to be performed, which includes application restarts. Following config steps are to be done.

  1. Check keycloak configuration pages and add a new user.

  2. Generate New Offline token

  3. Update the stacks with new token and redeploy app stacks

Check and Update Keycloak Config, add User and Protocol Mapper

  1. Access keycloak URL with following link in a browserExample: https://smartops-prod.eastus.cloudapp.azure.com/keycloak/auth/

  2. Login to Administration Console using userid/password as admin/admin

  3. Go to “Clients” menu item on left pane and select smartops-frontend

  4. In Validate Redirect Uri you should see (if not enter it manually).

  5. In Web Origins add the following uri

  6. Click Save

  7. Go to “Users” menu item on left pane.

  8. Click Add User button

  9. Enter username as “smartops” and click save.

  10. Go to “Credentials” tab for the user and enter a password for login

  11. Go to “Role Mappings” tab for the user.

  12. For the time being assign all the roles to the user by selecting all from left list and putting it to right.

Create Keycloak Protocol Mapper

To create a protocol mapper named “role”, select the realm in dropdown, Clients in Configure, click on Smartops-frontend and click on Create in Mappers tab.

Picture 5

Provide the values mentioned in below screenshot and click on Save

Picture 4

 

Get Offline token and update the stack files

Picture 28

Picture 29

Picture 30

Update the stacks with new token or NER Service ID and redeploy app stacks

cd <package_name>/installer/

vi config.ini

# Update value for OFFLINE_TOKEN variable and save the file.

./update_additional_values.sh

cd ../stack-repo/

./stop-start-stacks.sh smartsense smartops-du monitoring

 

Setting up Indices for Kibana Logs

After opening Kibana, choose the Logs card on the home page. Move to the Settings tab and go to the Log Indices section to set the value as shown below.

To review the container logs via kibana, we have to set up the log indices pattern to “logstash-*”.

Picture 3

Configure Azure Load Balancer for External access of RabbitMQ in TLS enabled channel

 

Post Deployment Checks & Validations

Validate Deployment

docker service ls

 

docker service ls | grep 0/1

 

 

 

Picture 11

 

Restart respective stack using stop-start-stack.sh script which had rpc error.

Example: contract-mgmnt_cms_doclink_process is down. Then execute following steps to restart it .

The stack name will be ‘contract-mgmnt’ for above service.

cd ../stack-repo

./stop-start-stacks.sh contract-mgmnt

 

 

 

docker stack ps <stack_name>

 

Perform Post Deployment Configurations

Before starting to use the application, certain config steps are to be performed. Refer Post Deployment-Configuration Guide for executing the post deployment activity steps for configuring PWF roles and permission. If it is already executed, please ignore the steps.

Note: This step is mandatory to view the components available in the Home Page of application and in menu (nine dots)

Validate Application Access

Validate Application access by accessing following URL and login using the user id/password

https://<app-dns-name> /

 

Picture 10

 

URLs for accessing application features

Replace <app-dns-name> with the dns name configured in application gateway.

Eg: smartops.eastus.cloudapp.azure.com

For broker oidc endpoint:

https://<app-dns-name>/keycloak/auth/realms/ustglobal/broker/oidc/endpoint

For accessing SmartOps Application:

https://<app-dns-name> /

For accessing Master Realm for monitoring Application:

https://<app-dns-name>/uimux/smartops/master

For Logout URL:

https://<app-dns-name>/keycloak/auth/realms/ustglobal/protocol/openid-connect/logout

For Accessing logs:

 

Archive Release artifacts (Production or Client Environments)

The deployment artifacts contain sensitive information such as passwords . Hence the deployment folder should be archived to a protected location and removed from the VM after Successful Deployment.

# acrhive the deployment folder

cd ~

sudo tar -pcvzf <package_name>_archive.tar <package_name>

# Move created archive to a secured location

# Remove deployment folder

sudo rm -R <package_name>


AD Integration

Please follow attached document below to integrate keycloak with an Enterprise AD.

 

 

Feedback

Copyright © 2021 UST Global. All Rights Reserved.