# ============================================================================= # FOXHUNT HFT TRADING SYSTEM - DEVELOPMENT DOCKER COMPOSE # ============================================================================= # Complete local development environment with all services, databases, # and monitoring infrastructure version: '3.8' services: # ========================================================================== # DATABASE SERVICES # ========================================================================== postgres: image: postgres:15-alpine container_name: foxhunt-postgres-dev environment: POSTGRES_DB: foxhunt POSTGRES_USER: foxhunt POSTGRES_PASSWORD: foxhunt_dev_password POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C" ports: - "5432:5432" volumes: - postgres_dev_data:/var/lib/postgresql/data - ./database/schemas:/docker-entrypoint-initdb.d:ro - ./init-db-dev.sql:/docker-entrypoint-initdb.d/99-dev-data.sql:ro healthcheck: test: ["CMD-SHELL", "pg_isready -U foxhunt -d foxhunt"] interval: 10s timeout: 5s retries: 5 networks: - foxhunt-dev redis: image: redis:7-alpine container_name: foxhunt-redis-dev command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru ports: - "6379:6379" volumes: - redis_dev_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 networks: - foxhunt-dev # ========================================================================== # MOCK SERVICES FOR DEVELOPMENT # ========================================================================== localstack: image: localstack/localstack:3.0 container_name: foxhunt-localstack-dev environment: SERVICES: s3,sqs,sns DEFAULT_REGION: us-east-1 AWS_DEFAULT_REGION: us-east-1 HOSTNAME_EXTERNAL: localstack DEBUG: 1 ports: - "4566:4566" volumes: - localstack_dev_data:/var/lib/localstack - /var/run/docker.sock:/var/run/docker.sock healthcheck: test: ["CMD", "curl", "-f", "http://localhost:4566/_localstack/health"] interval: 30s timeout: 10s retries: 5 networks: - foxhunt-dev # ========================================================================== # FOXHUNT CORE SERVICES # ========================================================================== trading-service: build: context: . dockerfile: services/trading_service/Dockerfile.dev container_name: foxhunt-trading-service-dev depends_on: postgres: condition: service_healthy redis: condition: service_healthy environment: - DATABASE_URL=postgres://foxhunt:foxhunt_dev_password@postgres:5432/foxhunt - REDIS_URL=redis://redis:6379 - RUST_LOG=debug - FOXHUNT_ENV=development ports: - "50051:50051" # gRPC - "8081:8081" # Health/Debug - "9001:9001" # Metrics volumes: - ./config:/app/config:ro - ./logs:/app/logs networks: - foxhunt-dev restart: unless-stopped backtesting-service: build: context: . dockerfile: services/backtesting_service/Dockerfile.dev container_name: foxhunt-backtesting-service-dev depends_on: postgres: condition: service_healthy redis: condition: service_healthy environment: - DATABASE_URL=postgres://foxhunt:foxhunt_dev_password@postgres:5432/foxhunt - REDIS_URL=redis://redis:6379 - RUST_LOG=debug - FOXHUNT_ENV=development ports: - "50052:50052" # gRPC - "8082:8082" # Health/Debug - "8888:8888" # Jupyter volumes: - ./config:/app/config:ro - ./data:/app/data - ./logs:/app/logs - backtesting_dev_data:/app/backtests networks: - foxhunt-dev restart: unless-stopped ml-training-service: build: context: . dockerfile: services/ml_training_service/Dockerfile.dev container_name: foxhunt-ml-training-service-dev depends_on: postgres: condition: service_healthy localstack: condition: service_healthy environment: - DATABASE_URL=postgres://foxhunt:foxhunt_dev_password@postgres:5432/foxhunt - AWS_ENDPOINT_URL=http://localstack:4566 - AWS_ACCESS_KEY_ID=test - AWS_SECRET_ACCESS_KEY=test - AWS_DEFAULT_REGION=us-east-1 - RUST_LOG=debug - FOXHUNT_ENV=development ports: - "50053:50053" # gRPC - "8083:8083" # Health/Debug - "6006:6006" # TensorBoard - "8889:8888" # Jupyter (different port to avoid conflict) volumes: - ./config:/app/config:ro - ./logs:/app/logs - ml_dev_data:/app/models - ml_cache_data:/app/cache networks: - foxhunt-dev restart: unless-stopped tli: build: context: . dockerfile: tli/Dockerfile.dev container_name: foxhunt-tli-dev depends_on: - trading-service - backtesting-service - ml-training-service environment: - TRADING_SERVICE_URL=http://trading-service:50051 - BACKTESTING_SERVICE_URL=http://backtesting-service:50052 - ML_SERVICE_URL=http://ml-training-service:50053 - RUST_LOG=debug - FOXHUNT_ENV=development stdin_open: true tty: true volumes: - ./config:/app/config:ro - ./logs:/app/logs networks: - foxhunt-dev profiles: - interactive # Only start when explicitly requested # ========================================================================== # MONITORING AND OBSERVABILITY # ========================================================================== prometheus: image: prom/prometheus:v2.48.0 container_name: foxhunt-prometheus-dev command: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.path=/prometheus' - '--storage.tsdb.retention.time=7d' - '--web.console.libraries=/etc/prometheus/console_libraries' - '--web.console.templates=/etc/prometheus/consoles' - '--web.enable-lifecycle' - '--log.level=info' ports: - "9090:9090" volumes: - prometheus_dev_data:/prometheus - ./config/monitoring/prometheus-dev.yml:/etc/prometheus/prometheus.yml:ro healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/-/healthy"] interval: 30s timeout: 10s retries: 5 networks: - foxhunt-dev restart: unless-stopped grafana: image: grafana/grafana:10.2.0 container_name: foxhunt-grafana-dev environment: - GF_SECURITY_ADMIN_PASSWORD=foxhunt_dev - GF_USERS_ALLOW_SIGN_UP=false - GF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-clock-panel - GF_LOG_LEVEL=info ports: - "3000:3000" volumes: - grafana_dev_data:/var/lib/grafana - ./config/monitoring/grafana/dashboards:/var/lib/grafana/dashboards:ro - ./config/monitoring/grafana/provisioning:/etc/grafana/provisioning:ro depends_on: prometheus: condition: service_healthy healthcheck: test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1"] interval: 30s timeout: 10s retries: 5 networks: - foxhunt-dev restart: unless-stopped # ========================================================================== # DEVELOPMENT UTILITIES # ========================================================================== nginx: image: nginx:alpine container_name: foxhunt-nginx-dev ports: - "80:80" - "443:443" volumes: - ./config/nginx/nginx-dev.conf:/etc/nginx/nginx.conf:ro - ./config/nginx/ssl:/etc/nginx/ssl:ro depends_on: - trading-service - backtesting-service - ml-training-service - grafana networks: - foxhunt-dev restart: unless-stopped # ============================================================================= # NETWORKS AND VOLUMES # ============================================================================= networks: foxhunt-dev: driver: bridge name: foxhunt-dev-network volumes: postgres_dev_data: name: foxhunt-postgres-dev-data redis_dev_data: name: foxhunt-redis-dev-data localstack_dev_data: name: foxhunt-localstack-dev-data backtesting_dev_data: name: foxhunt-backtesting-dev-data ml_dev_data: name: foxhunt-ml-dev-data ml_cache_data: name: foxhunt-ml-cache-dev-data prometheus_dev_data: name: foxhunt-prometheus-dev-data grafana_dev_data: name: foxhunt-grafana-dev-data