version: "3"

services:
  # hastebin:
  #   image: rlister/hastebin
  #   environment:
  #     STORAGE_TYPE: redis
  #     STORAGE_HOST: hastebinredis
  #   restart: always
  #   labels:
  #     - "traefik.enable=true"
  #     - "traefik.http.routers.hastebin.entrypoints=websecure"
  #     - "traefik.http.routers.hastebin.rule=Host(`haste.$DOMAIN_NAME`)"
  #     - "traefik.http.routers.hastebin.tls.certresolver=letsencr"

  # hastebinredis:
  #   image: redis
  #   restart: always
  #   volumes:
  #     - /srv/hastebin:/data
  #   labels:
  #     - "traefik.enable=false"
  
  xbs_db:
    container_name: "xbs-db"
    environment:
      - "MONGO_INITDB_DATABASE=xbrowsersync"
      - "MONGO_INITDB_ROOT_PASSWORD=$XBS_DB_PASSWORD"
      - "MONGO_INITDB_ROOT_USERNAME=$XBS_DB_USERNAME"
    image: "mongo:4.2.6"
    labels:
      - "traefik.enable=false"
    # networks:
    #   - "xbs-net"
    restart: "unless-stopped"
    volumes:
      - "/srv/xbs/xbs_data:/data/db"
      - "./mongoconfig.js:/docker-entrypoint-initdb.d/mongoconfig.js"

  xbs_api:
    container_name: "xbs-api"
    depends_on:
      - "xbs_db"
    ports:
      - "9191:8080"
    environment:
      - "XBROWSERSYNC_DB_PWD=$XBS_DB_PASSWORD"
      - "XBROWSERSYNC_DB_USER=$XBS_DB_USERNAME"
    image: "xbrowsersync/api:1.1.12"
    labels:
      # - "traefik.port=8080"
        - "traefik.enable=true"
        - "traefik.http.routers.xbs.entrypoints=websecure"
        - "traefik.http.routers.xbs.rule=Host(`xbs.$DOMAIN_NAME`)"
        - "traefik.http.routers.xbs.tls.certresolver=letsencr"
        - "traefik.frontend.rule=Host:$XBS_API_HOSTNAME"
    # networks:
    #   - "xbs-net"
    restart: "unless-stopped"
    volumes:
      - "./settings.json:/usr/src/api/config/settings.json:ro"




networks:
  default:
    external:
      name: $DEFAULT_NETWORK