version: "3.7"

services:
  daemon1:
    container_name: testbot_daemon1
    image: bertytech/berty:latest
    restart: always
    entrypoint: sh
    network_mode: bridge
    labels:
      - "traefik.enable=false"
      - "com.centurylinklabs.watchtower.enable=true"
      - 'com.datadoghq.ad.logs=[{"source": "go", "service": "testbot-daemon1"}]'
    # copy "clean" db into run, then start the daemon.
    # be careful if you edit this command, it looks like multiline but will be joined inline.
    command: -xec "
      rm -rf /store/run;
      cp -rf /store/clean /store/run;
      env;
      berty daemon
      -config=/app/config1.txt
      -store.dir=/store/run
      -node.no-notif
      -node.listeners=/ip4/0.0.0.0/tcp/9091/grpc
      -p2p.swarm-listeners=/ip4/0.0.0.0/tcp/6002
      -log.filters=*,-ipfs.*
      -log.format=json
      -node.disable-group-monitor
      ;"
    deploy:
      resources:
        limits:
          memory: 2000M
    volumes:
      - ./data/daemon1:/store
      - .:/app
    ports:
      - 6002:6002
      - 6002:6002/udp

  daemon2:
    container_name: testbot_daemon2
    image: bertytech/berty:latest
    restart: always
    entrypoint: sh
    network_mode: bridge
    labels:
      - "traefik.enable=false"
      - "com.centurylinklabs.watchtower.enable=true"
      - 'com.datadoghq.ad.logs=[{"source": "go", "service": "testbot-daemon2"}]'
    # copy "clean" db into run, then start the daemon.
    # be careful if you edit this command, it looks like multiline but will be joined inline.
    command: -xec "
      rm -rf /store/run;
      cp -rf /store/clean /store/run;
      env;
      berty daemon
      -config=/app/config2.txt
      -store.dir=/store/run
      -node.no-notif
      -node.listeners=/ip4/0.0.0.0/tcp/9091/grpc
      -p2p.swarm-listeners=/ip4/0.0.0.0/tcp/6003,/ip4/0.0.0.0/udp/6003/quic-v1
      -log.filters=*,-ipfs.*
      -log.format=json
      -node.disable-group-monitor
      ;"
    volumes:
      - ./data/daemon2:/store
      - .:/app
    deploy:
      resources:
        limits:
          memory: 2000M
    ports:
      - 6003:6003
      - 6003:6003/udp

  bot:
    container_name: testbot_bot
    image: bertytech/berty:latest
    restart: always
    entrypoint: testbot
    links:
      - daemon1
      - daemon2
    network_mode: bridge
    labels:
      - "traefik.enable=false"
      - "com.centurylinklabs.watchtower.enable=true"
      - 'com.datadoghq.ad.logs=[{"source": "go", "service": "testbot-bot"}]'
    command:
      - -name1=TestBot
      - -name2=TestBot Companion
      - -addr1=daemon1:9091
      - -addr2=daemon2:9091
      - -debug
      - -log-format=json
    depends_on:
      - daemon1
      - daemon2
