# Day 24 Task: Complete Jenkins CI/CD Project

# **Setting Up Jenkins CI/CD for Django Todo App with Docker Compose**

## **Introduction**

In this tutorial, we'll explore how to create a robust Continuous Integration and Continuous Deployment (CI/CD) pipeline for a Django Todo App using Jenkins and Docker Compose. By the end of this guide, you'll have a fully automated workflow that builds, tests, and deploys your Django application whenever changes are pushed to your GitHub repository.

### **Prerequisites**

1. Basic understanding of Django and Docker.
    
2. Jenkins installed and running.
    
3. Docker and Docker Compose installed on your Jenkins server.
    

## **Task-01: GitHub Integration**

### **Step 1: Fork the Repository**

Start by forking the Django Todo App repository to your GitHub account.

### **Step 2: Create Jenkins Job**

1. Open Jenkins and create a new job.
    
2. Choose "Freestyle project" or "GitHub Organization" based on your preference.
    
3. Configure GitHub project URL and credentials.
    
4. Enable GitHub Hook trigger for GITScm polling.
    

### **Step 3: GitHub WebHooks**

1. In your GitHub repository, go to "Settings" &gt; "Webhooks" &gt; "Add webhook."
    
2. Set the Payload URL to your Jenkins webhook URL.
    
3. Ensure the webhook is triggered for push events.
    

## **Task-02: Execute Shell and Docker Compose**

### **Step 1: Docker Compose File**

Create a `docker-compose.yml` file in your project root.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701880611904/bae82d0d-bedc-4129-93f3-71381f627c4f.png align="center")

### **Step 2: Jenkins Execute Shell**

Add a build step "Execute shell" in your Jenkins job configuration.

docker-compose up -d

### **Step 3: Post-build Actions**

Add any post-build actions needed, such as archiving artifacts.

### **Step 4: Test Your CI/CD Pipeline**

1. Make a change in your GitHub repository and push it.
    
2. Observe Jenkins triggering the build due to the webhook.
    
3. Check the Jenkins console output for build logs and any issues.
    

### **Step 5: Treat Yourself**

Once the pipeline is successfully set up, celebrate by running the Django Todo App and accessing it through your browser.

## **Conclusion**

Congratulations! You've successfully created a Jenkins CI/CD pipeline for your Django Todo App. This automated workflow ensures that your application is built, tested, and deployed consistently, promoting a more efficient and error-free development process.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701881043282/9fbf9f7a-d0e9-4da6-b5f6-1a18514c7629.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701880867940/750b5c2c-1518-4eeb-aa58-a3feb3f7b09f.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701880963227/fec8f657-727f-4823-8c80-4798537e6996.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1701881007295/c0e69ee7-162b-464f-af45-4aa207ff65fd.png align="center")
