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

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             ...

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...

Roadmap to DevOps

    DevOps is nothing but the combination of process and philosophies which contains four basic component culture, collaboration, tools, and practices. In return, this gives a good automated system and infrastructure which helps an organisation to deliver a quality and reliable build. The beauty of this culture is it enables a quality for organizations to better serve their customers and compete more effectively in the market and also add some promised benefits which include confidence and trust, faster software releases, ability to solve critical issues quickly, and better manage unplanned work.   1. What are the tasks of a DevOps Engineer? Design, build, test and deploy scalable, distributed systems from development through production Manage the code repository(such as Git, SVN, BitBucket, etc.) including code merging and integrating, branching and maintenance and remote repository management Manage, configure and maintain infra...

Connect SparkThriftServer with Tableau/PowerBI

  Connect SparkThriftServer with Tableau/PowerBI REFERENCE : https://docs.microsoft.com/en-us/azure/hdinsight/hdinsight-apache-spark-use-bi-tools Use Power BI for Spark data visualization Note This section is applicable only for Spark 1.6 on HDInsight 3.4 and Spark 2.0 on HDInsight 3.5.   Once you have saved the data as a table, you can use Power BI to connect to the data and visualize it to create reports, dashboards, etc.   1.       Make sure you have access to Power BI. You can get a free preview subscription of Power BI from http://www.powerbi.com/ . 2.       Sign in to Power BI . 3.       From the bottom of the left pane, click Get Data . 4.       On the Get Data page, under Import or Connect to Data , for Databases , click Get . 5.       On the next screen, click Spark on Azure HDInsight and then click Connect . When prompted, enter th...

Git

Git Git  has steadily risen from being just a preferred skill to a must-have skill in last few years. in this blog we will go through top 20 git commands that every devops uses daily. If you don't have a gitlab account. please follow below link to create it free.   https://gitlab.com/ before using git please install git on your linux machine using below command. yum install git -y Use below command to create ssh keyol ssh-keygen -t rsa Below are the git command which we will cover in this blog. ·          git config ·          git init ·          git clone ·          git add ·          git commit ·          git diff ·          git reset ·      ...