DEPLOY A WEB-APP USING JENKINS IN TOMCAT SERVER
CODE
INTEGRATE
BUILD
WAR
WAR
STEP-1: LAUNCH AN EC2 INSTANCE WITH 8080 PORT AND KEYPAIR
STEP-2: SETUP JENKINS
STEP-3: INSTALL GIT IN SERVER
STEP-4: CREATE A FREE STYLE JOB AND INTEGRATED GIT TO JENKINS
STEP-5: INSTALL JAVA1.8.0 & MAVEN
STEP-6: CONFIGURE THE JOB AND GO TO BUILD STEP AND SELECT
INVOKE TOP-LEVEL MAVEN TARGETS (clean package) THEN BUILD NOW
STEP-7: TOMCAT SETUP
download tomcat file from dlcdn: wget
https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.96/bin/apache-tomcat-
9.0.96.tar.gz
untar the file: tar -zxvf apache-tomcat-9.0.96.tar.gz
go to the folder: cd apache-tomcat-9.0.96/webapps/manager/META-INF
open the context.xml in vim editor and make some change (delete 2 lines (21
and 22 lines))
go to three steps back: cd ../../../
and go to conf folder and open tomcat-users.xml file in vim editor
go to one step back: cd ..
go to bin folder and execute startup.sh file
./startup.sh
note: tomcat will not run in 8080 port now. because jenkins is already running in 8080
port
CHANGE TOMCAT PORT NUMBER:
to stop the tomcat: ./shutdown.sh
go to conf folder and open server.xml file in vim editor
change the port number in 69 line from 8080 to 8081
and save & exit from the file
go to one step back cd ..
go to bin folder again and execute startup.sh file
PUBLICIP:8081 (CONNECT IN THE BROWSER)
STEP-8:
go to jenkins dashboard
install plugin (manage jenkins --> manage plugin --> available plugin -->
deploy to container
after installing the plugin go to our job and select post build actions --> add
post build actions
STEP-9:
select deploy war/ear to container
click on add container(9th version). and add credentials (username &
password of tomcat)
STEP-10:
save and build the job and go to tomcat
you will see swiggy folder. click on the folder you can access the client application