#Task-2 Mlops+DevOps: CI/CD

#Task-2 Mlops+DevOps: CI/CD

What is Machine Learning?

  • It is the study of various activities going around and making our machines smarter and to this much extent that they can try to think like human beings and therefore we are trying to build an application or method which can train machines how to learn.
  • We are do this not just for fun but, there's a great reason i.e. make use of their high speed and efficiency when it comes to numbers and memory based problem ,a normal human can have error but machines will hardly give any error in this field of science and technology.

What is DevOps?

  • DevOps is the set of practices ,which if one follows, he/she will be able to achieve automation.

Why this task ?

  • Because in today's agile and fast growing world if we need to keep up with others going on with faster approach, we need automation as much as possible.

What the project is About ?

The motto of this project is like ,when a developer sends a code to a repository, jenkins automatically start a CI/CD pipeline inorder to deploy the code completely to the webserver of operation's them and under which code will be checked by making use of status. Or maybe operator guys can also redirect this code to their QA team and deploy into testing environment if they want.

Project Description:

1. Create container image that’s has Jenkins installed using dockerfile 

2. When we launch this image, it should automatically starts Jenkins service in the container.

3. Create a job chain of job1, job2, job3 and job4 using build pipeline pliugin in Jenkins 

4. Job1 : Pull the Github repo automatically when some developers push repo to Github.

5. Job2 : By looking at the code or program file, Jenkins should automatically start the respective language interpreter installed image container to deploy code ( eg. If code is of PHP, then Jenkins should start the container that has PHP already installed ).

6. Job3 : Test your app if it is working or not.

7. Job4 : if app is not working , then send email to developer with error messages.

8. Create One extra job job5 for monitor : If container where app is running. fails due to any reson then this job should automatically start the container again.

PreRequisites:

  • Basic knowledge of Redhat or any other Linux OS
  • Basics of Docker
  • Good knowledge in Jenkins
  • Some Networking Concepts
  • A little bit knowledge on web servers , their creation and Deployment

So lets get started.........

First of all lets create a Dockerfile for Running all of our codes in jenkins into a docker environment because it's always great to manage every different environment by making use of jenkins

For this I'll be doing all my stuffs inside a directory /root/devops_task2

Here is the screenshot of Dockerfile for jenkins

No alt text provided for this image

After that just Run the following command to create the image for jenkins

docker build -t ssjnmjenkins:v1 /root/devops_task2
No alt text provided for this image

Now to start the docker container for jenkins using the command in the screenshot

No alt text provided for this image

Now that I have started my jenkins and I have to used DNAT protocol on port no. 8081 from 8080 so, when I'll be using my microsoft edge to connect to jenkins server and they will also ask for admin password which , we can get through command line or directly inside the image

No alt text provided for this image
No alt text provided for this image

This is very interesting now , that our jenkins is running inside a docker image :)

So, Lets download some plugins that we will be needing for the intrication Project

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

After all this is Over ,what I want is a slave node for jenkins that will help me to connect to the rhel 8 system on which my docker is running.

This the most critical step since every task is performed in this node "redhat_node" only because they are the one running with docker server which we will need in future to launch another dokcer on site .

So Got to Manage Node and Clouds

No alt text provided for this image

Here create an agent node for redhat_node

No alt text provided for this image

And then Configure this node according to the IP address and pass word for your main OS rhel 8 system

No alt text provided for this image

Give the credentials for SSH and One thing to be noted Here we will be using SSH to launch agents Do we must have a plugin named build SSH agent plugin

No alt text provided for this image

Finally we here are starting with our devops_task_job1

No alt text provided for this image

and here's the code for job1

  • If we will look closely here , then I have searched for presence of html or php codes in our working directory and
  • Secondly, I have used if and else statements inorder to check whether repository contains php , html or both codes.
No alt text provided for this image
No alt text provided for this image

Now the Important thing to notice here is that we will restrict the usage of nodes and asked all of tasks to be performed by redhat node

No alt text provided for this image

Then here is the code for checking the status of php/html site bu making use of apache monitoring data and saving it into variables named status_html and status_php

No alt text provided for this image
No alt text provided for this image

The Last thing that we need now is a smtp server to send emails to different sites where we will using a smpt server for gmail and using gmail's two-way security scheme, we can generated a code for any app the we want to be inked with gmail

But inorder to run these , we will need a plugin so lets install it

No alt text provided for this image

Then here is the configuration for my smtp server

No alt text provided for this image

Finally the code for job2 is like this and under the recipients we will add an email Id to get notified, here I will add my emailID to get to work

No alt text provided for this image

The project is ready now and let me add both of my jobs into build pipeline to try the code

No alt text provided for this image
No alt text provided for this image

We can also check the sites whether they are working or not

No alt text provided for this image
No alt text provided for this image

This means my code is fine and everything's working great as planned :)

And here is the previous output of emails when I was testing

No alt text provided for this image

And here is the latest email that describes task is stable now

And That's how CI/CD works ...........

To view or add a comment, sign in

More articles by Nishant Singh

  • Configuring Hive with HDFS & MapReduce Cluster backend

    Configuring Hive with HDFS & MapReduce Cluster backend

    Hello to the reader , hope you are all doing great. Now that you are here, Lets just start it already 🙂.

  • Why handlers are used in Ansible?

    Why handlers are used in Ansible?

    Handlers are the tasks which gets triggered when some changes are made to a particular task. This solves a very…

  • Setting up AWS CDN with AWS CLI

    Setting up AWS CDN with AWS CLI

    Content Delivery Networks is one of the best utilization of a company's own private network across the globe. A company…

  • Play with IPs , IPv4 in particular

    Play with IPs , IPv4 in particular

    This article is an interesting one at least for me, Although it takes time to understand networking concepts since I…

  • A Session with two experts

    A Session with two experts

    The session was started by Mr. Arun Eapen with the explanation of what automation is and specially why we need it,So…

  • Configuring HAProxy-LB with Ansible

    Configuring HAProxy-LB with Ansible

    As I always say its always better to have a look onto the basic technical terms to get started, and so lets see what we…

  • Configuring Hadoop(NN/DN) via Ansible

    Configuring Hadoop(NN/DN) via Ansible

    Before getting hands on into any practical implementation its always good to know the terminologies..

  • Getting started with AWS CLI....

    Getting started with AWS CLI....

    This is an small article on explanation of getting started with Command line interface with some easy and helpful…

  • Ubisoft got enhanced with AWS

    Ubisoft got enhanced with AWS

    Normally Every Gaming company demands some big infrastructure with good quality CPU, RAM for the game development and…

  • Hybrid Cloud Setup: K8s and RDS

    Hybrid Cloud Setup: K8s and RDS

    A great setup to learn the intrication of the two different cloud platforms working together with the help of terraform…

Insights from the community

Others also viewed

Explore topics