optionchain_simulator 0.0.3

OptionChain-Simulator is a lightweight REST API service that simulates an evolving option chain with every request. It is designed for developers building or testing trading systems, backtesters, and visual tools that depend on option data streams but want to avoid relying on live data feeds.
version: '3.8'

services:
  # Redis service configuration
  redis:
    image: redis:latest
    container_name: redis
    command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-password}
    ports:
      - "6379:6379"
    volumes:
      - redis-data:/data
    networks:
      - optionchain-network
    healthcheck:
      test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-password}", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    environment:
      - TZ=UTC
    restart: unless-stopped
  
  # MongoDB service configuration
  mongodb:
    image: mongo:latest
    container_name: mongodb
    ports:
      - "27017:27017"
    volumes:
      - mongodb-data:/data/db
      - mongodb-config:/data/configdb
    networks:
      - optionchain-network
    environment:
      - MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME:-admin}
      - MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD:-password}
      - TZ=UTC
    healthcheck:
      test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

  # MongoDB Express for web-based MongoDB management (optional)
  mongo-express:
    image: mongo-express:latest
    container_name: mongo-express
    restart: unless-stopped
    ports:
      - "8081:8081"
    environment:
      - ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_USERNAME:-admin}
      - ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_PASSWORD:-password}
      - ME_CONFIG_MONGODB_SERVER=mongodb
      - ME_CONFIG_BASICAUTH_USERNAME=${MONGOEXPRESS_USERNAME:-admin}
      - ME_CONFIG_BASICAUTH_PASSWORD=${MONGOEXPRESS_PASSWORD:-password}
    networks:
      - optionchain-network
    depends_on:
      - mongodb

  # Redis Commander for web-based Redis management (optional)
  redis-commander:
    image: rediscommander/redis-commander:latest
    container_name: redis-commander
    restart: unless-stopped
    ports:
      - "8082:8081"
    environment:
      - REDIS_HOSTS=local:redis:6379:0:${REDIS_PASSWORD:-password}
      - HTTP_USER=${REDIS_COMMANDER_USER:-admin}
      - HTTP_PASSWORD=${REDIS_COMMANDER_PASSWORD:-password}
    networks:
      - optionchain-network
    depends_on:
      - redis
        
  clickhouse:
    image: clickhouse/clickhouse-server:latest
    container_name: clickhouse
    ports:
      - "8123:8123"   # HTTP interface
      - "9000:9000"   # Native client (TCP)
    environment:
      CLICKHOUSE_USER: ${CLICKHOUSE_USER:-admin}
      CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-password}
      CLICKHOUSE_DB: ${CLICKHOUSE_DB:-default}
    volumes:
      - clickhouse_data:/var/lib/clickhouse
    ulimits:
      nofile:
        soft: 262144
        hard: 262144
    restart: unless-stopped
    networks:
      - optionchain-network

  backend:
    build:
      context: ..
      dockerfile: Docker/Dockerfile
    container_name: backend
    restart: unless-stopped
    environment:
      CLICKHOUSE_USER: ${CLICKHOUSE_USER:-admin}
      CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-password}
      CLICKHOUSE_DB: ${CLICKHOUSE_DB:-default}
      CLICKHOUSE_PORT: ${CLICKHOUSE_PORT-8123}
      CLICKHOUSE_HOST: ${CLICKHOUSE_HOST-clickhouse}
      MONGODB_URI: ${MONGODB_URI-mongodb://admin:password@mongodb:27017}
      MONGODB_DATABASE: ${MONGODB_DATABASE-optionchain_simulator}
      MONGODB_STEPS_COLLECTION: ${MONGODB_STEPS_COLLECTION-steps}
      MONGODB_EVENTS_COLLECTION: ${MONGODB_EVENTS_COLLECTION-events}
      MONGODB_TIMEOUT: ${MONGODB_TIMEOUT-30}
      REDIS_PORT: ${REDIS_PORT-6379}
      REDIS_DB: ${REDIS_DB-0}
      REDIS_USER: ${REDIS_USER}
      REDIS_PASSWORD: ${REDIS_PASSWORD-password}
      REDIS_HOST: ${REDIS_HOST-redis}
    depends_on:
      - redis
      - mongodb
      - clickhouse
    ports:
      - "7070:7070"
    networks:
      - optionchain-network
      
networks:
  optionchain-network:
    driver: bridge

volumes:
  redis-data:
    driver: local
  mongodb-data:
    driver: local
  mongodb-config:
    driver: local
  clickhouse_data:
    driver: local