How to build Insights Docker Image (Linux)
- Akshay Sharma (Unlicensed)
- Abirami
- Hari (Unlicensed)
Step - by - step guide to how to Install Insights on Linux using Docker
Prerequisite:
Install Docker:
On RHEL/Centos7:
- yum update
yum install yum-utils
- yum-config-manager --enable rhui-REGION-rhel-server-extras
- yum install docker
- systemctl start docker
- systemctl status docker
- systemctl enable docker (start docker at system boot)
On Ubuntu:
- apt-get update
- apt-get upgrade
- apt-get install docker.io
- systemctl start docker
- systemctl enable docker
For docker commands please visit - https://docs.docker.com/edge/engine/reference/commandline/docker/
Build Docker Image:
Build Image:
- git clone -b dockerImage https://github.com/CognizantOneDevOps/Insights.git
- cd Insights/dockerImageFiles/UIEngineAgentDaemonImage
- Dockerfile
- config.env
- insights_wrapper.sh
3. Convert files format to UNIX format : dos2unix *
4. Update config.env with the below specified values.
config.env
Variables | Details |
---|---|
hostIP | host machine IP where you are running docker container which will start rabbitmq,grafana and InsightsUI in this given hostIP |
neo4jIP | IP of Neo4j |
postgresIP | IP of PostgreSQL |
elassticIP | IP of ElasticSearch |
5. Execute the docker build command where Dockerfile located.
Syntax: docker build -t reponame:tag .
Command: docker build -t infra.cogdevops.com:8090/onedevopsinsights:<version> .
6. To push the built image to repo.
docker login -u <username> -p <password> infra.cogdevops.com:8090
docker push infra.cogdevops.com:8090/onedevopsinsights:<version>
List docker images: docker images
To run UIEngineAgentDaemon docker container: Insights Docker Installation
Run docker containers EngineJar/Deploy war (Obsolete):
Create Images:
Create a directory and copy files from
- dockerfile
- insightsJar.sh
- config.env
Execute the following command:
dos2unix *
This command will convert downloaded files to UNIX format
Overview of property to be set in config.env file:
Variables | Details |
---|---|
postgresIP | IP of PostgreSQL |
neo4jIP | IP of Neo4j |
mqIP | IP of Rabbit MQ |
insightsConfig | URL of InSightsConfig.zip |
jdkURL | URL of Java JDK |
jarURL | URL for updated PlatformEngine.jar |
Update config.env variables and run the below command from the path of copied files.
docker build -t tag_name .
Example : docker build -t insights/engine .
The above command create an image with unique id which will be used to create the containers.
Check the list of images created by,
docker images
Create containers -
Run the image built to create containers
docker run -dit --env-file config.env imageID
Let ' e10aca6729db ' be the imageID created.
Example : docker run -dit --env-file config.env e10aca6729db
This command will create a container and return a code, details of the container can be viewed by running the command ' docker ps '
-dit runs the container in detached mode. For interactive mode use -it.
Ensure that docker run command is executed from the path where config.env is present.
To list the containers -
docker ps [ For active containers ]
docker ps -a [ For all containers ]
Check logs of container -
docker logs containerID
Let '614bcc4546de' be the containerID created,
Example : docker logs 614bcc4546de
Connect to the container -
User can get into the newly created container where jar is running by ,
docker exec -it containerID bash
Example : docker exec -it 614bcc4546de bash
Create Images -
Make a directory and copy files from
- dockerfile
- insightsUI.sh
- config.env
Execute the following command:
dos2unix *
This command will convert downloded files to UNIX format
Make sure that you have connection with the instance where you have other components ( Postgres, Rabbitmq, Neo4j )
Overview of variables to be set in config.env
Variables | Details |
---|---|
elasticIP | IP of Elastic Search |
postgresIP | IP of PostgreSQL |
neo4jIP | IP of Neo4j |
mqIP | IP of Rabbit MQ |
ldapUrl | URL of LDAP |
bindDN | Bind DN of LDAP |
bindPassword | Password for Bind DN |
searchBaseDN | Base DN for LDAP Search |
jdkURL | URL of Java JDK |
insightsConfigURL | URL of InSightsConfig.zip |
grafanaURL | URL of Grafana |
grafanaLDAP | URL of ldap.toml |
grafanaDefaults | URL of defaults.ini |
insightsUI | URL of InSightsUI.zip |
insightsWar | URL of PlatformService.war |
tomcatURL | URL of apache tomcat |
Update config.env variables and run the below command from the path of copied files.
docker build -t tag_name .
Example : docker build -t insights/ui .
The above command create an image with unique id which will be used to create the containers.
Check the list of images created by,
docker images
Create containers -
Run the image built to create containers
docker run -dit -p 3000:3000 -p 8080:8080 --env-file config.env imageID ping -t localhost
Let ' e10aca6729db ' be the imageID created.
Example : docker run -dit -p 3000:3000 -p 8080:8080 --env-file config.env e10aca6729db ping -t localhost
- dit runs the container in detached mode. For interactive mode use - it.
- p helps to expose specified ports. If port is already in use, try with other port of host to connect.
Make sure that Grafana runs on 3000 by default.
To list the containers -
docker ps [ For active containers ]
docker ps -a [ For all containers ]
Check logs of container -
docker logs containerID
Let '614bcc4546de' be the containerID created,
Example : docker logs 614bcc4546de
Connect to the container -
User can get into the newly created container where jar is running by ,
docker exec -it containerID bash
Example : docker exec -it 614bcc4546de bash
Check the URLs -
Note: insightsUI.sh file fetches publicIP of the host that you are using and run Grafana, Tomcat on relevant ports of it.
If any of the container orchestration utility (like kubernetes) is used in order to run this UI image, then 'ping -t localhost' is not needed at the end of 'docker run' command
http://hostPublicIP:3000 for grafana
http://hostPublicIP:8080/app for Insights UI
©2021 Cognizant, all rights reserved. US Patent 10,410,152