Day 80 (Project-1)- Automating Deployment with Jenkins and GitHub Integration

ยท

2 min read

Day 80 (Project-1)- Automating Deployment with Jenkins and GitHub Integration

Today, let's embark on a journey to streamline our deployment process using Jenkins and GitHub integration, automating the building, testing, and deploying of a web application effortlessly. Our goal is to set up a Jenkins CI/CD pipeline triggered by GitHub webhook integration, ensuring continuous integration and delivery with ease.

Step 1: Setting Up Jenkins Server on AWS

Start by creating a new EC2 instance on AWS named "jenkins-server" with Ubuntu AMI, t2.micro instance type, and key pair "docker.pem". Ensure to allow HTTP and HTTPS traffic and download the .pem file.

Connect to the EC2 instance via SSH, generate SSH keys using "ssh-keygen", and install Jenkins and Docker using the provided links. Verify installations using "jenkins --version" and "docker --version".

Open ports 8080 and 8001 in the security group for Jenkins access, and access the Jenkins portal using the public IP address.

Step 2: Setting Up Jenkins Pipeline

Unlock Jenkins using the administrator password obtained from "/var/lib/Jenkins/secrets/initialAdminPassword". Install suggested plugins and create the first admin user.

Create a new Jenkins project named "todo-app" as a Freestyle project. Configure Git repository URL and credentials for source code management.

In the build step, execute shell commands to build Docker image and run a container. Trigger the build and verify the output console for success.

Step 3: Configuring GitHub Integration

Install the "Git Integration" plugin from Manage Jenkins > Manage Plugins > Git Integration.

Add SSH key to GitHub repository settings for authentication. Create a webhook in GitHub settings with payload URL as "http://<public_ip_of_ec2>:8080/github-webhook/", content type as "application/json", and event as "push".

Save the configured Jenkins project and make changes to the code on GitHub to trigger the pipeline automatically.

Step 4: Automating Deployment

Configure the Jenkins project to use "GitHub hook trigger for GitScm polling" as a build trigger. This ensures that every commit triggers the pipeline.

With this setup, any changes pushed to the GitHub repository will automatically trigger the Jenkins pipeline, building and deploying the updated code seamlessly.

Conclusion

By automating the deployment process with Jenkins and GitHub integration, we've streamlined our development workflow, enabling continuous integration and delivery of our web application. Embrace automation for efficient software delivery and enjoy hassle-free deployments. Cheers to simplified deployment processes! ๐Ÿš€ #Jenkins #GitHubIntegration #CI/CD #DevOps #Automation ๐Ÿ› ๏ธ

ย