iHub v6.4.3-Deployment Process

Purpose of this document is to provide guideline for deploying iHub Lite in a docker swarm environment for azure. The document contains prerequisites for installing iHub Lite application and detailed instructions to deploy iHub Lite application.

Contents

  1. Architecture
  2. Prerequisites
  3. Preparation Activities
    1. Guidance on Setting up Networks and resource Group for Ihublite
    2. Create iHubLite VM in Azure
    3. Initialize Swarm Cluster
    4. Deployment Preparation
  4. Pre-Deployment Activity
  5. Deploy IHubLite component(Approximately 10 mins)
  6. Post-Deployment Activity
    1. Create User in Mongo DB
    2. Create admin user in Rabbitmq
  7. Post Deployment Checks & Validations (approximately 5 minutes)
  8. URLs for accessing application features

Architecture

IHub Lite Architecture diagram is as follows

Picture 3

Prerequisites

 

Preparation Activities

Guidance on Setting up Networks and resource Group for Ihublite

Create iHubLite VM in Azure

VM

Type

CPU/Memory

Disk Size

Type

OS / Data

App

Standard B2ms (in Azure)

2 vcpus, 8 GiB

128 GiB

Premium SSD

Ubuntu 18.04

 

If the infrastructure is not Azure, create same size of VM in any other infrastructure

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

ADMIN_USERNAME

User name : usually smartops

 

Place install_dependencies.sh script and public key file in same location where the vm creation script(setup-vm-ihub-lite-stage.sh) is being executed. install_dependencies.sh file will install all prerequisite softwares required to deploy IhubLite application. The failure in execution of this script causes failure in installation of ihublite.

 

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

Initialize Swarm Cluster

SSH <ihublite-001 VM>

docker swarm init

Swarm initialized: current node (dxn1zf6l61qsb1josjja83ngz) is now a manager.

 

To add a worker to this swarm, run the following command:

 

docker swarm join \

--token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c \

192.168.99.100:2377

 

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

 

Deployment Preparation

 

Pre-Deployment Activity

Deploy IHubLite component(Approximately 10 mins)

 

tar -xvf smartops-ihublite-R6.4.3.tar.gz

 

A folder with the same name as the package will be created in the location where you extract the package. This will contain all the required files and folders.

 

cd ~/<package_name>/installer/

 

sh init.sh

 

Edit config.ini file with the environment details as below. Edit only the highlighted values with environment specific values

vi config_component.ini

 

 

Variable

Description

COMPONENT_NAME

Name of the Component.
Example ihublite etc

DNS_NAME

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

NETWORK_NAME

New Overlay network to be created for the component. The network for ihublite is ihublite-overlay-network

LB_NAME

#Azure Load Balancer Name for RabbitMQ connection

DEPLOY_OR_UPGRADE

Flag to indicate if deploy from scratch or upgrade from existing release. To update value for this parameter as ‘Upgrade ’ after first deployment.
Example: DEPLOY_OR_UPGRADE = upgrade, DEPLOY_OR_UPGRADE = deploy

MONGO_ADMIN_PASSWORD

Admin Password for MongoDB. By default, it is set as 1hubl1t3

RABBIT_MQ_ADMIN_PASSWORD

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

 

 

cd ../stack-repo

#Update the azure container registry key

vi registry-pass.txt

#Save the key and exit

 

 

cd ../installer

./deploy_component.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

 

Post-Deployment Activity

Create User in Mongo DB

 

docker ps | grep mongo

# take first parameter container id and execute below command

docker exec -it <container_id> bash

# execute below command to login to mongodb

mongo -u ihublite -p <set_mongo_admin_password>> -authenticationDatabase admin

# execute below script

use admin

db.createUser({user: "ihub", pwd: "admin",roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]})

use IHUB

db.UserCredentials.insert({"username" : "ihubmaster", "password" : "ENC(2RrUa86hRjtpcGAe1UwuHRn3zTYTJAdl", "role" : "ADMIN"});

exit

exit

#

cd ../stack-repo

./stop-start-stacks.sh ihublite

Create admin user in Rabbitmq

  1. Go to rabbitmq console using http://<dns-name-ihublite>:<rabbitmq-port>

  2. Login with default guest/guest credentials in RabbitMQ console

  3. Create an admin user with credentials admin/admin.
    Picture 4

  4. Click on the created admin user and set permission for that user for vhost /
    Picture 5

  5. Logout and login again with admin/admin credential

Picture 2

Post Deployment Checks & Validations (approximately 5 minutes)

 

~ docker service ls

ID NAME MODE REPLICAS IMAGE PORTS

r62sfj015rg1 ihublite-mongo_ihublite-mongo replicated 1/1 mongo:4.1.4

3vico691nzw2 ihublite_ihub-component-lite replicated 1/1 smartopsregistry.azurecr.io/smartops/ihub-component:6.4.3.96

e07zt2h70nt9 ihublite_ihub-services-lite replicated 1/1 smartopsregistry.azurecr.io/smartops/ihub-services:6.4.3.116

xv5rvp3twzy6 ihublite-rabbitmq_ihublite-rabbit replicated 1/1 rabbitmq:3.7-management

 

# the following command give the service logs with service name

docker service logs ihublite_ihub-component-lite

docker service logs ihublite_ihub-services-lite

 

 

URLs for accessing application features