Web Development Environment (Automated)

Web Development Environment (Automated)

Objectives :

1 > To create a job in Jenkins to fetch the data from master branch of github repository on every update and deploy into docker container which has a support of httpd(apache) server.

2 > To create new branch as a developer branch in github which fetch the data on every updates and deploy into testing environment for testing .

2 > After the success of testing , the dev branch will merged into master branch and trigger to job1 for production deployment.

*Software needed : GIT , Jenkins and Docker .

*Base OS : Windows 10 --> git installed

*Virual BOX : Redhat 8 --> jenkins and docker installed .

Lets Start :

Tasks on GIT : to upload local repository to github and to create a new branch .

  1. To create a new repository on GitHub
  2. Open Git Bash. Change the current working directory to your local project.
  3. Initialize the local directory as a Git repository = "git init"
  4. Add the files in your new local repository. This stages them for the first commit = "git add ."
  5.  Commit the files that you’ve staged in your local repository = git commit -m "initial commit"
  6.  Copy the https url of your newly created repo
  7. In the Command prompt, add the URL for the remote repository where your local repository will be pushed = git remote add origin remote repository URL
  8.  Push the changes in your local repository to GitHub = "git push origin master "

Now the local repository has been added to the github .

  1. To create a new branch = "git checkout -b dev"
  2. To switch into dev branch from master = "git checkout dev"
  3. Now this branch also has to be pushed to github repository = "git push origin dev"

Now the github repository will also have the new branch dev .

NOTE :- origin is just a name of the repository .

Tasks on Jenkins :

Created a job with a name master_job, which fetch the data from github repository URL.

No alt text provided for this image

Build Trigger- Poll SCM which periodically check for the updates and it also trigger after merge_job

No alt text provided for this image

Execute shell- commands to run the docker container in httpd server.

No alt text provided for this image

Created second job with name dev_job which fetch the files from dev branch.

No alt text provided for this image

Build Trigger - Poll SCM which periodically checks for the updates

No alt text provided for this image

Execute Shell - commands to run the files on container in httpd server for testing.

No alt text provided for this image

Created third job with a name testing_job which job is to test the deployed pages are running successfully or not.

It will build after the dev_job.

No alt text provided for this image

Execute shell - commands for testing the deployed files.

No alt text provided for this image

Created fourth job with a name merge_job which job is to merge both the branches i.e. from dev to master . In this job we also have to provide credentials of github to jenkins to acces persmissions to merge the branches.

We are merging dev branch into master so we have to specify the branch dev.

No alt text provided for this image

Now we have to specify in which branch we are merging i.e. master and the name of the repository which i have given origin.

This job will run after the testing_job .

No alt text provided for this image

After the merge it will auto push the files to the github repository.

No alt text provided for this image

Now all the jobs are properly configured and ready to build .

I used build pipeline for better look and feel .

No alt text provided for this image

CONCLUSION - From dev branch, if any commits appear it will trigger the job dev_job and the chain of job begins , the dev_job will deploy the files into docker container for testing then testing_job will give status of the testing and trigger the merge_job and it get merged into master_branch and then it trigger to master_job which will deploy the files inton production environment by docker container.

Is this pol scm in Jenkins for scheduling git update or something else, didn't get it?

要查看或添加评论,请登录

Sanjay De的更多文章

  • AWS VPC Peering [Terraform]

    AWS VPC Peering [Terraform]

    What is VPC Peering ? A VPC peering connection is a networking connection between two VPCs that enables you to route…

    2 条评论
  • Dynamic CIDR & AZ [Terraform]

    Dynamic CIDR & AZ [Terraform]

    Classless Inter-Domain Routing (CIDR) - Classless Inter-Domain Routing (CIDR) blocks are for specifying a range to IP…

    4 条评论
  • Terraform state file on s3 backend

    Terraform state file on s3 backend

    Terraform state file - When you are building an infrastructure with terraform config, a state file gets generated…

    3 条评论
  • EC2 Dynamic Inventory [Ansible]

    EC2 Dynamic Inventory [Ansible]

    External or Dynamic Inventory - These inventories are the python scripts , to run these scripts a user have to provide…

  • VPC with NAT gateway

    VPC with NAT gateway

    NAT gateway- NAT Gateway is a highly available AWS managed service that makes it easy to connect to the Internet from…

    2 条评论
  • EC2-instance with EFS

    EC2-instance with EFS

    First lets discuss about EBS !!!! Amazon Elastic Block Store (EBS) Amazon Elastic Block Store (EBS) is an easy to use…

  • VPC with Internet Gateway

    VPC with Internet Gateway

    Amazon Virtual Private Cloud Amazon VPC lets you provision a logically isolated section of the AWS Cloud where you can…

    2 条评论
  • Amazon EKS

    Amazon EKS

    What is Amazon EKS ? Amazon EKS (Elastic Container Service for Kubernetes) is a managed Kubernetes service that allows…

  • Face_Mask_counter

    Face_Mask_counter

    About this Project - This project we created to achieve some helpful solution from this present pandemic situation , so…

    8 条评论
  • Configure Jenkins [Groovy]

    Configure Jenkins [Groovy]

    Jenkins DSL(Domain Specific Language)- Jenkins DSL job is a job which will create another job(s)/pipeline(s)/etc but…

社区洞察

其他会员也浏览了