Complete Jenkins CI/CD Project - Continued with Documentation
2 min read
Task1 :Documenting the process from cloning the repository to adding webhooks, Deployment, etc. as a README,
launch Amazon EC2 instance, and connect to it through SSH.
Install Docker
sudo apt update sudo apt-get install docker sudo systemctl start docker sudo systemctl enable docker sudo systemctl status docker
install Java on the instance
sudo apt install java-1.8.0-openjdk -y
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
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
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" } } } }
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.
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.
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!!