services:
  changedetection:
    networks:
      - traefik
#      - changed
    image: lscr.io/linuxserver/changedetection.io:latest
    container_name: changedetection
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Copenhagen
      - BASE_URL=https://change.knast.cc
      - WEBDRIVER_URL=http://browser-chrome:4444/wd/hub
      - PLAYWRIGHT_DRIVER_URL=ws://playwright-chrome:3000
    volumes:
      - /srv/changedetection/config:/config
    ports:
      - 5000:5000
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.middlewares.auth.basicauth.users=fartin:$$apr1$$zlkymds4$$hQVyOHjZ.hB8TVyCwmetv0"
      - "traefik.http.routers.changedetection.middlewares=auth"
      - "traefik.http.routers.changedetection.entrypoints=websecure"
      - "traefik.http.routers.changedetection.rule=Host(`change.knast.cc`)"
      - "traefik.http.routers.changedetection.tls.certresolver=letsencr"
      - "traefik.http.services.changedetection.loadbalancer.server.port=5000"
    depends_on:
      - browser-chrome
  browser-chrome:
    networks:
      - traefik
    hostname: browser-chrome
    image: selenium/standalone-chrome:4.1.2-20220217
    container_name: browser-chrome
    volumes:
      # Fixes potential memory issues in Chrome
      - /dev/shm:/dev/shm
    restart: unless-stopped

  playwright-chrome:
    hostname: playwright-chrome
    image: dgtlmoon/sockpuppetbrowser:latest
    container_name: playwright-chrome
    cap_add:
      - SYS_ADMIN
    networks:
      - traefik
    restart: unless-stopped
    environment:
      - SCREEN_WIDTH=1920
      - SCREEN_HEIGHT=1024
      - SCREEN_DEPTH=16
      - MAX_CONCURRENT_CHROME_PROCESSES=10
#  selenium:
#    image: selenium/standalone-chrome:latest
#    container_name: selenium
#    hostname: selenium
#    shm_size: 2g
#    ports:
#      - 4444:4444
#      - 7900:7900
#    networks:
#      - changed
#    restart: unless-stopped
#    environment:
#      SE_NODE_MAX_SESSIONS: 4
#      CHROME_OPTIONS: |
#        --window-size=1280,1024
#        --headless
#        --disable-gpu

networks:
  traefik:
    external: true
#  changed:
#    external: false
