GithubHelp home page GithubHelp logo

visaltyagi / devops-project1 Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 215 KB

DevOps Capstone Project 1 -Implementing a DevOps Lifecycle on a website using Docker & Jenkins Only

Home Page: https://medium.com/devops-guides/devops-capstone-project-implementing-a-devops-lifecycle-on-a-website-using-docker-jenkins-only-ab4d6ee908f2

Shell 69.88% HTML 18.39% Dockerfile 11.73%
aws devops docker implementation jenkins lifecycle website ansible bash-script dockerfile terraform

devops-project1's Introduction

Project – Capstone I

You have been hired as a Sr. DevOps Engineer in Abode Software. They want to implement DevOps Lifecycle in their company. You have been asked to implement this lifecycle as fast as possible. Abode Software is a product-based company and their product is available on this GitHub link. https://github.com/hshar/website.git

Following are the specifications of the lifecycle:

  1. Install the necessary software on the machines using a configuration management tool
  2. Git workflow has to be implemented
  3. Code Build should automatically be triggered once a commit is made to master branch or develop branch. a. If a commit is made to master branch, test and push to prod b. If a commit is made to develop branch, just test the product, do not push to prod
  4. The code should be containerized with the help of a Dockerfile. The Dockerfile should be built every time there is a push to GitHub. Use the following pre-built container for your application: hshar/webapp The code should reside in '/var/www/html'
  5. The above tasks should be defined in a Jenkins Pipeline with the following jobs: a. Job1: build b. Job2: test c. Job3: prod

For the detailed solution to this assignment, click this link: https://medium.com/devops-guides/devops-capstone-project-implementing-a-devops-lifecycle-on-a-website-using-docker-jenkins-only-ab4d6ee908f2

Project 1 Solution:

Problem (1) Solution: Install the necessary software on the machines using a configuration management tool

In this project, we need to install the “Java”, “Jenkins”, “Ansible”, “Docker” & “Python” on “Master” machine while install the “Java” & “Docker” on both the slaves.

We don’t need to create a third job as “build” here. Only “test” & “prod” will do the jobs.

A. Create Three Instances as Master, Slave1 & Slave2.

B. Install “Ansible” Over Master Machine using “install.sh” file

C. Run the “install.sh” file using the command: bash install.sh

D. Create the keys to “Master” instance & Paste to “Slave1” & “Slave2”

E. Put the “Slave IP’s” into the “Ansible Host File”

F. Run this ansible command to ping the machines: ansible -m ping all. Type “Yes” & your “slaves” will be successfully pinged.

G. Create an yaml File to run “master.sh” & “slave.sh” File to Install Much Needed Tools on Instances

H. Run this command to create an “ans.yaml” file to execute the “master.sh” & “slave.sh” through “Ansible”. Command: sudo nano ans.yaml

I. Create “master.sh” & “slave.sh” File to Install Much Needed Tools on Instances

J. Type this command to execute the “master.sh” & “slave.sh” using “ans.yaml” file. ansible-playbook ans.yaml

All the mentioned tools in “master” & “slaves” has been successfully installed, if status is “Ok”.

K. Verified All Tools Have Been Successfully Installed on Master & Slaves or Not

L. Setup Jenkins Dashboard Over “Master” Server

M. Add “Slave1” in “Jenkins”

N. Add “Slave2” in “Jenkins”

O. Fork the Given Repository

P. Clone the Given Repository Over “Master” Node

Q. Create a Webhook for Trigger the Jobs

R. Create a Dockerfile & Push it into “Master” Branch

S. Create a “Test” Job

T. Create a “Prod” Job

Put these commands to build a container on port 80:

sudo docker build . -t finalrelease

sudo docker run -itd -p 80:80 finalrelease

U. Do change in "index.html" file & create a job again automatically.

V. Do changes in docker file also in "Jenkins" also.

sudo docker rm -f $(sudo docker ps -a -q)

sudo docker build . -t finalrelease

sudo docker run -itd -p 80:80 finalrelease

W. Your container will be successfully created everytime & website will be successfully deploed.

X. Copy the Slave IP & Paste it into browser address bar & a webpage will be successfully shown.

devops-project1's People

Contributors

visaltyagi avatar

Stargazers

 avatar Preethi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.