Complete Jenkins CI/CD Project - Continued with Documentation

2 min read

Cover Image for Complete Jenkins CI/CD Project - Continued with Documentation
  1. Task1 :Documenting the process from cloning the repository to adding webhooks, Deployment, etc. as a README,

    1. launch Amazon EC2 instance, and connect to it through SSH.

    2. Install Docker

       sudo apt update
       sudo apt-get install docker 
       sudo systemctl start docker
       sudo systemctl enable docker 
       sudo systemctl status docker
      
    3. install Java on the instance

       sudo apt install java-1.8.0-openjdk -y
      
    4. install Jenkins, enable the security group in the AWS console at port 8080

       curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
         /usr/share/keyrings/jenkins-keyring.asc > /dev/null
       echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
         https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
         /etc/apt/sources.list.d/jenkins.list > /dev/null
       sudo apt-get update
       sudo apt-get install jenkins
      
    5. connect to your port 8080, it asks you for a security key. you can get it by cat into

       cat /var/lib/jenkins/secrets/initialAdminPassword
      
    6. Login with your credentials. Now create a Jenkins pipelines

      add pipeline scripts.for eg:

       pipeline {
           agent { label "dev-server" }
           stages{
               stage("Clone Code"){
                   steps{
                       git url: "https://github.com/LondheShubham153/node-todo-cicd.git", branch: "master"
                   }
               }
               stage("Build and Test"){
                   steps{
                       sh "docker build . -t node-app-test-new"
                   }
               }
      
               stage("Deploy"){
                   steps{
                       sh "docker-compose down && docker-compose up -d"
                   }
               }
           }
       }
      
    7. create a job with GitHub hook trigger for GITScm polling enable this will enable jenkins to automatically update pipeline whenever changes are pushed to the GitHub repo.

    8. create a webhooks on your github repo. set the payload URL: https://<jenkins-host>:<port>/github-webhook/, replace jenkins-host with the IP address of was instance and port to be jenkins server port.

      • on addition to that you can set jenkins-github integration with access token. go to manage Jenkins -> conigure-> (scroll down)github, add id and access token as security key.
    9. Now, commit changes to github and jenkins pull the changes to server.

Done!! we create a CD pipeline with jenkins,docker and github.

Task 2:

Goal: Learn Devops and become a devops engineer and contribute to community

  • learn tools -jenkins, docker, kubernetes

  • get AWS certification

  • focus on soft skills

  • practise as much as you can

Note: Don't Give up

If you have a dream like me chase it as mad as you can.๐Ÿ’•

remember never give up on your dreams!!๐Ÿ’œ๐Ÿ’œ

Happy learning!!