Skip to main content

DevOps Architecture





Project: - Install an Apache Web-server, build with Maven, Test locally/Remote & deploy on your desired option (VM/Docker/Cloud)

 

Description of above DevOps plan.

1. Create Maven based source code in Gitlab.

2. Create a Jenkins job which will execute below stages.    

·       Checkout code from Gitlab     

·       Build/compile the source code using Maven as a build tool.    

·       scan the code virtually.     

·       Test the code by deploying an Apache Webserver & pointing the compiled 

code to it.     

·       After Successful testing, upload the compiled code/Artifact to
 Nexus Server (centralized Server).                                                               

·       Deploy to UAT/SIT/PROD using Ansible playbooks.    

·       Deployment will be done on Docker & further Kubernetes. 

3. Nagios will monitor the above infrastructure.

 

========================================

Please follow below steps to install Jenkins latest version on RHEL based VM

Prerequisites

To follow this tutorial, you will need the following:

CentOS 7 Droplet

A non-root user with sudo privileges (How To Edit the Sudoers File on Ubuntu and CentOS explains how to set this up).

All the commands in this tutorial should be run as a non-root user. If root access is required for the command, it will be preceded by sudo.

System-Specific Packages vs the WAR File

Now that you know what Jenkins is, you need to understand how it is distributed. Jenkins runs on Java and comes as a WAR file — a collection of related content comprising a web application and intended to be run on a server. However, the developers of Jenkins kindly extend its ease of use through a number of system-specific packages that allow Jenkins to run as a controlled service.

A Jenkins package is available for the Red Hat family of distributions, which includes the CentOS operating systems. However, CentOS 7 in particular is a finicky breed, so it requires a different approach. Operations that work in other Red Hat-based OSes, even other CentOS versions, tend to work differently in CentOS 7, and the potential errors that result can be difficult to debug. Since the Jenkins package is generic Red Hat, rather than being differentiated for CentOS, the likelihood of running into issues is higher than on other OSs. For this reason, we won’t run Jenkins via this package. That leaves us the WAR file running through Java, which is far less convenient, requiring us to manually start and stop it through Java.

Fortunately, there’s a way around this, and even without a package, we can work with CentOS to have it treat Jenkins like a service.

Step 1 — Installing Jenkins

There are two basic ways to install Jenkins on CentOS: through a repository, or repo, and via the WAR file. Installing from a repo is the preferred method, and it's what we'll outline first.

You'll need Java to run Jenkins (either method), so if your server doesn't yet have Java, install it with:


·       Become Root on the Linux VM

·       yum -y install java


In general, if you need a service or tool but you're not sure what package provides it, you can always check by running:

 

·       yum whatprovides service

 

Where service is the name of the service or tool you require.

 Installing from the Repo

 Now, run the following to download Jenkins from the Red Hat repo:

 ·       wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo

