In this Blog, we would go through a UseCase to demonstrate a Customer wanting to Track his Application Deployment through Service Now uses HWA to accomplish the same while also orchestrating the entire flow of Application Deployment and Service Now Ticketing Orchestration through HWA :
Requirement:
- An Application Team wants to use Containerized deployment of its Application packaged as jar files into an Application Server from time to time.
- The Application would be deployed along with a Database which could either be one of Mongo DB or Postgre-SQL DB instance to be deployed as a Container along with the Application.
- The Application would be deployed along with an Application Server which would be one of Apache or Nginx also to be deployed as a Container.
- The Entire Deployment would be tracked through HWA in real-time and updated on Service Now.
- The Request on Service Now would be closed once Deployment is complete.
- All Requests targeted for Automation would be Marked as “Automation=YES” in the Automation Field.
- A Request on Service Now would appear in the below way :
Fig1
Solution Conceptualization in HWA:
- A RESTFUL GET job would pick the latest Request from the Queue of Server Build team and would get a JSON response of the request in an Output File.
- A Set of Extract Jobs would extract the Application Jar Path, the Application Jar File Name, the Application, DBName, and Ticket Number from the request.
- A Set of Store Jobs would set HWA Variables for each of the Parameters such as Application Jar Path, the Application Jar File Name, the Application, DBName, and Ticket Number and would assign parameters extracted into corresponding variables using jobprop utility of HWA.
- An Application YAML file creation job would create a YAML file in the jar file location utilizing the parameters for jar file path and jar file name.
- An Application Deployment Job would deploy an Application Container taking the Application jar Filename as input.
- The Output Condition on the Store Job for DB would either pass the conditions: Mongo or Postgre depending on the DB HWA variable.
- The Output Condition on the Store Job for Application Server would either pass the conditions: Nginx or Apache depending on the APPLSERVERNAME HWA variable.
- If the Output Condition on DB Job is Mongo, a Mongo DB Container is provisioned on the Application Server through a Mongo DB deploy Job.
- If the Output Condition passed on the DB Job is Postgre, a Postgre DB container is provisioned on the Application Server through a Postgre DB deploy Job.
- If the Output Condition passed on the Application Server Store Job is Apache, an Apache Container is provisioned on App Server through a Apache WebServer deploy job.
- If the Output Condition passed on the Application Server Store Job is Nginx, and Nginx container is provisioned on the App Server through an Nginx WebServer deploy job.
- The Application provisioning if completed Successfully along with the DB Provisioning and WebServer Provisioning would satisfy a JOIN Condition which would then trigger a Request Update RESTFUL Put Job to update the Ticket with the Comments that the “Application Deployment along with DB Container and WebServer Deployment was Successful”.
- A Request Closure Job would then close the Ticket once the Ticket Update Job is Successful through RESTFUL Delete Call to Service Now taking the Request Number as Input.
- In the case, if Application Deployment Fails or DB Deployment Fails or WebServer Deployment Fails, then a JOIN Condition is satisfied which would update the request through a RESTFUL update job with the Comments that the “Application Deployment Failed”. So, that the Application team could review and troubleshooting.
Implementation:
For the above Usecase, we are making use of a Service Now Instance on SaaS with Administrator Role and having the below experience and View built in the table for Request Management :
Fig2
Fig3
SERVICENOW_GET_REQUESTS_CONTBUILD Job:
This is a RESTFUL GET job which makes a call to the URL https://dev114719.service-now.com/api/now/table/x_650167_requests_requests and query by descending order and Assignment Group Name server_build_team and Automation Flag marked as “YES” and picks the latest Request in the queue and stores the JSON response retrieved from the request in the output file /tmp/requestsserverbuildoutput.
Fig4
EXTRACT_REQUEST_APPLSERVER_CONTBUILD Job:
This is a Unix Job which would extract the Application Server to be deployed as part of the Deployment from the output file /tmp/requestsserverbuildoutput and display it in the joblog output.
EXTRACT_REQUEST_DB_CONTBUILD Job:
This is a Unix Job which would extract the DB Name to be deployed as part of the Deployment from the output file /tmp/requestsserverbuildoutput and display it in the joblog output.
EXTRACT_REQUEST_TKTNO_CONTBUILD Job:
This is a Unix Job which would extract the Ticket Number of the Request
from the output file /tmp/requestsserverbuildoutput and display it in the joblog output.
EXTRACT_REQUEST_APPLNAME_CONTBUILD Job:
This is a Unix Job which would extract the Application Jar File Name from the Output File /tmp/requestsserverbuildoutput and display it in the joblog output.
EXTRACT_REQUEST_APPLPATH_CONTBUILD Job:
This is a Unix Job which would extract the Application Jar Path from the Output File /tmp/requestsserverbuildoutput and display it in the joblog output.
Fig5
STORE_APPLSERVERNAME_CONTBUILD Job:
This is an executable job type which parses the EXTRACT_REQUEST_APPLSERVER_CONTBUILD Joblog output and uses the jobprop utility to set a HWA variable for Application Server Name .There are also two Output conditions which are passed through the Job called “APACHE” which is passed when the Joblog contains the String “Apache” and the condition “NGINX” which is passed when the Joblog contains the String “nginx”.
Fig6
Fig7
STORE_DB_CONTBUILD Job:
This is an executable job type which parses the EXTRACT_REQUEST_DB_CONTBUILD job’s Joblog output and uses the jobprop utility to set a HWA variable for DBName .There are also two Output conditions which are passed through the Job called “MONGO” which is passed when the Joblog contains the String “Mongo” and the condition “POSTGRE” which is passed when the Joblog contains the String “Postgre”.
Fig8
Fig9
STORE_APPLNAME_CONTBUILD Job:
This is an executable job type which parses the EXTRACT_REQUEST_APPLNAME_CONTBUILD Job’s Joblog output and uses the jobprop utility to set a HWA variable for APPLNAME extracting the jar filename in the Variable.
Fig10
STORE_APPLPATH_CONTBUILD Job:
This is an executable job type which parses the EXTRACT_REQUEST_APPLPATH_CONTBUILD Job’s Joblog output and uses the jobprop utility to set a HWA variable for APPLPATH extracting the Path to the jar file to be deployed.
Fig11
STORE_TKTNO_CONTBUILD Job:
This is an executable job type which parses the EXTRACT_REQUEST_TKTNO_CONTBUILD Joblog output and and uses the jobprop utility to set a HWA variable for Ticket No/Request No in a variable named TKTNO:
Fig12
VT_UPDATE_SNOW_CONT_USECASE Job:
This is a Variable table update Job which would update the variable table SNOW_CONT_USECASE set at the Jobstream Level with the HWA Variables : APPLPATH set to ${job:EXTRACT_REQUEST_APPLPATH_CONTBUILD.stdlist} , APPLNAME set to ${job:EXTRACT_REQUEST_APPLNAME_CONTBUILD.stdlist} , TKTNO set to ${job:EXTRACT_REQUEST_TKTNO_CONTBUILD.stdlist} so that the Application Jar Path , Application Jar File Name and Ticket Number is extracted readily .
Fig13
DEPLOY_APPL_YAML Job:
This is a Unix job which would take APPLPATH and APPLNAME as input and build a yaml file/Docker File for the Java Application to be deployed.
Fig14
DEPLOY_APPL_DOCKER Job:
This is a Unix job which would deploy the jar Application taking the Application Name(jar file name) as input and deploying a Dockerized Instance of the Application through the Docker File built in the previous step.
Fig15
DEPLOY_MONGODB_DOCKER Job:
This job would run when the condition MONGO is passed from the STORE_DB_CONTBUILD Job,this deploys a Mongo DB Containerized Instance through docker run command:
Fig16
DEPLOY_POSTGRESQLDB_DOCKER Job:
This Job would run when the condition POSTGRE is passed from the
STORE_DB_CONTBUILD Job , this deploys a Containerized Instance of Postgre SQL DB through a Docker run command :
Fig17
DEPLOY_NGINX_DOCKER Job:
This Job would run when the condition NGINX is passed from the
STORE_APPLSERVERNAME_CONTBUILD Job, this deploys a Containerized Instance of an Nginx through a Docker run command:
Fig18
DEPLOY_APACHE_DOCKER JOB:
This Job would run when the condition APACHE is passed from the STORE_APPLSERVERNAME_CONTBUILD Job , this deploys a Containerized Instance of an Apache through a Docker run command:
Fig19
DBDEPLOY Join Condition:
This is satisfied when one of the DB Deployment Jobs: Mongo DB or PostgreSQL DB finishes Successfully:
Fig20
APPLDEPLOYFAILED Join Condition:
This is satisfied when one of the AppServer deployment Jobs: Apache Deploy Job or Nginx Deploy Job or MongoDB Deploy Job or Postgre SQL Job or Application Deploy Docker Job finishes in Abend:
Fig21
APPSERVER Join Condition:
This is satisfied when one of the AppServer deployment Jobs: Apache Deploy Job or Nginx Deploy Job finishes Successfully:
Fig22
SNOW_UPDATE_TICKET_CONTBUILD Job:
This is RESTFUL Job which would post the Update to the Request/Ticket taking the Variable TKTNO as input making a call to the REST URL https://dev114719.service-now.com/api/now/table/x_650167_requests_requests/^TKTNO^ which would post the message “Application , DB and Middleware Deployment Successful” into comments section of the Ticket/Request .This job would run only when the DEPLOY_APPL_DOCKER Job finishes Successfully , DBDEPLOY Join Condition , APPSERVER Join Condition are satisfied:
Fig23
Fig24
SNOW_CONTBUILD_TICKET_CLOSE Job:
This is a RESTFUL Delete job which would take the TKTNO as input and do a RESTFUL Delete against the Request No/Ticket No in question:
Fig25
SNOW_UPDATE_TICKET_NEGCOND_CONTBUILD Job:
The Job SNOW_UPDATE_TICKET_NEGCOND_CONTBUILD runs when the APPLDEPLOYFAILED Join Condition is satisfied (one of the AppServer deployment Jobs : Apache Deploy Job or Nginx Deploy Job or MongoDB Deploy Job or Postgre SQL Job or Application Deploy Docker Job finishes in Abend) . This is a RESTFUL PUT Job which would post the comment: “Application Deployment Failed” in the comments section of the Request/Ticket :
Fig26
Fig27
A Snapshot of the complete Jobstream when executed attached below:
Fig28
Fig29
Conclusions from the UseCase:
- Application Deployment of an Application packaged as a jar file with an Application DB and Application Server can be completely Automated through HWA while also tracked over Service Now for record keeping purposes by using HWA leveraging REST APIs of ServiceNow and acting as a Meta Orchestrator for a Containerized Deployment of the Application End to End.
- The UseCase can be also in a similar way be extended for a VM Provisioning UseCase as well
Start a Conversation with Us
We’re here to help you find the right solutions and support you in achieving your business goals.