Skip to content

omkar-shelke25/GitOps-Django-Note-App-GitHub-Action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

82 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—’οΈ Django Note App Deployment with GitOps (ArgoCD + EKS)

This project demonstrates a complete GitOps-based deployment workflow for a Django Notes application. We use GitHub Actions for automation and ArgoCD for continuous deployment into an Amazon EKS cluster. Infrastructure is managed using Kustomize for environment-specific manifests.


πŸš€ Tech Stack

Tool Purpose
Django Backend framework
MySQL Database
Nginx Reverse proxy
Docker Containerization
GitHub Actions Workflow automation
Kustomize Kubernetes overlay management
ArgoCD GitOps-based deployment
Amazon EKS Kubernetes cluster

πŸ“ Project Structure

.
β”œβ”€β”€ Dockerfile                   # Django backend
β”œβ”€β”€ nginx/Dockerfile            # Nginx reverse proxy
β”œβ”€β”€ docker-compose.yml          # Local dev stack
β”œβ”€β”€ requirements.txt            # Python deps
β”œβ”€β”€ noteapp-kustomize/          # Kustomize base and overlays
β”‚   β”œβ”€β”€ base/
β”‚   └── overlays/{staging,production}/
β”œβ”€β”€ argocd/
β”‚   β”œβ”€β”€ app-staging.yaml
β”‚   └── app-production.yaml
└── .github/workflows/
    └── noteapp-gitops-pipelines.yml

πŸ” Workflow Automation (via GitHub Actions)

πŸ”„ Triggered On:

  • Push to main (deploys to staging environment)
  • Manual workflow_dispatch (triggers production deployment)

🧱 Workflow Job Summary

image

1️⃣ docker-build

  • Builds noteapp-backend and noteapp-nginx Docker images
  • Saves them as artifacts

2️⃣ smoke-test

  • Loads Docker images
  • Spins up app using docker-compose (MySQL + Django + Nginx)
  • Verifies availability using curl

πŸ“¦ Output:

MySQL is healthy!
Django is healthy!
Running smoke test...
Smoke test passed!

3️⃣ docker-push

  • Tags images using Git SHA
  • Pushes them to DockerHub using secrets

4️⃣ update-kustomization

  • Updates image tags in kustomization.yaml using yq
  • Commits changes back to repo
Updated image tags to abc1234 in kustomization.yaml

5️⃣ django-note-app-staging-deploy

  • Applies ArgoCD app-staging.yaml using kubectl
  • ArgoCD auto-syncs changes in staging

πŸ“Έ Staging CLI Output:
Staging CLI

6️⃣ django-note-app-production-deploy

  • Manual trigger deploys production ArgoCD manifest

πŸ“Έ Production CLI Output:
Production CLI


🌐 ArgoCD Dashboards

ArgoCD Production

πŸ”„ Staging App

ArgoCD Staging

πŸ”„ Production App

image


βœ… Final Application Output

Final Output


πŸ§ͺ Run Locally

git clone <repo-url>
cd <repo>

πŸ” .env setup:

cat <<EOF > .env
DATABASE_HOST=db
DATABASE_NAME=test_db
DATABASE_USER=root
DATABASE_PASSWORD=root
DATABASE_PORT=3306
EOF

🐳 Start services:

docker-compose up -d

🌐 Access:

http://localhost:80

🧹 Stop services:

docker-compose down --volumes

πŸ” GitHub Secrets Required

Secret Description
DOCKER_USERNAME DockerHub login
DOCKER_PASS DockerHub password
GIT_TOKEN Git commit access
KUBECONFIG EKS cluster kubeconfig

πŸ” GitOps Workflow

graph TD;
  Push[Push to main] --> Build[Docker Build]
  Build --> Test[Smoke Test]
  Test --> PushRegistry[Push Docker Images]
  PushRegistry --> UpdateKustomize[Update kustomization.yaml]
  UpdateKustomize --> ArgoCD[ArgoCD Auto Sync]
  ArgoCD --> Staging[Staging Deployment]
  Staging --> ManualTrigger[Manual Dispatch]
  ManualTrigger --> Production[Production Deployment]
Loading

About

A Django application integrated with a Jenkins pipeline for automated testing, building, and deployment using Docker and Artifactory.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages