version: "3.9"
name: serai-dev

volumes:
  serai:
  serai-alice:
  serai-bob:
  serai-charlie:
  serai-dave:
  serai-eve:
  serai-ferdie:

services:
  # Coin services

  bitcoin:
    profiles:
      - bitcoin
      - coins
    build:
      context: ./coins/bitcoin/
    restart: unless-stopped
    volumes:
      - "./coins/bitcoin/scripts:/scripts"
    entrypoint: /scripts/entry-dev.sh
    # TODO: Use expose, not ports
    ports:
      - "18443:18443"

  ethereum:
    profiles:
      - ethereum
      - coins
    build:
      context: ./coins/ethereum/
    restart: unless-stopped
    volumes:
      - "./coins/ethereum/scripts:/scripts"
    entrypoint: /scripts/entry-dev.sh

  monero:
    profiles:
      - monero
      - coins
    build:
      context: ./coins/monero/
    restart: unless-stopped
    volumes:
      - "./coins/monero/scripts:/scripts"
    entrypoint: /scripts/entry-dev.sh
    # TODO: Use expose, not ports
    ports:
      - "18081:18081"

  # Infrastructure

  message-queue:
    profiles:
      - message-queue
    build:
      context: ../
      dockerfile: ./orchestration/message-queue/Dockerfile
    restart: unless-stopped
    volumes:
      - "./message-queue/scripts:/scripts"
    entrypoint: /scripts/entry-dev.sh
    expose:
      - "2287"

  processor:
    profiles:
      - processor
    build:
      context: ../
      dockerfile: ./orchestration/processor/Dockerfile
    restart: unless-stopped
    volumes:
      - "./processor/scripts:/scripts"
    entrypoint: /scripts/entry-dev.sh

  coordinator:
    profiles:
      - coordinator
    build:
      context: ../
      dockerfile: ./orchestration/coordinator/Dockerfile
    restart: unless-stopped
    volumes:
      - "./coordinator/scripts:/scripts"
    entrypoint: /scripts/entry-dev.sh

  # Serai runtime

  runtime:
    profiles:
      - runtime
    build:
      context: ../
      dockerfile: ./orchestration/runtime/Dockerfile
    entrypoint: |
      sh -c "cd /serai/substrate/runtime && cargo clean && cargo build --release && \
               sha256sum /serai/target/release/wbuild/serai-runtime/serai_runtime.wasm"

  # Serai nodes

  _serai:
    &serai_defaults
    restart: unless-stopped
    # image: serai:dev
    profiles:
      - _
    build:
      context: ../
      dockerfile: ./orchestration/serai/Dockerfile
      args:
        TAG: serai
    entrypoint: /scripts/entry-dev.sh
    volumes:
      - "./serai/scripts:/scripts"

  serai:
    <<: *serai_defaults
    hostname: serai
    profiles:
      - serai
    environment:
      CHAIN: local
      NAME: node

  serai-alice:
    <<: *serai_defaults
    hostname: serai-alice
    profiles:
      - alice
      - cluster-sm
      - cluster-lg
    environment:
      CHAIN: local
      NAME: alice
      VALIDATOR: true

  serai-bob:
    <<: *serai_defaults
    hostname: serai-bob
    profiles:
      - bob
      - cluster-sm
      - cluster-lg
    environment:
      CHAIN: local
      NAME: bob
      VALIDATOR: true

  serai-charlie:
    <<: *serai_defaults
    hostname: serai-charlie
    profiles:
      - charlie
      - cluster-sm
      - cluster-lg
    environment:
      CHAIN: local
      NAME: charlie
      VALIDATOR: true

  serai-dave:
    <<: *serai_defaults
    hostname: serai-dave
    profiles:
      - dave
      - cluster-sm
      - cluster-lg
    environment:
      CHAIN: local
      NAME: dave
      VALIDATOR: true

  serai-eve:
    <<: *serai_defaults
    hostname: serai-eve
    profiles:
      - eve
      - cluster-lg
    environment:
      CHAIN: local
      NAME: eve

  serai-ferdie:
    <<: *serai_defaults
    hostname: serai-ferdie
    profiles:
      - ferdie
      - cluster-lg
    environment:
      CHAIN: local
      NAME: ferdie
