Skip to content

Instantly share code, notes, and snippets.

@rigwild
Last active August 3, 2024 10:40
Show Gist options
  • Save rigwild/ee4668f78ca816c7c1f43bf75c0f4533 to your computer and use it in GitHub Desktop.
Save rigwild/ee4668f78ca816c7c1f43bf75c0f4533 to your computer and use it in GitHub Desktop.
cd /var/www
git clone [email protected]:dgtlmoon/changedetection.io.git
cd changedetection.io

Edit the configuation

nano docker-compose.yml
version: '3.2'
services:
    changedetection:
      image: ghcr.io/dgtlmoon/changedetection.io
      container_name: changedetection
      hostname: changedetection
      volumes:
        - changedetection-data:/datastore
# Configurable proxy list support, see https://github.com/dgtlmoon/changedetection.io/wiki/Proxy-configuration#proxy-list-support
#        - ./proxies.json:/datastore/proxies.json

      environment:
  #        Default listening port, can also be changed with the -p option
        - PORT=49500

  #      - PUID=1000
  #      - PGID=1000
  #
  #       Alternative WebDriver/selenium URL, do not use "'s or 's!
  #      - WEBDRIVER_URL=http://browser-chrome:4444/wd/hub
  #
  #       WebDriver proxy settings webdriver_proxyType, webdriver_ftpProxy, webdriver_noProxy,
  #                                webdriver_proxyAutoconfigUrl, webdriver_autodetect,
  #                                webdriver_socksProxy, webdriver_socksUsername, webdriver_socksVersion, webdriver_socksPassword
  #
  #             https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.common.proxy
  #
  #       Alternative Playwright URL, do not use "'s or 's!
        - PLAYWRIGHT_DRIVER_URL=ws://playwright-chrome:3000/?stealth=1&--disable-web-security=true
  #
  #       Playwright proxy settings playwright_proxy_server, playwright_proxy_bypass, playwright_proxy_username, playwright_proxy_password
  #
  #             https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch-option-proxy
  #
  #        Plain requests - proxy support example.
  #      - HTTP_PROXY=socks5h://10.10.1.10:1080
  #      - HTTPS_PROXY=socks5h://10.10.1.10:1080
  #
  #        An exclude list (useful for notification URLs above) can be specified by with
  #      - NO_PROXY="localhost,192.168.0.0/24"
  #
  #        Base URL of your changedetection.io install (Added to the notification alert)
        - BASE_URL=https://diff.example.com
  #        Respect proxy_pass type settings, `proxy_set_header Host "localhost";` and `proxy_set_header X-Forwarded-Prefix /app;`
  #        More here https://github.com/dgtlmoon/changedetection.io/wiki/Running-changedetection.io-behind-a-reverse-proxy-sub-directory
        - USE_X_SETTINGS=1
  #
  #        Hides the `Referer` header so that monitored websites can't see the changedetection.io hostname.
        - HIDE_REFERER=true
  #
  #        Default number of parallel/concurrent fetchers
  #      - FETCH_WORKERS=10

      # Comment out ports: when using behind a reverse proxy , enable networks: etc.
      ports:
        - 49500:49500
      restart: unless-stopped

     # Used for fetching pages via WebDriver+Chrome where you need Javascript support.
     # Now working on arm64 (needs testing on rPi - tested on Oracle ARM instance)
     # replace image with seleniarm/standalone-chromium:4.0.0-20211213

     # If WEBDRIVER or PLAYWRIGHT are enabled, changedetection container depends on that
     # and must wait before starting (substitute "browser-chrome" with "playwright-chrome" if last one is used)
      depends_on:
          playwright-chrome:
              condition: service_started

     # Used for fetching pages via Playwright+Chrome where you need Javascript support.
     # Note: Playwright/browserless not supported on ARM type devices (rPi etc)
     # RECOMMENDED FOR FETCHING PAGES WITH CHROME
    playwright-chrome:
        hostname: playwright-chrome
        image: browserless/chrome:1.60-chrome-stable
        restart: unless-stopped
        environment:
            - SCREEN_WIDTH=1920
            - SCREEN_HEIGHT=1024
            - SCREEN_DEPTH=16
            - ENABLE_DEBUGGER=false
            - PREBOOT_CHROME=true
            - CONNECTION_TIMEOUT=300000
            - MAX_CONCURRENT_SESSIONS=10
            - CHROME_REFRESH_TIME=600000
            - DEFAULT_BLOCK_ADS=true
            - DEFAULT_STEALTH=true

             Ignore HTTPS errors, like for self-signed certs
            - DEFAULT_IGNORE_HTTPS_ERRORS=true


     # Used for fetching pages via Playwright+Chrome where you need Javascript support.
     # Note: works well but is deprecated, doesnt fetch full page screenshots and other issues
#    browser-chrome:
#        hostname: browser-chrome
#        image: selenium/standalone-chrome:4
#        environment:
#            - VNC_NO_PASSWORD=1
#            - SCREEN_WIDTH=1920
#            - SCREEN_HEIGHT=1080
#            - SCREEN_DEPTH=24
#        volumes:
#            # Workaround to avoid the browser crashing inside a docker container
#            # See https://github.com/SeleniumHQ/docker-selenium#quick-start
#            - /dev/shm:/dev/shm
#        restart: unless-stopped

volumes:
  changedetection-data:

Add nginx configuration

sudo nano /etc/nginx/sites-available/diff.example.com
upstream diff.example.com {
    server 127.0.0.1:49500;
    keepalive 64;
}

server {
    # nginx listens to this
    # uncomment the line if you want nginx to listen on IPv6 address
    #listen [::]:80;

    # the virtual host name of this
    server_name diff.example.com;

    location / {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://diff.example.com;
        proxy_http_version 1.1;
        proxy_pass_request_headers on;
        proxy_set_header Connection "keep-alive";
        proxy_store off;
    }
}

# sudo ln -s /etc/nginx/sites-available/diff.example.com /etc/nginx/sites-enabled/diff.example.com
sudo ln -s /etc/nginx/sites-available/diff.example.com /etc/nginx/sites-enabled/diff.example.com
sudo service nginx restart
sudo certbot
cd /var/www/changedetection.io
docker-compose up -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment