auth-framework 0.5.0-rc1

A comprehensive, production-ready authentication and authorization framework for Rust applications
Documentation
version: '3.8'

services:
  # PostgreSQL Database
  postgres:
    image: postgres:15
    environment:
      POSTGRES_DB: auth_framework
      POSTGRES_USER: auth_user
      POSTGRES_PASSWORD: ${DB_PASSWORD:-secure_password}
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init.sql
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U auth_user -d auth_framework"]
      interval: 10s
      timeout: 5s
      retries: 5

  # Redis for sessions and caching
  redis:
    image: redis:7-alpine
    command: redis-server --requirepass ${REDIS_PASSWORD:-redis_password}
    volumes:
      - redis_data:/data
    ports:
      - "6379:6379"
    healthcheck:
      test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
      interval: 10s
      timeout: 3s
      retries: 5

  # Auth Framework CLI (for migrations and admin tasks)
  auth-cli:
    build: .
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
    environment:
      DATABASE_URL: postgresql://auth_user:${DB_PASSWORD:-secure_password}@postgres:5432/auth_framework
      REDIS_URL: redis://:${REDIS_PASSWORD:-redis_password}@redis:6379
      JWT_SECRET: ${JWT_SECRET:-your-super-secret-jwt-key-change-in-production}
      LOG_LEVEL: info
    volumes:
      - ./config:/app/config:ro
      - ./logs:/app/logs
    command: ["auth-framework-cli", "db", "migrate"]

  # Example web server using the framework
  auth-server:
    build:
      context: .
      dockerfile: Dockerfile.server
    depends_on:
      auth-cli:
        condition: service_completed_successfully
    environment:
      DATABASE_URL: postgresql://auth_user:${DB_PASSWORD:-secure_password}@postgres:5432/auth_framework
      REDIS_URL: redis://:${REDIS_PASSWORD:-redis_password}@redis:6379
      JWT_SECRET: ${JWT_SECRET:-your-super-secret-jwt-key-change-in-production}
      RUST_LOG: info
      SERVER_PORT: 8080
      REQUIRE_MFA: ${REQUIRE_MFA:-false}
    ports:
      - "8080:8080"
    volumes:
      - ./config:/app/config:ro
      - ./logs:/app/logs
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3

  # Nginx reverse proxy
  nginx:
    image: nginx:alpine
    depends_on:
      - auth-server
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./nginx/ssl:/etc/nginx/ssl:ro
      - ./logs/nginx:/var/log/nginx
    healthcheck:
      test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health"]
      interval: 30s
      timeout: 10s
      retries: 3

volumes:
  postgres_data:
  redis_data:

networks:
  default:
    name: auth_framework_network