version: '3'

services:
  milvert:
    container_name: milvert
    image: nginx:latest
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"
    restart: always
    networks:
      - backend
    ports:
      - 8004:80
    labels:
      - diun.enable=true
      - "traefik.enable=true"
      - "traefik.http.routers.milvertcom-secure.entrypoints=web-secure"
      - "traefik.http.routers.milvertcom-secure.middlewares=default-headers@file"
      - "traefik.http.routers.milvertcom-secure.rule=Host(`${DOMAIN}`)"
      - "traefik.http.routers.milvertcom-secure.tls.certresolver=milvert_dns"
      - "traefik.http.routers.milvertcom-secure.tls=true"
      #- "traefik.http.routers.milvert-secure.priority=1"
    volumes:
      - "${DIR_LOCAL}/milvert-nginx/conf:/etc/nginx/conf.d"
      - "${DIR_LOCAL}/milvert-nginx/html:/html"

  whoami:
    # A container that exposes an API to show its IP address
    container_name: whoami
    image: containous/whoami
    networks:
      - backend
    ports:
      - 8005:80
    labels:
      - diun.enable=true
      - "traefik.enable=true"
      - "traefik.http.routers.whoami-secure.entrypoints=web-secure"
      - "traefik.http.routers.whoami-secure.rule=Host(`whoami.${DOMAIN}`)"
      - "traefik.http.routers.whoami-secure.tls.certresolver=milvert_dns"
      - "traefik.http.routers.whoami-secure.tls=true"
      #  - "traefik.http.routers.whoami-secure.middlewares=no-chain-auth@file"
      - "traefik.http.routers.whoami-secure.middlewares=chain-authelia@file"

  ttrss:
    # A container that exposes an API to show its IP address
    container_name: ttrss
    image: wangqiru/ttrss:latest
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"
    restart: unless-stopped
    networks:
      - backend
    environment:
      - PUID=${UID}
      - PGID=${GID}
      - SELF_URL_PATH=https://rss.milvert.com
      - DB_USER=${RSS_USERNAME}
      - DB_NAME=${RSS_USERNAME}
      - DB_PASS=${RSS_PASSWORD}
      - DB_HOST=postgres
      - DB_PORT=5432
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.rss-secure.entrypoints=web-secure"
      - "traefik.http.routers.rss-secure.rule=Host(`rss.${DOMAIN}`)"
      - "traefik.http.routers.rss-secure.tls.certresolver=milvert_dns"
      - "traefik.http.routers.rss-secure.tls=true"

  diak:
    image: diak:1.0
    build: ./diabets_app/client
    container_name: diak
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"
    networks:
      - backend
    ports:
      - 8003:80
        #devices:
        #- path to device:path to device
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.diak-secure.entrypoints=web-secure"
      - "traefik.http.routers.diak-secure.rule=Host(`diak.${DOMAIN}`)"
      - "traefik.http.routers.diak-secure.tls.certresolver=milvert_dns"
      - "traefik.http.routers.diak-secure.tls=true"



  syncthing:
    image: linuxserver/syncthing
    container_name: syncthing
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Stockholm
      - UMASK_SET=022
    volumes:
      - /mnt/johanna_backup/syncthing/config:/config
      - /mnt/johanna_backup/data1:/data1
      - /mnt/johanna_backup/data2:/data2
    ports:
      - 8384:8384
      - 22000:22000
      - 21027:21027/udp
    networks:
      - frontend
      - backend
    restart: unless-stopped
    labels:
      - diun.enable=true
      - "traefik.enable=true"
      - "traefik.http.routers.sync_johanna-secure.entrypoints=web-secure"
      - "traefik.http.routers.sync_johanna-secure.rule=Host(`sync.${DOMAIN}`)"
      - "traefik.http.routers.sync_johanna-secure.tls.certresolver=milvert_dns"
      - "traefik.http.routers.sync_johanna-secure.tls=true"

  torrent:
    image: linuxserver/rutorrent
    container_name: torrent
    logging:
      driver: "json-file"
      options:
        max-size: "5m"
        max-file: "3"
    environment:
      - PUID=1000
      - PGID=1000
    networks:
      - backend
    ports:
      - 51413:51413
      - 6881:6881/udp
    volumes:
      - ./torrent/config:/config
      - /media/NAS:/downloads
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.torrent-secure.entrypoints=web-secure"
      - "traefik.http.routers.torrent-secure.rule=Host(`torrent.${DOMAIN}`)"
      - "traefik.http.routers.torrent-secure.tls.certresolver=milvert_dns"
      - "traefik.http.routers.torrent-secure.tls=true"


  librespeed:
    image: ghcr.io/linuxserver/librespeed
    container_name: librespeed
    environment:
      - PUID=${UUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - PASSWORD=${LIBRESPEED_PW}
      - CUSTOM_RESULTS=false
      - DB_TYPE=sqlite
    volumes:
      - ./librespeed/config:/config
    restart: unless-stopped
    networks:
      - backend
    labels:
      - diun.enable=true
      - "traefik.enable=true"
      - "traefik.http.routers.librespeed.entrypoints=web-secure"
      - "traefik.http.routers.librespeed.rule=Host(`librespeed.${DOMAIN}`)"
      - "traefik.http.routers.librespeed.tls.certresolver=milvert_dns"
      - "traefik.http.routers.librespeed.tls=true"


networks:
  frontend:
    external: true
  backend:
    external: false

