Skip to content

๐Ÿš€ CI/CD Pipeline

Production-Ready DevOps

Automated deployment pipeline for ResuMate Django application featuring GitHub Actions, Docker containerization, and DigitalOcean cloud infrastructure with SSL/TLS security.

Pipeline Features: GitHub Actions โ€ข Docker Containerization โ€ข DigitalOcean Droplet โ€ข SSL/TLS Security

Live Production System

The pipeline automatically deploys to: https://arafat2.me โ€ข API Endpoint โ€ข Admin Panel


๐Ÿ—๏ธ Architecture Overview

graph TD
    A["๐Ÿ‘จโ€๐Ÿ’ป Developer"] -->|git push| B["๐Ÿ“ฆ GitHub Repository"]
    B -->|Trigger| C["๐Ÿ”„ GitHub Actions"]

    C --> D["๐Ÿ—๏ธ Build Stage"]
    D --> E["๐Ÿ“ฆ Docker Build"]
    E --> F["๐Ÿ“ค Push to Docker Hub"]

    F --> G["๐Ÿš€ Deploy Stage"]
    G --> H["๐Ÿ” SSH to DigitalOcean"]
    H --> I["โฌ‡๏ธ Pull Latest Image"]
    I --> J["๐Ÿณ Docker Compose Up"]

    J --> K["๐ŸŒ Nginx Reverse Proxy"]
    K --> L["๐Ÿ”’ SSL/TLS Termination"]
    L --> M["๐ŸŽฏ Production Site"]

    N["๐Ÿ—„๏ธ PostgreSQL Database"] --> J
    O["โšก Redis Cache"] --> J

๐Ÿ”ง Infrastructure Components

Production Infrastructure Stack

Complete overview of our production-grade infrastructure components powering the ResuMate application.

Component Technology Purpose Status
โ˜๏ธ Cloud Provider DigitalOcean Droplet Ubuntu 22.04 LTS server hosting โœ… Active
๐ŸŒ Web Server Nginx Reverse proxy & SSL termination โœ… Active
๐Ÿณ Container Runtime Docker & Docker Compose Application containerization โœ… Active
๐Ÿ—„๏ธ Database PostgreSQL 16 Primary data persistence โœ… Active
โšก Cache Server Redis 7+ Alpine High-performance API caching โœ… Active
๐Ÿ“ฆ Registry Docker Hub Container image storage โœ… Active
๐Ÿ” SSL Certificate Let's Encrypt Free SSL/TLS encryption โœ… Active

๐Ÿ”„ GitHub Actions Workflow

๐Ÿ“‹ Build & Deploy Process

Automated CI/CD Pipeline

Triggers: Every push to master branch โ€ข Duration: ~5 minutes โ€ข Zero Downtime: โœ…

Build Stage

Docker Image Creation and Registry Push

- name: Build and push Docker image
  uses: docker/build-push-action@v5
  with:
    context: .
    push: true
    tags: arafat6462/resumate:master

Deploy Stage

Production Server Deployment

# SSH to production server
ssh root@arafat2.me

# Pull latest image and deploy
docker pull arafat6462/resumate:master
IMAGE_TAG=master docker compose -f docker-compose.prod.yml up -d

# Cleanup old images
docker image prune -f

๐Ÿ”’ Security & Secrets

Sensitive Configuration

All sensitive data is securely managed through GitHub Secrets with proper encryption and access controls.

Secret Variable Purpose Type
DOCKER_HUB_USERNAME Docker Hub authentication Registry
DOCKER_HUB_TOKEN Docker Hub access token Registry
DROPLET_HOST Production server IP Server
DROPLET_SSH_KEY Private SSH key Authentication
DB_PASSWORD Database password Database
SECRET_KEY Django secret key Application
GEMINI_API_KEY Google AI API key External API

๐Ÿณ Docker Configuration

๐Ÿ“ฆ Production Setup

Container Configuration

Optimized Docker setup for production deployment with health checks and automatic restarts.

Application Container

Multi-stage Docker build for optimized production image

FROM python:3.11-slim-buster
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN python manage.py collectstatic --noinput
EXPOSE 8000
CMD ["/app/entrypoint.sh"]

Docker Compose Production

Service orchestration with health monitoring and Redis caching

