Devops/Jenkins Project Under LinuxWorld

Devops/Jenkins Project Under LinuxWorld


Objective - To auto-deploy changes made in website by developers using Jenkins.

Developer Side

  1. Create your html file and store it in any folder.
  2. Initialize this folder as git repo ( #git init)
  3. Configure your github ( git config credential.helper store)
  4. In your .git/hooks folder, create a executable shell file 'post-commit' which contains two commands 1 ) git push 2 ) curl --user "username:password" jenkins url . As soon as the developer commits, this will push the file to github and also trigger the jenkins job ( discussed in jenkins ) .
  5. Simply, make changes and commit the file in which you made changes.
  6. For adding another developer use git branch command. This developer can commit separately and won't effect the main work until it is merged.

Operation Side

Operation side will be automated entirely. But we have to know the tasks done by operation side to automate it. Here are the tasks in order.

  1. Create http server to deploy website
  2. Download the file uploaded by developer ( git clone ) and copy it to /var/www/html to http server and use it.

This is entirely manual and there will be a lot of delay in doing so. So we use Jenkins to ensure quick deployment.

Jenkins

  1. Create a new job, do not initialize.
  2. In Source Code Management , select git and paste your github repo url
  3. In Build Trigger select, build trigger remotely and use this url in your developer side hooks to trigger this job automatically.
  4. Finally in the build area execute a shell which copies the file downloaded from git to /var/www/html . -- > sudo cp filename
  5. This will complete the deployment.

The video shows the the complete working and ease of deployment.


To view or add a comment, sign in

More articles by Hamad Khan

Explore content categories