Implement an automated CI/CD pipeline using Jenkins, Docker, and Ansible.
This project aims to develop a CI/CD pipeline that automates the build, testing, and deployment of a sample application. We utilize Jenkins for continuous integration, Docker for containerization, and Ansible for configuration management. The pipeline includes automated testing and deployment to a cloud environment.
This project is based on the web application forked from DevOps Challenge.
- Docker 🐳
- Kubernetes ☸️ (optional)
- Jenkins ⚙️
- Ansible 📦
- CI/CD 🔄
- Cloud Deployment ☁️
This project demonstrates the implementation of a CI/CD pipeline that leverages Jenkins, Docker, and Ansible to automate the build, test, and deployment processes of a web application. The goal is to showcase how to efficiently manage the entire lifecycle of application development using DevOps methodologies.
Description:
- Set up Jenkins and Docker on local or cloud environments to create a foundational base for the CI/CD pipeline.
- Develop a simple application (e.g., a web app) and Dockerize it to prepare for the build and deployment stages.
- Install Ansible for configuration management.
Description:
- Create Jenkins Jobs to automate the build process for the Dockerized application.
- Integrate a GitHub or GitLab repository for continuous integration.
- Incorporate automated testing (e.g., unit tests) into the Jenkins pipeline.
- Set up notifications for pipeline success or failure to keep stakeholders informed.
Description:
- Push Docker images to Docker Hub or a private registry to make them accessible for deployment.
- Write Ansible playbooks to automate the deployment of the application to a cloud environment (e.g., AWS, GCP).
- Test the deployment process with Docker and Ansible to ensure a smooth workflow.
Description:
- Optionally configure Kubernetes to manage the deployment of Docker containers.
- Refine Jenkins jobs for efficiency by implementing parallel stages and caching.
- Conduct comprehensive tests of the CI/CD pipeline from code commit to deployment.
- Complete documentation of the project, covering pipeline design, deployment processes, and any challenges faced.
The CI/CD pipeline is structured as follows:
- Code Checkout: Jenkins checks out code from the GitHub repository.
- Build & Test: Jenkins builds Docker images and runs unit tests.
- Deploy: The Docker image is deployed using Ansible to cloud environments (e.g., AWS).
- Notifications: Team members are notified of build status via email.
- Jenkins installed on the server.
- Docker installed on the server and target environments.
- Ansible installed on the server for configuration management.
- Clone the project repository from GitHub:
git clone https://github.com/johnsamey/DEPI-Project.git
- Install Jenkins and Docker:
sudo apt-get update sudo apt-get install jenkins docker.io
- Set up the Jenkins pipeline using the
Jenkinsfile
provided in the repository.
To run the CI/CD pipeline:
- Set up the environment variables in Jenkins:
DOCKER_HUB_CREDENTIALS
EMAIL_RECIPIENTS
- Trigger the pipeline manually or through automated GitHub webhook triggers.
The application is Dockerized and deployed to a cloud environment using Ansible. The deployment process involves:
- Pushing the Docker image to Docker Hub.
- Running the Ansible playbook to pull the image from Docker Hub and deploy it to the cloud.
Automated tests are integrated into the Jenkins pipeline. Unit tests are run after the build stage to ensure the application works as expected.
- Week 1: Jenkins, Docker, and Ansible setup, CI/CD pipeline planning.
- Week 2: Jenkins pipeline configured with GitHub integration and automated testing.
- Week 3: Docker images pushed to Docker Hub, automated deployment with Ansible.
- Week 4: CI/CD pipeline refined, optional Kubernetes integration, and final testing.
- Clone the repository:
git clone https://github.com/johnsamey/DEPI-Project.git
- Navigate to the project directory:
cd DEPI-Project
- Follow the setup instructions in the INSTALL.md file to install dependencies and configure the environment.
This project is licensed under the MIT License - see the LICENSE file for details.
- Khalid Salman
- John Samy
- Mostafa Allam
- Andrew Adel
- Kirolos Nagy
Instructor: Eng. Ahmed Nasr