services:
  backend:
    image: arafat6462/resumate:${IMAGE_TAG:-latest}
    restart: always
    ports:
      - "8000:8000"
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_started

  db:
    image: postgres:16
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
      interval: 5s
      timeout: 5s
      retries: 5

  redis:
    image: redis:alpine
    container_name: resumate_redis_prod
    restart: always
    command: redis-server --maxmemory 256mb --maxmemory-policy allkeys-lru
    volumes:
      - redis_data_prod:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 3s
      retries: 3

volumes:
  postgres_data_prod:
  redis_data_prod:

Redis Cache Configuration

High-Performance Caching Setup:

  • Image: redis:alpine - Lightweight Redis distribution
  • Memory Limit: 256MB with automatic eviction
  • Eviction Policy: allkeys-lru - Removes least recently used keys
  • Persistence: Volume-mounted for data durability across restarts
  • Health Check: Built-in Redis ping for service monitoring
  • Performance: Delivers 10-20ms response times for cached data

๐ŸŒ Nginx & SSL Configuration

๐Ÿ”’ Production Web Server

HTTPS & Security Configuration

Enterprise-grade web server configuration with SSL/TLS encryption and security headers.

HTTPS Configuration

Nginx reverse proxy with SSL termination

server {
    server_name arafat2.me www.arafat2.me;

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/arafat2.me/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/arafat2.me/privkey.pem;
}

# HTTP to HTTPS redirect
server {
    listen 80;
    server_name arafat2.me www.arafat2.me;
    return 301 https://$host$request_uri;
}

๐Ÿ“Š Deployment Timeline

gantt
    title Production Deployment Process
    dateFormat YYYY-MM-DD

    section Build
    Code Checkout    :checkout, 2025-01-01, 30s
    Docker Build     :build, after checkout, 150s
    Registry Push    :push, after build, 60s

    section Deploy
    SSH Connection   :ssh, after push, 10s
    Image Pull       :pull, after ssh, 60s
    Container Deploy :deploy, after pull, 30s
    Health Check     :health, after deploy, 20s

๐Ÿ“‹ Deployment Checklist

Automated Deployment Stages

Complete deployment pipeline with automated checks and validations at each stage.

Stage Check Status Duration
๐Ÿ—๏ธ Build Docker image creation โœ… Automated ~3 min
๐Ÿ“ค Push Registry upload โœ… Automated ~1 min
๐Ÿ” Auth Server SSH connection โœ… Automated ~10 sec
๐Ÿ“ฅ Pull Latest image download โœ… Automated ~1 min
๐Ÿณ Deploy Container orchestration โœ… Automated ~30 sec
๐ŸŽฏ Health Service availability โœ… Automated ~20 sec

๐Ÿ”ง Key Features

โšก Production Highlights

Enterprise-Grade Features

Production-ready deployment pipeline with industry best practices and security standards.

Feature Implementation Benefit
๐Ÿ”„ Zero Downtime Rolling Updates Seamless deployments
๐Ÿ›ก๏ธ Health Checks PostgreSQL + App Automatic failure detection
๐Ÿ”’ SSL/TLS Let's Encrypt Secure HTTPS traffic
๐Ÿ“ฆ Auto Cleanup Docker Prune Optimized disk usage
๐Ÿ” Secrets Management GitHub Secrets Secure credential storage
๐ŸŒ Reverse Proxy Nginx Load balancing & caching

๐Ÿ“ˆ Quick Commands

Management Commands

Essential commands for monitoring and managing the production environment.

Purpose Command Description
๐Ÿ” Status docker ps -a View containers
๐Ÿ“Š Logs docker logs -f resumate_backend_prod Application logs
๐Ÿ”„ Restart docker-compose restart Restart services
๐Ÿงน Cleanup docker system prune -f Remove unused resources
๐ŸŒ Nginx sudo nginx -t && sudo systemctl reload nginx Test & reload config
๐Ÿ”’ SSL certbot certificates Check certificate status

Production-Ready Pipeline

Fully Automated deployment with zero-downtime updates, SSL security, and comprehensive monitoring.

Live System: https://arafat2.me โ€ข API: /api/ โ€ข Admin: /admin/


Pipeline Status

Live & Operational โ€ข Last Deploy: Automated โ€ข Security: A+ Rating