sockudo 2.3.2

A simple, fast, and secure WebSocket server for real-time applications.
Documentation
# =============================================================================
# Sockudo Development Override - Docker Compose
# Usage: docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
# =============================================================================

services:
  # Development-optimized Sockudo configuration
  sockudo:
    # Build from source for development
    build:
      context: .
      dockerfile: Dockerfile
      target: runtime

    # Development environment variables
    environment:
      # Enhanced logging for development
      - RUST_LOG=debug,sockudo=debug,tower_http=debug
      - DEBUG=true

      # Development app settings
      - SOCKUDO_DEFAULT_APP_ENABLED=true
      - SOCKUDO_ENABLE_CLIENT_MESSAGES=true
      - SOCKUDO_DEFAULT_APP_MAX_CONNECTIONS=100

      # Relaxed security for development
      - RATE_LIMITER_ENABLED=false
      - SSL_ENABLED=false

    # Development port mapping
    ports:
      - "6001:6001"  # Main server
      - "6002:6002"  # Cluster port
      - "9601:9601"  # Metrics

    # Development volumes (with hot reload support)
    volumes:
      - ./config:/app/config
      - ./logs:/app/logs
      - ./src:/app/src:ro  # Mount source for reference
      - ./.env:/app/.env:ro

    # Relaxed resource limits for development
    deploy:
      resources:
        limits:
          memory: 256M
          cpus: '0.5'

    # Development health check (more frequent)
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:6001/up/demo-app"]
      interval: 15s
      timeout: 5s
      retries: 3
      start_period: 10s

  # Development Redis (less persistence, more logs)
  redis:
    # Development Redis configuration
    command: >
      sh -c "
        redis-server 
        --appendonly no
        --maxmemory 128mb 
        --maxmemory-policy allkeys-lru
        --loglevel debug
        --save ''
      "

    # Keep external port for development access
    ports:
      - "6379:6379"

    # Development resource limits
    deploy:
      resources:
        limits:
          memory: 128M
          cpus: '0.25'

    # Relaxed health check
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 15s
      timeout: 5s
      retries: 2
      start_period: 5s

  # Development MySQL with sample data
  mysql:
    image: mysql:8.0
    container_name: sockudo-mysql-dev
    restart: unless-stopped

    environment:
      - MYSQL_ROOT_PASSWORD=root123
      - MYSQL_DATABASE=sockudo_dev
      - MYSQL_USER=sockudo
      - MYSQL_PASSWORD=sockudo123

    # Keep external port for development access
    ports:
      - "3306:3306"

    # Development MySQL configuration
    command: >
      --default-authentication-plugin=mysql_native_password
      --innodb-buffer-pool-size=64M
      --max-connections=50
      --general-log=1
      --general-log-file=/var/lib/mysql/general.log
      --slow-query-log=1
      --long-query-time=1

    volumes:
      - mysql-dev-data:/var/lib/mysql
      - ./sql/init-dev.sql:/docker-entrypoint-initdb.d/init.sql:ro
      - ./sql/sample-data.sql:/docker-entrypoint-initdb.d/sample-data.sql:ro

    deploy:
      resources:
        limits:
          memory: 256M
          cpus: '0.5'

    networks:
      - sockudo-network

  # Development tools container
  dev-tools:
    image: alpine:latest
    container_name: sockudo-dev-tools
    restart: "no"

    # Development tools
    command: >
      sh -c "
        apk add --no-cache curl jq redis mysql-client &&
        echo 'Development tools ready!' &&
        tail -f /dev/null
      "

    volumes:
      - ./scripts:/scripts:ro

    networks:
      - sockudo-network

  # Redis Commander for development
  redis-commander:
    image: rediscommander/redis-commander:latest
    container_name: sockudo-redis-commander
    restart: unless-stopped

    environment:
      - REDIS_HOSTS=local:redis:6379

    ports:
      - "8081:8081"

    depends_on:
      - redis

    networks:
      - sockudo-network

  # PHPMyAdmin for development (if using MySQL)
  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: sockudo-phpmyadmin
    restart: unless-stopped

    environment:
      - PMA_HOST=mysql
      - PMA_USER=sockudo
      - PMA_PASSWORD=sockudo123

    ports:
      - "8080:80"

    depends_on:
      - mysql

    networks:
      - sockudo-network

  # Mailhog for testing webhooks (development)
  mailhog:
    image: mailhog/mailhog:latest
    container_name: sockudo-mailhog
    restart: unless-stopped

    ports:
      - "1025:1025"  # SMTP
      - "8025:8025"  # Web UI

    networks:
      - sockudo-network

volumes:
  mysql-dev-data:
    driver: local