version: '3.7'

services:
  daemon:
    container_name: welcomebot_daemon
    image: bertytech/berty:latest
    restart: always
    entrypoint: berty
    environment:
    command:
      - daemon
      - -config=/app/config.txt
      - -p2p.swarm-listeners=/ip4/0.0.0.0/tcp/6001,/ip4/0.0.0.0/udp/6001/quic-v1
      - -node.listeners=/ip4/0.0.0.0/tcp/9091/grpc
      - -metrics.listener=:8888
      - -store.dir=/store/run
      - -node.no-notif=true
      - -log.filters=*,-ipfs*
      - -log.format=json
    network_mode: bridge
    environment:
      - DAEMON_DOMAIN_MAIN
      - DAEMON_DOMAIN_SANS
    volumes:
      - ./data/daemon:/store
      - .:/app
    ports:
      - 6001:6001
      - 6001:6001/udp
    expose:
      - 8888
    deploy:
     resources:
       limits:
         memory: 2000M
    labels:
      - 'com.centurylinklabs.watchtower.enable=true'
      - 'traefik.enable=true'
      - "traefik.http.routers.welcomebot.rule=Host(`${DAEMON_DOMAIN_SANS}`)"
      - 'traefik.http.routers.welcomebot.service=welcomebot'
      - "traefik.http.routers.welcomebot.middlewares=bauth@docker"
      - 'traefik.http.routers.welcomebot.entryPoints=https'
      - 'traefik.http.routers.welcomebot.tls=true'
      - 'traefik.http.routers.welcomebot.tls.certresolver=cf'
      - "traefik.http.routers.welcomebot.tls.domains[0].main=${DAEMON_DOMAIN_MAIN}"
      - "traefik.http.routers.welcomebot.tls.domains[0].sans=${DAEMON_DOMAIN_SANS}"
      - 'traefik.http.services.welcomebot.loadbalancer.server.port=8888'
      - 'com.datadoghq.ad.logs=[{"source": "go", "service": "welcomebot-daemon"}]'
  bot:
    container_name: welcomebot_bot
    image: bertytech/berty:latest
    restart: always
    entrypoint: welcomebot
    network_mode: bridge
    links:
      - daemon
    labels:
      - 'traefik.enable=false'
      - "com.centurylinklabs.watchtower.enable=true"
      - 'com.datadoghq.ad.logs=[{"source": "go", "service": "welcomebot-bot"}]'
    command:
      - -display-name=Welcomebot
      - -addr=daemon:9091
      - "-staff-conversation-link=${WELCOMEBOT_STAFF_CONVERSATION_LINK}"
      - -store=/data/welcomebot.store
      - -log-format=json
    depends_on:
      - daemon
    volumes:
      - ./data/welcomebot:/data
