Day 81(Project-2): Automating Deployment Process with Jenkins

ยท

3 min read

Day 81(Project-2): Automating Deployment Process with Jenkins

Hey everyone! Today, I wanted to share with you a recent project I've been working on - automating the deployment process of a web application using Jenkins and its declarative syntax. It's been quite the journey, but I'm excited to walk you through the steps I took to make it happen!

Project Description ๐Ÿ“

So, let's dive right in! The project revolves around automating the deployment process of a web application. Here's a breakdown of what the pipeline includes:

  1. Building, Testing, and Deploying: The pipeline includes stages like building, testing, and deploying to a staging environment. This ensures that our application is thoroughly tested before it goes live.

  2. Running Acceptance Tests: We also incorporated running acceptance tests into our pipeline. These tests ensure that our application meets the necessary requirements before deployment.

  3. Deploying to Production: If all tests pass successfully, the application is then deployed to production. This ensures a seamless deployment process without any hiccups.

Step-by-Step Guide ๐Ÿ› ๏ธ

Now, let me walk you through the steps I followed to set up this pipeline:

Step 1: Create an EC2 Instance on AWS ๐ŸŒ

  • Logged into the AWS portal and navigated to EC2.

  • Launched an EC2 instance, choosing an appropriate AMI and instance type.

  • Configured security settings to allow HTTP and HTTPS traffic.

  • Created a new key pair and downloaded the .pem file.

Step 2: Configure Security Groups ๐Ÿ”’

  • Added inbound rules to the security group associated with the EC2 instance to allow ports 8080 and 8001.

Step 3: Connect to the EC2 Instance ๐Ÿ’ป

  • Used SSH to connect to the EC2 instance using the copied SSH command.

  • Opened a terminal and pasted the SSH command to connect.

Step 4: Install Jenkins ๐Ÿ› ๏ธ

  • Followed the instructions to install Jenkins on the EC2 instance.

Step 5: Install Docker ๐Ÿณ

  • Ran the command sudo apt-install docker.io to install Docker on the EC2 instance.

Step 6: Verify Installation โœ…

  • Checked if Jenkins and Docker are installed by running jenkins --version and docker --version, respectively.

Step 7: Create a Jenkins Pipeline ๐Ÿ› ๏ธ

  • Went to the Jenkins dashboard and clicked on "New Item".

  • Named the project "declarative_pipeline" and selected "Pipeline" as the project type.

  • Defined stages in the pipeline script for checking out the code, testing, building Docker image, and running the container.

Step 8: Save and Build the Pipeline ๐Ÿ’พ

  • Clicked on "Save" to save the pipeline configuration.

  • Clicked on "Build Now" to trigger the pipeline execution.

Step 9: Monitor Pipeline Progress ๐Ÿ“Š

  • Viewed the pipeline progress by clicking on "Stage View" to check the status of each stage.

Step 10: Access the Deployed Application ๐ŸŒ

  • Once the pipeline execution was successful, searched for the public IP address of the EC2 instance followed by port 8001 in the browser to access the deployed web application.

Wrapping Up ๐ŸŽ‰

And there you have it! By following these steps, I successfully deployed a web application using Jenkins CI/CD declarative pipeline on AWS. This process has truly automated the deployment process, making it efficient and reliable. Happy coding, everyone! If you have any questions or thoughts, feel free to drop them in the comments below. ๐Ÿ˜Š๐Ÿ‘ฉโ€๐Ÿ’ป

ย