DEV Community

BlacOrpheus
BlacOrpheus

Posted on

Streamlined CI/CD Pipeline Management with Jenkins: Utilizing Termius and AWS for Flawless Integration

Image description

Synopsis

In this project, we delve into the realm of Continuous Integration/Continuous Deployment (CI/CD) pipeline management, focusing on optimizing efficiency and integration through Jenkins, Termius, and AWS services. This comprehensive exploration showcases the power of automation in software development workflows.

We begin by configuring Jenkins, a leading automation server, to orchestrate seamless build, test, and deployment processes. Leveraging its extensive plugin ecosystem, we customize pipelines to meet specific project requirements, ensuring rapid, reliable, and consistent delivery of applications.

To enhance security and accessibility, we introduce Termius as a robust SSH client, establishing secure connections for remote server management. Through Termius, we demonstrate effective command-line interactions, enabling efficient deployment and monitoring tasks.

By the conclusion of this endeavor, participants will have gained a deep understanding of Jenkins, Termius, and AWS integration, empowering them to implement robust CI/CD pipelines that accelerate software delivery while maintaining a high level of security and reliability.

Backstory

Jenkins stands as a cornerstone in modern software development, serving as an indispensable CI/CD (Continuous Integration/Continuous Deployment) tool. Its significance lies in its ability to streamline and automate critical aspects of the development pipeline. Its contribution in enhancing efficiency, quality, and collaboration cannot be overstated. As a foundational tool, Jenkins empowers organizations to deliver high-quality software with speed and confidence, thereby driving innovation and success in the digital landscape.

Requirements

  • An AWS Account
  • Termius (SSH platform for Mobile and Desktop)
  • Basic Understanding of Linux
  • A GitHub Account
  • A Jenkins Account

Termius

Termius is a cross-platform SSH client that allows users to securely connect to remote servers, manage files, and execute commands over SSH (Secure Shell) protocol. It’s available for both mobile devices and desktop computers, providing a convenient way to access and manage remote servers from various platforms.

GitHub

GitHub is a web-based platform designed for version control and collaborative software development. It allows individuals and teams to manage and track changes in code, enabling seamless collaboration on projects. GitHub provides tools for creating repositories (storage spaces for code), branching (creating separate lines of development), and merging (combining code changes). It also offers features like issue tracking, pull requests, and code reviews to facilitate efficient teamwork.

Jenkins

Jenkins is an open-source automation server used for Continuous Integration and Continuous Deployment (CI/CD). It automates various stages of software development, including building, testing, and deploying code changes. Jenkins streamlines collaboration among development teams and enhances the efficiency of software delivery. With a vast library of plugins, Jenkins can be customized to integrate with a wide range of tools and technologies.

Procedure

Anyone can effortlessly reproduce this procedure on their personal computer by carefully following the provided instructions below.

  • Create an AWS instance and connect it to Termius
    In my previous article, I give a detailed approach on how to go about this.

  • Install Jenkins on you ec2 instance.
    Add the key to your system:

sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key

  • Add a Jenkins apt repository entry:

echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null

  • Update your local package index, then finally install Jenkins:

sudo apt-get update
sudo apt-get install fontconfig openjdk-11-jre
sudo apt-get install jenkins

  • To Check the status of the installation:

sudo systemctl status jenkins

Image description

  • Connect to Jenkins

copy your AWS IP address and add a port 8080 to it, which is the default port Jenkins listens on.

18.215.151.231:8080

On your Termius terminal, type in the following to get your Jenkins Password and Login to Jenkins:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Image description

  • Create a new job in Jenkins

Choose a name for your project, I titled mine “my-first-jenkins-job”, select “Freestyle project” and click on “OK”.

Image description

Image description

  • Edit your Jenkins job

Image description

  • Source Code Management

Input the repository Link and choose “*/master” as the Branch Specifier.

Image description

Image description

  • Build Triggers

Select “GitHub hook trigger for GITScm polling”

Image description

Build Steps

Select “Execute Shell” and type in the following:

cp -r index.js /var/www/sageapp
cp -r index.html /var/www/sageapp

Image description

Image description

When the build is initiated, the “index.js” and “index.html” files are copied into “/var/www/sageapp” folder.

Click on “Save” and “Apply”.

  • Add GitHub webhook

Go to your repository on GitHub and click on “Settings”, then click on “Webhooks” , click on “Add webhook” then enter your jenkins IP address followed by “//github-webhook/”, finally click on “Update webhook” and enter you GitHub Password.

Image description

  • Start with the process of continous integration and continous deployment

`--c-brand: #996515;
.text-uppercase{
color: #9F2B68;

}

.shade-of-pink{

color:#F2D2BD
Enter fullscreen mode Exit fullscreen mode

}`

Go back to your Termius Terminal and run the following set of commands

` cd /var/lib/jenkins/workspace

cd my-first-jenkins-job

node index.js `

Image description

Go back to the style.css file and edit the file again by changing the following:

` --c-brand: #161748;

.text-uppercase{
color: #c89666;

}

.shade-of-pink{

color:#161748;
Enter fullscreen mode Exit fullscreen mode

} `

refresh your browser:

Image description

Conclusion

To put it simply, mastering Efficient CI/CD Pipeline Management with Jenkins, and leveraging the power of Termius and AWS, represents a significant stride forward in modern software development. The seamless integration of these tools not only accelerates the development lifecycle but also ensures security, scalability, and reliability in the deployment process.

Chidubem Chinwuba is a dedicated Cloud/DevOps Engineer. He possesses a deep passion for technology and its transformative potential across industries. Overall, Chidubem is driven by his passion for technology and his aspiration to make a meaningful impact in the Cloud/DevOps domain. He is excited to continue his professional growth and contribute to projects that shape the future of technology.

Top comments (0)