The wget tool downloads files into the filename specified after the "O" flag (that's a capital 'O', not a zero).

 Then, import the verification key using the package manager RPM:

       ·       rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

·       yum upgrade -y

·       yum install epel-release java-11-openjdk-devel -y

                             OR

·       amazon-linux-extras install epel -y

 Finally, install Jenkins by running:

     ·       yum install jenkins -y

 

That's it! You should now be able to start Jenkins as a service:

     ·       systemctl start jenkins.service

 

Once the service has started, you can check its status:

     ·       systemctl status jenkins.service

 

This will give you a fairly lengthy readout with a lot of information on how the process started up and what it's doing, but if everything went well, you should see two lines similar to the following:

Loaded: loaded (/etc/systemd/system/jenkins.service; disabled)

Active: active (running) since Tue 2015-12-29 00:00:16 EST; 17s ago

This means that the Jenkins services completed its startup and is running. You can confirm this by visiting the web interface as before, at http://ip-of-your-machine:8080.

 Please follow below link to add Jenkins Slave

 http://yallalabs.com/devops/how-to-add-linux-slave-node-agent-node-jenkins/

 Please follow below steps to install OpenJDK  & Maven on both Master & Slaves

 OpenJDK

 # cd /opt

# wget https://download.java.net/java/GA/jdk13/5b8a42f3905b406298b72d750b6919f6/33/GPL/openjdk-13_linux-x64_bin.tar.gz

# tar -xvf openjdk-13_linux-x64_bin.tar.gz
# /opt/jdk-13/bin/java -version

# vi /root/.bashrc
export JAVA_HOME=/opt/jdk-13/
export PATH=$PATH:/opt/jdk-13/bin

# source /root/.bashrc
# echo $JAVA_HOME
# java -version

Maven

# cd /usr/local/src
# wget https://mirrors.estointernet.in/apache/maven/maven-3/3.8.1/binaries/apache-maven-3.8.1-bin.tar.gz
# tar -xf apache-maven-3.8.1-bin.tar.gz
# mv apache-maven-3.8.1/ apache-maven/
# vi /root/.bashrc
export MAVEN_HOME=/usr/local/src/apache-maven
export PATH=${MAVEN_HOME}/bin:${PATH}
# source /root/.bashrc 
# mvn --version

Go to Manage Jenkins -----> Go to Global Tool Configuration

 1. Set JAVA_Home Path

2. Set Maven_Home Path





Ref Links:-

https://www.tecmint.com/install-java-on-centos-rhel-fedora/

https://www.tecmint.com/install-apache-maven-on-centos-7/ 

 Create a new free style job in Jenkins & add stages as mentioned in the devops architecture. 

 1. Checkout


2. Build


3. Execute Shell script for other stages.






Thank you !! Example HTML page Pleaes provide your valuable feedback.

Comments

Popular posts from this blog

Jenkins

Pre-requisites 1. Install a Webserver https://gitlab.com/Azam-devops/webserver/-/blob/main/README.md Code for index.html https://gitlab.com/Azam-devops/webserver 2. Maven Code https://gitlab.com/Azam-devops/imperial-maven-project 1. Install & configure Jenkins Automation Server on Linux Vm. 2. Go through at some of the important options in Jenkins. 3. Manage Jenkins. 4. Plugins 5. Global Tools Configuration. 6. Credentials 7. Users 8. Slave Nodes 9. Configuring CI pipeline using Gitlab. 10. Configuring standalone CICD pipeline using. 11. Automating the CICD pipeline. 12. Jenkins log 13. Introduction to Jenkins file. 14. Basic groovy syntax & file formation. 15. Launching a Pipeline using Jenkins file. 3. DevOps Architecture Description of above DevOps plan. Create Maven based source code in Gitlab. Create a Jenkins job which will execute below stages. Checkout code from Gitlab Build/compile the source code using Maven as a build tool. scan the code virtually. Test...

Docker In Details

  Course Contents:- 1. Overview of Docker 2. Difference between Virtualization & Containerization 3. Installation & Configuration of Docker Runtime on Linux & Windows 4. Practice on Docker commands 5. launch a Webserver in a container 6. Launch public & official images of application like Jenkins, Nginx, DB etc.. 7. Launch a base OS Container 8. How to save changes inside the container & create a fresh image(commit) 9. How to ship image & container from one hardware to another. 10. How to remove stop/rm multiple container/images 11. Docker Registry 12. Docker Networking       Check current docker network                  Docker Network Bridge                     Docker Network Weaving                  Launch our own Docker Cluster with our defined Network             ...

Ansible

  Ansible is an open-source software provisioning, configuration management, and application-deployment tool. It runs on many Unix-like systems, and can configure both Unix-like systems as well as Microsoft Windows. It includes its own declarative language to describe system configuration. Ansible was written by Michael DeHaan and acquired by Red Hat in 2015. Ansible is agentless, temporarily connecting remotely via SSH or Windows Remote Management (allowing remote PowerShell execution) to do its tasks. Platform support Control machines have to be a Linux/Unix host (for example SUSE Linux Enterprise, Red Hat Enterprise Linux, Debian, CentOS, macOS, BSD, Ubuntu, and Python 2.7 or 3.5 is required. Managed nodes, if they are Unix-like, must have Python 2.4 or later. For managed nodes with Python 2.5 or earlier, the python-simplejson package is also required. Since version 1.7, Ansible can also manage Windows nodes. In this case, native PowerShell remoting supported by the WS-Managemen...

Basic Linux Commands

  Linux Command Cheat Sheet Hello All, Below are the most common commands used in a day to day life of  linux user. if you are new to linux i will recommend you to go through all of the commands.  this commands will help you to troubleshoot linux issues.   Command Description ls Lists all files and directories from present working directory ls-R Lists files in sub-directories ls-a to list down hidden files. ls-al Lists files and directories with complete details like permissions, size, owner cd or cd ~ To go back to home directory cd .. Move one level up cd To change to a particular directory cd / Move to the root directory cat > filename Creates a new file cat filename Displays the content of a file cat file...

Kubernetes-Update

                                                    https://kubernetes.io/ Kubernetes (K8s)  is an open-source system for automating deployment, scaling, and management of containerized applications. It groups containers that make up an application into logical units for easy management and discovery. Kubernetes builds upon  15 years of experience of running production workloads at Google , combined with best-of-breed ideas and practices from the community. Latest Verion:-  1.19 Kubernetes Objects Kubernetes defines a set of building blocks ("primitives"), which collectively provide mechanisms that deploy, maintain, and scale applications based on CPU, memory or custom metrics. Kubernetes is loosely coupled and extensible to meet different workloads. This extensibility is provided in large part by the Kubernetes API, which is used by int...