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

Script To Monitor disk Usage

Hello All, Many times we have a requirement to automate few of the tasks, and one of the important task is to delete old log files from log destination. We usually get the conditions where we have to delete the log from particular directory when it reaches to some thresh hold value. Now a day the requirement of automation is highly increased where we are seeing most of the day to day tasks are getting automated using different scripting languages. Its always a good idea to automate your daily tasks which will save your working hours and will increase your productivity. Most of the time log destination gets full and due to which we face other issues like application down or particular service stop working. And manual deleting of log is hectic process so below script will help you to delete your log data when it meets your condition, and also it will trigger mail to recipient after deletion of logs. You can schedule this script in your crontab according to your feasible ti...

Azure Active Directory

  What is Azure Active Directory? Azure Active Directory is Microsoft’s multi-tenant, cloud-based directory and identity management service. For an organization, Azure AD helps employees sign up to multiple services and access them anywhere over the cloud with a single set of login credentials. Azure Active Directory Concept: It is important to understand these Azure AD concepts. Identity . An object that can get authenticated. An identity can be a user with a username and password. Account . An identity that has data associated with it. You can't have an account without an identity. Azure subscription . Used to pay for Azure cloud services. You can have many subscriptions and they're linked to a credit card. Azure tenant/directory . A dedicated and trusted instance of Azure AD, a Tenant is automatically created when your organization signs up for a Microsoft cloud service subscription. More instances of Azure AD can be created. Azure AD is the underlying product ...

Azure Storage

Azure Storage is Microsoft's cloud storage solution for modern data storage scenarios.    Why Azure Storage: Durable and Highly Available: ·        Data is safe during hardware failure. ·        Replicate data across data centres. ·        In local catastrophe or natural disaster data replicated to other data centres remains highly available. Secure: ·        Data encrypted by Azure service Storage Service encryption (SSE) for data at rest. ·        Completed control over who access your data. Scalable: ·        Designed to massive scale. Managed: ·        Azure handles maintenance, updates and critical issues. Accessible: ·        Accessible from anywhere in the world. ·        You can access using http, https,...

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

Continuous Integration with Jenkins and GitLab

  Enter the credential manager Go into system credentials Add a new credential (private key of slave node where you want to run the job) We need a SSH private key credential. I’m not sure the username matters, but I set it to “git” as that is what the login for gitlab uses. I then pointed it to my *private* key on the machine and gave it a description. Now the key shows up in the system. Once I had setup the ssh private key, which allows Jenkins to connect to the git host over ssh (i.e. git clone git@server:user/repo.git), I needed to setup API Access for Jenkins to get metadata from GitLab. In GitLab go to your user profile. Select “Access Tokens”. Now make a new token, I gave it a descriptive name and made it expire at the end of the decade (I haven’t investigated the pros/cons of expiration date length yet). You are then presented with a screen showing the token. Copy it now, as it won’t be accessible again! You can always create a new one if you mess it up t...