Installation Tomcat on AWS Environment & Performing continuous Download, Build, Deployment. Importance of Context Path

First update repository sudo apt-get update, After that install Tomcat 

Sudo apt-get install –y tomcat8 , after that we need to install one more package Sudo apt-get install –y tomcat8-admin 

Check the tomcat in browser with public ip address with port #8080 

Goto cd/etc/tomcat8/, we need to create one user in tomcat8 for that we need to modify the tomcat-user.xml file sudo vim tomcat-user.xml  

<user username=”training”password=”sunilsunil” roles=”manager-script,manager-status,manager-gui”/ > 

After that we need to restart the tomcat8 sudo service tomcat8 restart 

Similarly, we need to install tomcat8 in Production instance 

After that we edit file of tomcat8 

<user username=”learning”password=”sunilsunil” roles=”manager-script,manager-status,manager-gui”/ > 

Install TOMCAT In QA & Production Server 

1) Select QA Server and press connect 

2) Copy the SSH Command 

3) Open GIT Bash & paste the SSH Command 

Press Yes 

4) Update the apt repository  

sudo apt-get update 

5) Install tomcat8 

sudo apt-get install -y tomcat8 

After this we need to install one more package 

sudo apt-get install -y tomcat8-admin 

6) Check the tomcat is intall or not 

Copy the public IP of the QA Server then paste in the browser and in the end enter :8080  

qa_server_public_ip:8080 

Setting the path of tomcat in jenkins 

7) enter linux command in QA Server  –   cd /etc/tomcat8/ 

8) enter linux command in QA Server  –   ls 

9) You will find the file tomcat-users.xml 

10) Open the file — sudo vim tomcat-users.xml 

11) In the end we need to add one statement  

<user username=”training” password=”sunilsunil” roles=”manager-script,manager-status,manager-gui”/> 

save and quit  

press esc  

type :wq  

press enter 

12) When ever we do any changes done in any service we need to restart the service 

sudo service tomcat8 restart 

13) After this the same above 12 steps we need to do in the prod server also. 

++++++++++++++++++= 

Prod Instance 

<user username=”learning” password=”sunilsunil” roles=”manager-script,manager-status,manager-gui”/> 

+++++++++++++++++++++++++ 

First Start All the AWS Machines. 

Connect Dev Server 

Start the Jenkins  

java -jar jenkins.war  

Stage 1 : Continuous Download START CI-CD 

1) Create New item as free style project 

2) Click on source code managment  

3) Select GIT 

4) Enter the URL of github reposiditory 

https://github.com/sunildevops77/maven.git

5) Click on apply and save 

6) Run the Job 

7) Check the console output. 

8) Connect to the dev server 

9) Go to the location where code is downloaded 

sudo su – 

cd path of the folder 

ls 

Stage 2 : Continuous Build 

Convert the java files in to artifact ( .war file) 

10) Click on configure of the same job 

11) Go to Build Section 

12) Click on add build step 

13) Click on Invoke top level maven targets 

14) Enter the goal as  package 

15) click on apply and save 

16) Run the Job 

17) Click on number & click on console output 

18) Copy the path of the war file and check the file in the linux machine 

sudo su – 

cd path 

ls 

Stage 3 :Continuous Deployment  

Now we need to deploy the war file into the QA Server. 

19) For this we need to install “deploy to container” plugin. 

Go to Dasboard 

Click on manage jenkins 

Click on manage plugins 

Click on avaiable section 

Search for plugin ( deploy to container ) 

Select that plugin and click on install without restart. 

20) Click on post build actions of the development job 

21) Click on add post build actions 

22) Click on deploy war/ear to container 

23) Enter the path of the war file (or) 

we can give **/*.war in war/ear files. 

24) Context path: qaenv 

25) Containers : select tomcat 8 

Credentials : Click on add 

select jenkins 

enter tomcat user name and password 

Click on add 

Select credentials. 

give the private ip of the QA server. 

http://private_ip:8080 

http://172.31.32.183:8080 

26) Click on apply and save 

27) Run the job 

28) To access the home page 

public_ip_Qa_server:8080/qaenv 

Leave a Comment

MFH IT Solutions (Regd No -LIN : AP-03-46-003-03147775)

Consultation & project support organization.

Contact

MFH IT Solutions (Regd)
NAD Kotha Road, Opp Bashyam School, Butchurajupalem, Jaya Prakash Nagar Visakhapatnam, Andhra Pradesh – 530027