NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

TO GENERATE WAR FILE
SCM --------> git URL, Username: Password:
In Build --------> Execute shell
mvn clean
mvn compile
mvn exec:java
mvn war:war
Build it

TO DEPLOY WAR FILE IN TOMCAT

Create a job
SCM --------> git URL, Username: Password:
In Build ---------> Invoke top level maven targets
Goals: clean compile war:war
then build it

Manage Jenkins ---------> Manage Plugin -----> Install the deploy to container plugin
Deploy to container

Open terminal
sudo su
cd /opt/tomcat/conf
vi tomcat-users.xml -------------> Insert mode
Username: Anusha
Pass: Anusha
roles: manager-gui, manager-script

Then Stop and Start tomcat
sudo systemctl stop tomcat.service
sudo systemctl start tomcat.service

Configure job
In Post build actions -----------> Deploy war/ear to container
Fill the required
add container ------------> tomcat 9
Username:
Password
URL: http://localhost:8090/
Then build it again and check if war file deployed successfully or not

To Check it , open the url above and got to manage apps --------> list applications ----> at the bottom u can find the war file.

TO DEPLOY WAR FILE IN TOMCAT AS DOCKER CONTAINER

Open Terminal
sudo useradd -m Anusha
sudo passwd Anusha
-----------> give password as Anusha

Add user to docker grp
sudo useername -aG docker Anusha

Create a freestyle job for generating war file
SCM --------> git URL, Username: Password:

In build ---------> Execute shell

mvn clean
mvn compile
mvn exec:java
mvn war:war

Then build it

Manage Jenkins----> Manage Plugins -------> Install publish over SSh plugin
Publish over SSH

Manage Jenkins --------> Configure system ------> SSH servers add
After adding
Name: Dockerhost
Hostname: 172.31.22.6 ..........(IP address)
Username: Anusha
Advanced --------> check box tick ---> Use password as authentication and then
give password then test configuration -----> Success

Configure the same job-----> In Post build Actions
Send build artifacts over SSH
Name: Dockerhost
Source files: target/*.war
Remove: target/
Remote directory: opt/
Then build it

Open Terminal
cd /home/Anusha/opt
sudo vi Dockerfile ------------>
FROM tomcat:latest
RUN cp -R /usr/local/tomcat/webapps.dist/* /usr/local/tomcat/webapps
COPY ./*war /usr/local/tomcat/webapps
esc :wq!
then give docker build -t myimage .

Configure job ---------> In Post build actions
Exec command
cd /home/Anusha/opt
docker stop tomcat
docker rm tomcat
docker rmi myimage
docker build -t myimage .
docker run -p 8093:8080 -d --name tomcat myimage
or -p 5000:8080

then build it

checking : localhost:8093/warfile ----------> war file we get form /home/Anusha/opt ls --- here

DEPLOY WAR FILE IN TOMCAT USING ANSIBLE PLAYBOOK

Create a freestyle job for generating war file
SCM --------> git URL, Username: Password:

In build ---------> Execute shell

mvn clean
mvn compile
mvn exec:java
mvn war:war

Then build it

Open Terminal
sudo su
cd /home/Anusha/opt
sudo vi sample.yml ------------>
---
- name: sample
hosts: localhost
become: yes
tasks:
- name: task1
copy:
src: /home/labuser/opt/maven-war-0.0.1-SNAPSHOT.war
dest: /opt/tomcat/webapps
esc and give :wq!
then give ansible-playbook -i myhosts sample.yml

Configure job ---------> In Post build actions
Exec command
ansible-playbook -i myhosts sample.yml
then build it

checking : localhost:8093/warfile ----------> war file we get form /home/Anusha/opt ls --- here

TO INTEGRATE JENKINS WITH SONARQUBE

Manage Jenkins -----> Manage plugin -----> Install Sonarqube scanner plugin
Sonar scanner plugin

Manage Jenkins -------> Configure system
Sonar server name: Sonar
Server URL : or else give local server as -----------------------------------------------------
Server token authentication:

Manage Jenkins --> manage plugin -> Install Maven Integration plugin
Maven Integration

Create a new pipeline job
In pipeline ----> select pipeline from SCM and select git
give git Url
username:
password:
script path : Jenkins file
Then build it
---------> works if our git repo have jenkins file with the required script to build the pipeline

( or ) Instead of selecting pipeline from SCM give pipeline and write the pipeline script

Create a new freestyle job

SCM --------> git URL, Username: Password:
In Build Environment: ----> Prepare sonar qube scanner environment
In Build ----->
Invoke top level maven targets:
goals: clean Install sonar:sonar

Then build it

TO USE BLUE OCEAN INTERFACE: (JENKINS 2.0)

Manage Jenkins---> Manage plugins ----> Install Blue Ocean Plugin
Blue Ocean

then we can find blue ocean option at right side of the page
















     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.