Deploy an Application in Tomcat web Server using CI_CD
Deploy an Application in Tomcat web Server using CI_CD
DEVELOPING
CI/CD
Agenda
2
DEPLOY AN APPLICATION IN
TOMCAT WEB SERVER USING CI/CD
PUSH
CODE
BUILD
WAR
DEPLOYMENT:
The term Deployments refers the installation of a Web-Application
on WebApplication server.
WHY DEPLOYMENT:
The main reasons of the deployment are:
Adding New Features to the Application.
Removing the Bugs.
Enhancing the New Features.
Improving the Performance.
Breaking Large Applications to MicroServices.
NEED FOR DEPLOYMENT:
We need to have Infra Setup.
New Release of code.
Involvement of Dev, QA and DevOps Team.
Creating New Db’s If needed.
Approval from RM (in case of New release).
PRECAUTIONS:
Need to take Backups of the Current Builds and DataBases.
Need To Provide Isolated Environments for Dev, Test and Prod.
Can be able to do RollBack if the Deployment fails in some cases.
Make sure we are deploying the correct env and Client Application Servers.
STEP-1:
LAUNCH 4 INSTANCES WITH SAME PEM FILE
1. JENKINS: T2.MICRO
2. TOMCAT: T2.MICRO
3. SONAR: T2.MEDIUM (20 GB OF EBS VOLUME)
4. NEXUS: T2.MEDIUM (20 GB OF EBS VOLUME)
STEP-2:
LOGIN INTO JENKINS DASHBOARD AND INSTALL THESE FOLLOWING PLUGINS
node {
stage ("build"){
def mavenHome = tool name: "maven", type: "maven"
def mavenCMD = "${mavenHome}/bin/mvn"
sh "${mavenCMD} clean package"
}
}
STAGE-3 : SCAN THE SOURCE CODE:
node {
stage ("upload") {
nexusArtifactUploader artifacts: [[artifactId: 'myweb', classifier: '', file: 'target/myweb-8.3.5.war', type:
'.war']], credentialsId: '4949746a-34ae-4d80-acaa-a73815fda645', groupId: 'in.javahome', nexusUrl:
'18.117.135.27:8081', nexusVersion: 'nexus3', protocol: 'http', repository: 'sanjay-releases', version: '8.3.5'
}
}
STAGE-5 : DEPLOY THE APPLICATION INTO TOMCAT WEB SERVER:
—————————————————————————————————————
node {
stage ("deploy") {
sshagent(['25e8d3a9-62fd-478b-8e4d-2ee40674436f']) {
sh "scp -o StrictHostKeyChecking=no /var/lib/jenkins/workspace/pipeline-1/target/myweb-8.3.5.war
[email protected]:/opt/apache-tomcat-9.0.73/webapps"
}
}
}