version: '2'
services:
  db-rocketchat1:
    image: mongo
    restart: always
    container_name: db-rocketchat1
    hostname: db-rocketchat1
    command: --keyFile /opt/keyfile --replSet "rs0"
    volumes:
      - ./mongo/data1:/data/db
      - ./mongo/mongodb-keyfile:/opt/keyfile
    networks:
      mynet:
        ipv4_address: 172.133.0.99

  db-rocketchat2:
    image: mongo
    restart: always
    container_name: db-rocketchat2
    hostname: db-rocketchat2
    command: --keyFile /opt/keyfile --replSet "rs0"
    volumes:
      - ./mongo/data2:/data/db
      - ./mongo/mongodb-keyfile:/opt/keyfile
    networks:
      mynet:
        ipv4_address: 172.133.0.100

  rocketchat:
    image: rocket.chat
#    build: ./rocketchat
    restart: always
    container_name: rocketchat
    hostname: rocketchat
    extra_hosts:
      - "rocketchat:172.133.0.101"
      - "rocketchat:172.200.0.2"
      - "smtp.hatthieves.es:172.200.0.101"
#    entrypoint:
#      - /bin/bash
#      - /entrypoint.sh
    environment:
      - MONGO_URL=mongodb://db-rocketchat1:27017/rocketchat
      - ROOT_URL=https://talk.hatthieves.es
      - PORT=3000
      - MAIL_URL=smtp.hatthieves.es
      - Accounts_UseDNSDomainCheck=False
      - NODE_ENV=production
      - Accounts_AvatarStorePath=/app/uploads
      - MONGO_URL=mongodb://rocket:p4ssw0rd@db-rocketchat1:27017,db-rocketchat2:27017/rocketchat?authSource=admin&replicaSet=rs0&readPreference=nearest&w=majority
      - MONGO_OPLOG_URL=mongodb://oploguser:p4ssw0rd@db-rocketchat1:27017,db-rocketchat2:27017/local?authSource=admin&replicaSet=rs0
      - INSTANCE_IP=172.133.0.101
    volumes:
#      - ./rocketchat/entrypoint.sh:/entrypoint.sh:ro
      - ./rocketchat/uploads:/app/uploads
#      - ./rocketchat/turnserver.conf:/etc/turnserver.conf:ro
#      - ./rocketchat/coturn:/etc/default/coturn:ro
#      - /opt/docker/secure/privkey.pem:/etc/turn_server_pkey.pem:ro
#      - /opt/docker/secure/fullchain.pem:/etc/turn_server_cert.pem:ro
    links:
      - db-rocketchat1:db-rocketchat1
      - db-rocketchat2:db-rocketchat2
    depends_on:
      - db-rocketchat1
      - db-rocketchat2
    expose:
      - 3000
#    ports:
#      - 3478:3478/tcp
#      - 3478:3478/udp
#      - 5349:5349/tcp
#      - 5349:5349/udp
    networks:
      mynet:
        ipv4_address: 172.133.0.101
      wildduck:

  hubot:
    build: ./hubot
    restart: always
    container_name: hubot
    hostname: hubot
    entrypoint:
      - /bin/bash
      - /entrypoint.sh
#    environment:
#      - ROCKETCHAT_URL=https://talk.hatthieves.es
#      - ROCKETCHAT_ROOM=''
#      - ROCKETCHAT_USER=rocketbot
#      - ROCKETCHAT_PASSWORD=vL6atw8ynmcErpagZ
#      - BOT_NAME=RocketBot
#      - LISTEN_ON_ALL_PUBLIC=true
#      - ROCKETCHAT_AUTH=password
#      - EXTERNAL_SCRIPTS=hubot-help,hubot-seen,hubot-links,hubot-greetings
#      - EXTERNAL_SCRIPTS=hubot-help,hubot-seen,hubot-links,hubot-diagnostics,hubot-google,hubot-reddit,hubot-bofh,hubot-bookmark,hubot-shipit,hubot-maps,hubot-pugme
    volumes:
      - ./hubot/entrypoint.sh:/entrypoint.sh
    links:
      - rocketchat:rocketchat
# this is used to expose the hubot port for notifications on the host on port 3001, e.g. for hubot-jenkins-notifier
    expose:
      - 3001
    networks:
      mynet:
        ipv4_address: 172.133.0.102

  redis:       
    image: redis:alpine
    hostname: redis-rocketchat
    container_name: redis-rocketchat
    restart: always
    volumes:
      - ./redis:/data
    expose:
      - 6379
    networks:            
      mynet:   
        ipv4_address: 172.133.0.103

networks:
  mynet:
    driver: bridge
    ipam:
      config:
      - subnet: 172.133.0.0/24
  wildduck:
    external:
      name: harakawildduck_mynet
