Complete Jenkins CI/CD Project - Continued with Documentation ... Day25

Complete Jenkins CI/CD Project - Continued with Documentation ... Day25

Continuous Integration (CI) and Continuous Deployment (CD) are crucial components of modern software development, ensuring rapid and reliable delivery of applications. In this guide, we will walk through the steps to set up an automated CI/CD pipeline for a Node.js application using AWS EC2, Docker, GitHub, and Jenkins.

Getting Started

To begin, make sure you have the following prerequisites in place:


  • AWS EC2 instance
  • Jenkins installed
  • Docker and Docker-compose installed
  • GitHub account
  • GitHub integration plugin installed in Jenkins


Installation


  1. Launch EC2 Instance: Launch an AWS EC2 instance and ensure that you have the necessary permissions.
  2. Install Jenkins, Docker, and Docker-compose: Follow the provided links for instructions on installing Jenkins, Docker, and Docker-compose.
  3. Fork and Clone Repository: Clone the repository onto your EC2 instance using the following commands git clone
  4. Create SSH Keys: Generate SSH public and private keys on your EC2 instance:ssh-keygen cd .ssh cat id_rsa cat id_rsa.pub
  5. Configuring GitHub:In GitHub, go to Account Settings, click on SSH and GPG keys, and add the public IP of your EC2 instance.Configure GitHub Webhook: In your repository settings, click on Webhooks, add a webhook with the Jenkins environment URL, and set the payload URL to https://your-jenkins-ip/github-webhook/.
  6. Configuring Jenkins:Install the GitHub integration plugin in Jenkins.Create a freestyle project, configure the GitHub project URL, and set up the Git repository credentials.
  7. Jenkins CI/CD Pipeline Steps:Configure the build trigger to use GitHub hook trigger for GITScm polling.Set up build steps using Docker-compose commands to build and deploy the Node.js application.Example Build Steps:echo "starting container" docker-compose down docker-compose up -d --no-deps --build <service_name>
  8. Check Webhook Connection: Verify the webhook connection by checking for a green checkmark in the GitHub project.
  9. Run the Pipeline: Go to the Jenkins dashboard, click on the project, and build the project to trigger the CI/CD pipeline.
  10. Access Application: Access the application at https://public_ip_of_instance:8000 in a web browser.


Usage

After completing the setup, any changes pushed to the GitHub main branch will trigger the Jenkins pipeline automatically. Monitor the Jenkins dashboard for build statuses and access the deployed application to verify the changes.

Contributing

Contributions to this project are welcome. If you have any suggestions, enhancements, or bug fixes, follow these steps:


  1. Fork the project.
  2. Create a new branch for your feature (e.g., git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.


Your contributions are highly appreciated in making this CI/CD pipeline more robust and efficient.


I'm confident that this article will prove to be valuable, helping you discover new insights and learn something enriching .

thank you : )


要查看或添加评论,请登录

社区洞察

其他会员也浏览了