Ctrl K
ComunidadGuías…

docker-compose.dev.yml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# Development override - run with: docker compose -f docker-compose.yml -f docker-compose.dev.yml up
services:
  # Single RDA instance for development with hot-reload
  rda-dev:
    build:
      context: .
      dockerfile: Dockerfile.dev
    environment:
      - NODE_ENV=development
      - PORT=3000
      - APP_NAME=ojuri-rda-dev
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - REDIS_PASSWORD=${REDIS_PASSWORD:-}
      - KAFKA_BROKERS=kafka:29092
      - KAFKA_TOPIC=transactions.completed
      - KAFKA_BLOCKED_TOPIC=transactions.blocked
      - MODEL_PATH=/app/models/fraud_model.onnx
      - MODEL_INPUT_DIMENSION=${MODEL_INPUT_DIMENSION:-0}
      # Env-level fallback only — last in RDA's threshold cascade:
      #   1. segmentThresholds (per-segment override in the DB)
      #   2. modelVersions.defaultThreshold (per-model in the registry)
      #   3. runtimeSettings.fraud_threshold (operator-editable, seeded 0.65)
      #   4. env FRAUD_THRESHOLD (this line)
      # 0.65 is the conservative cold-start value; pick a real number
      # for your own deployed model via `python scripts/threshold_sweep.py
      # reports/<your-harness-output>.json --target-fp-rate <N>` and set
      # it on the model's registry row, not here.
      - FRAUD_THRESHOLD=${FRAUD_THRESHOLD:-0.65}
      - LOG_LEVEL=debug
      - DB_CLIENT=pg
      - DB_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-fraud_db}
      - AUTH_JWT_SECRET=${AUTH_JWT_SECRET}
      - AUTH_JWT_TTL_SECONDS=${AUTH_JWT_TTL_SECONDS:-28800}
      - RDA_REQUIRE_API_KEY=${RDA_REQUIRE_API_KEY:-false}
      - MLA_SERVICE_TOKEN=${MLA_SERVICE_TOKEN:-}
      - AUDIT_PIPELINE=${AUDIT_PIPELINE:-queue}
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_DATABASE=${POSTGRES_DB:-fraud_db}
      - DB_USERNAME=${POSTGRES_USER:-postgres}
      - DB_PASSWORD=${POSTGRES_PASSWORD:-postgres}
    volumes:
      - ./src:/app/src
      # dist/ is built inside the image (Dockerfile.dev RUN npm run build);
      # mounting host dist/ over it caused stale-build issues for new
      # contributors who hadn't run the build locally.
      - ./models:/app/models:ro
      - ./package.json:/app/package.json:ro
      - ./tsconfig.json:/app/tsconfig.json:ro
      - ./nodemon.json:/app/nodemon.json:ro
      - /app/node_modules
      - /app/dist
    ports:
      - "3000:3000"
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
      kafka:
        condition: service_healthy
    networks:
      - ojuri-network

  # Single PAA instance for development with hot-reload
  paa-dev:
    build:
      context: ./paa-service
      dockerfile: Dockerfile.dev
    environment:
      - NODE_ENV=development
      - APP_NAME=ojuri-paa-dev
      - METRICS_PORT=9090
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - REDIS_PASSWORD=${REDIS_PASSWORD:-}
      - KAFKA_BROKERS=kafka:29092
      - KAFKA_TOPIC=transactions.completed
      - KAFKA_CONSUMER_GROUP=pattern-analysis
      - KAFKA_CLIENT_ID=paa-dev
      - LOG_LEVEL=debug
      - DB_CLIENT=pg
      - DB_URL=postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-fraud_db}
      - GRAPH_UPDATE_INTERVAL=60000
      - PAGERANK_DAMPING=0.85
      - BATCH_SIZE=50
      - MAX_GRAPH_NODES=100000
    volumes:
      - ./paa-service/src:/app/src
      - ./paa-service/package.json:/app/package.json:ro
      - ./paa-service/tsconfig.json:/app/tsconfig.json:ro
      - ./paa-service/nodemon.json:/app/nodemon.json:ro
      - /app/node_modules
    ports:
      - "9091:9090"
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
      kafka:
        condition: service_healthy
    networks:
      - ojuri-network

  # Single FIA instance for development. Source mounted; restart container to pick up changes.
  fia-dev:
    build:
      context: ./fia-service
      dockerfile: Dockerfile.dev
    environment:
      - KAFKA_BROKERS=kafka:29092
      - KAFKA_BLOCKED_TOPIC=transactions.blocked
      - KAFKA_CONSUMER_GROUP=ojuri-investigation-dev
      - KAFKA_AUTO_OFFSET_RESET=earliest
      - POSTGRES_HOST=postgres
      - POSTGRES_PORT=5432
      - POSTGRES_DB=${POSTGRES_DB:-fraud_db}
      - POSTGRES_USER=${POSTGRES_USER:-postgres}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
      - LLM_MODEL_NAME=${FIA_LLM_MODEL_NAME:-microsoft/Phi-3-mini-4k-instruct}
      - LLM_DEVICE=${FIA_LLM_DEVICE:-cpu}
      - LLM_DTYPE=${FIA_LLM_DTYPE:-float32}
      - LLM_MAX_NEW_TOKENS=${FIA_LLM_MAX_NEW_TOKENS:-256}
      - LLM_TEMPERATURE=${FIA_LLM_TEMPERATURE:-0.2}
      - FIA_FALLBACK_ON_LLM_FAILURE=true
      - PROMPT_TEMPLATE_VERSION=v1
      - METRICS_PORT=9094
      - LOG_LEVEL=debug
    volumes:
      - ./fia-service/src:/app/src
      - ./fia-service/requirements.txt:/app/requirements.txt:ro
      - fia-hf-cache:/app/.hf-cache
    ports:
      - "9094:9094"
    depends_on:
      postgres:
        condition: service_healthy
      kafka:
        condition: service_healthy
    networks:
      - ojuri-network

volumes:
  fia-hf-cache: