version: '3'

services:
  controller:
    build:
      context: ../.quick
      dockerfile: ../Dockerfile-dax-quick
    environment:
      FEATUREBASE_BIND: 0.0.0.0:8080
      FEATUREBASE_VERBOSE: "true"
      FEATUREBASE_CONTROLLER_RUN: "true"
      FEATUREBASE_CONFIG_DATA_DIR: file:/dax-data/controller
    ports:
      - "8081:8080"

  queryer:
    build:
      context: ../.quick
      dockerfile: ../Dockerfile-dax-quick
    environment:
      FEATUREBASE_BIND: 0.0.0.0:8080
      FEATUREBASE_VERBOSE: "true"
      FEATUREBASE_QUERYER_RUN: "true"
      FEATUREBASE_QUERYER_CONFIG_CONTROLLER_ADDRESS: "controller:8080/controller"
    depends_on:
      - controller
    ports:
      - "8080:8080"

  computer:
    build:
      context: ../.quick
      dockerfile: ../Dockerfile-dax-quick
    environment:
      FEATUREBASE_COMPUTER_RUN: "true"
      FEATUREBASE_COMPUTER_CONFIG_CONTROLLER_ADDRESS: "controller:8080/controller"
      FEATUREBASE_COMPUTER_CONFIG_DATA_DIR: /dax-data/computer
      FEATUREBASE_COMPUTER_CONFIG_VERBOSE: true
      FEATUREBASE_BIND: 0.0.0.0:8080
      FEATUREBASE_VERBOSE: "true"
      FEATUREBASE_STORAGE_METHOD: boltdb
      FEATUREBASE_COMPUTER_CONFIG_WRITELOGGER_DIR: "/dax-data/writelogger"
      FEATUREBASE_COMPUTER_CONFIG_SNAPSHOTTER_DIR: "/dax-data/snapshotter"
    volumes:
      - "./dax-data/writelogger:/dax-data/writelogger"
      - "./dax-data/snapshotter:/dax-data/snapshotter"
    depends_on:
      - controller
    deploy:
      replicas: 1

  datagen:
    build:
      context: ..
      dockerfile: Dockerfile-datagen
    profiles: [ "datagen" ]
    environment:
      GEN_CUSTOM_CONFIG: "/testdata/keys_ids.yaml"
      GEN_FEATUREBASE_ORG_ID: "testorg"
      GEN_FEATUREBASE_DB_ID: "testdb"
      GEN_USE_SHARD_TRANSACTIONAL_ENDPOINT: "true"
      GEN_SOURCE: "custom"
      GEN_TARGET: "serverless"
      GEN_CONTROLLER_ADDRESS: "controller:8080/controller"
