Skip to content

Latest commit

Β 

History

History
92 lines (66 loc) Β· 1.99 KB

File metadata and controls

92 lines (66 loc) Β· 1.99 KB

πŸš€ CI/CD Setup - Docker Hub

Quick Setup (5 Minutes)

Step 1: Add GitHub Secrets

Go to: GitHub Repo β†’ Settings β†’ Secrets β†’ Actions

Add these 5 secrets:

Secret Value
DOCKER_USERNAME Your Docker Hub username
DOCKER_PASSWORD Docker Hub token (create here)
AZURE_CREDENTIALS Azure service principal JSON (see below)
AZURE_RESOURCE_GROUP Your AKS resource group (e.g., planify-rg)
AZURE_AKS_CLUSTER Your AKS cluster name (e.g., planify-aks)

Step 2: Create Azure Service Principal

az ad sp create-for-rbac \
  --name "planify-github-actions" \
  --role contributor \
  --scopes /subscriptions/YOUR_SUBSCRIPTION_ID/resourceGroups/YOUR_RESOURCE_GROUP \
  --sdk-auth

Copy the JSON output β†’ Save as AZURE_CREDENTIALS secret.

Step 3: Update Image Name

Edit kubernetes/app.yaml (line 51):

image: YOUR_DOCKERHUB_USERNAME/planify:latest
imagePullPolicy: Always

Step 4: First Deploy

docker build -t YOUR_USERNAME/planify:latest .
docker login
docker push YOUR_USERNAME/planify:latest
./kubernetes/deploy.sh

βœ… Done!

Now every git push origin main = automatic deployment!


How It Works

git push origin main
        ↓
GitHub Actions triggered
        ↓
[1] Build Docker image
[2] Push to Docker Hub
[3] Deploy to Azure AKS
[4] Rolling update (zero downtime)
[5] Health check verification
        ↓
βœ… Live in 3-5 minutes!

Watch progress: GitHub β†’ Actions tab


Troubleshooting

Build fails?

  • Check GitHub Actions logs
  • Verify Docker Hub credentials

Deploy fails?

  • Ensure image exists: docker pull YOUR_USERNAME/planify:latest
  • Check AKS connection: kubectl get nodes

Rollback

kubectl rollout undo deployment/planify-app -n planify

That's it! Simple and automatic. πŸŽ‰