0% found this document useful (0 votes)
16 views

Assessment - 3 and 4

well theis n sds asn da aso

Uploaded by

Abhishek Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Assessment - 3 and 4

well theis n sds asn da aso

Uploaded by

Abhishek Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Abhishek Pratap Singh Roll No.

- 03 Section - U

Assessment - 3

Create a CI/CD Pipeline using Jenkins,


Maven and Tomcat
1. Install Jenkins on AMI 2
2. Create a CI/CD pipeline using Jenkins and maven
3. Create a CI/CD pipeline using Tomcat and Jenkins
4. Install Maven on Amazon Linux 2
5. Navigate to "opt" directory and execute commands.

wget <https://archive.apache.org/dist/maven/maven-3/3.8.3/binaries/apache-
maven-3.8.3-bin.tar.gz>
tar -xvf apache-maven-3.8.3-bin.tar.gz
mv apache-maven-3.9.6 /opt/
find / -name maven

• Path of JDK:

<aside> 🏠 /usr/lib/jvm/java-17-openjdk

</aside>

• Plugins

<aside> ⚙ GitHub integration and Maven integration

</aside>

• Then head to tools


• Paste the relevant addresses.

Installation of Tomcat

• sudo amazon-linux-extras install java-openjdk11


• cd /opt

wget <https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.85/bin/apache-tomcat-
9.0.85.tar.gz>
tar -xzvf apache-tomcat-9.0.85.tar.gz
mv apache-tomcat-9.0.85 tomcat
sudo cd tomcat
sudo ./bin/startup.sh
cd /opt/tomcat
sudo cd conf
nano tomcat-users.xml

Paste this:
<role rolename="manager-gui"/>

<role rolename="manager-script"/>

<role rolename="manager-jmx"/>

<role rolename="manager-status"/>

<user username="admin" password="admin" roles="manager-gui, manager-script,


manager-jmx, manager-status"/>

<user username="deployer" password="deployer" roles="manager-script"/>

<user username="tomcat" password="s3cret" roles="manager-gui"/>

• Now login With username: admin and Password: admin


• Perform admin tasks in Tomcat's web console.

Establishing a data flow between Tomcat and Jenkins

➢ Begin by installing the plugin and deploying it to the container.

➢ Go to the Dashboard, then select Manage Jenkins, followed by Credentials and System.

➢ Locate and click on Global credentials.

➢ Add new credentials with the username "deployer" and password "deployer".

➢ Proceed to the Maven project.

➢ Initiate the build process.


Assessment - 4
Docker File for Tomcat Installation
Make a Dockerfile and create an image for deploying on Apache Tomcat
container.
# Use the official Ubuntu base image FROM ubuntu:latest

# Update package lists and install necessary packages RUN apt-


get update && \\

apt-get install -y default-jdk wget && \\

rm -rf /var/lib/apt/lists/*

# Download and install Apache Tomcat ENV TOMCAT_VERSION 9.0.56

RUN wget <https://archive.apache.org/dist/tomcat/tomcat-


9/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz>
-O

/tmp/tomcat.tar.gz && \\

tar -xzvf /tmp/tomcat.tar.gz -C /opt && \\

mv /opt/apache-tomcat-${TOMCAT_VERSION} /opt/tomcat && \\

rm /tmp/tomcat.tar.gz

# Expose the default Tomcat port EXPOSE 8080

# Start Tomcat

CMD ["/opt/tomcat/bin/catalina.sh", "run"]

The Dockerfile performs these actions:

➢ Utilizes the most recent Ubuntu image as a foundation.

➢ Installs the standard Java Development Kit (JDK) along with wget.

➢ Fetches and installs Apache Tomcat.

➢ Exposes the default port 8080 for Tomcat.

➢ Initiates Tomcat using the CMD command.

Store this Dockerfile in a directory alongside your Dockerfile and any other essential files.
To construct the Docker image, go to the directory containing the Dockerfile and execute
the subsequent command in your terminal:
docker build -t my-tomcat-image

Once the image is constructed, you can launch a container using the following command:

docker run -p 8080:8080 my-tomcat-image

This command will link port 8080 on your local machine to port 8080 within the Docker
container, enabling you to access the Tomcat server via your web browser at
http://localhost:8080.

You might also like