From 6620fe6a86eb0f58dff974e095ca0dd54417962a Mon Sep 17 00:00:00 2001 From: Phil Date: Sun, 9 Feb 2025 15:44:05 -0700 Subject: [PATCH] add change detection --- dns.yml | 2 + roles/docker/files/Caddyfile | 5 + roles/docker/tasks/changedetection.yml | 19 +++ roles/docker/tasks/main.yml | 10 +- .../templates/changedetection-compose.yml.j2 | 122 ++++++++++++++++++ 5 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 roles/docker/tasks/changedetection.yml create mode 100644 roles/docker/templates/changedetection-compose.yml.j2 diff --git a/dns.yml b/dns.yml index 5501c02..3dcc103 100644 --- a/dns.yml +++ b/dns.yml @@ -35,6 +35,8 @@ ip: "152.53.36.98" - name: habits ip: "152.53.36.98" + - name: watcher + ip: "152.53.36.98" - name: nerder.land dns_records: - name: "forms" diff --git a/roles/docker/files/Caddyfile b/roles/docker/files/Caddyfile index 84ea3c2..b2d576e 100644 --- a/roles/docker/files/Caddyfile +++ b/roles/docker/files/Caddyfile @@ -32,6 +32,9 @@ loclog.thesatelliteoflove.com { reverse_proxy dawarich_app:3000 } +watcher.thesatelliteoflove.com { + reverse_proxy changedetection:5000 +} tasks.thesatelliteoflove.com { reverse_proxy authentik-server-1:9000 @@ -58,6 +61,8 @@ git.thesatelliteoflove.com { } thesatelliteoflove.com { + reverse_proxy /micropub/* micropub_server-micropub-1:5000 + reverse_proxy /micropub micropub_server-micropub-1:5000 root * /srv/tsol file_server } diff --git a/roles/docker/tasks/changedetection.yml b/roles/docker/tasks/changedetection.yml new file mode 100644 index 0000000..417280b --- /dev/null +++ b/roles/docker/tasks/changedetection.yml @@ -0,0 +1,19 @@ +- name: make changedetection directories + ansible.builtin.file: + path: "{{ item}}" + state: directory + loop: + - /opt/stacks/changedetection + +- name: Template out the compose file + ansible.builtin.template: + src: changedetection-compose.yml.j2 + dest: /opt/stacks/changedetection/compose.yml + owner: root + mode: 644 + +- name: deploy changedetection stack + community.docker.docker_compose_v2: + project_src: /opt/stacks/changedetection + files: + - compose.yml \ No newline at end of file diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 8f4a33d..01b8bef 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -146,6 +146,10 @@ import_tasks: dawarich.yml tags: dawarich -- name: Install beaver - import_tasks: beaver.yml - tags: beaver \ No newline at end of file +#- name: Install beaver +# import_tasks: beaver.yml +# tags: beaver + +- name: Install changedetection + import_tasks: changedetection.yml + tags: changedetection \ No newline at end of file diff --git a/roles/docker/templates/changedetection-compose.yml.j2 b/roles/docker/templates/changedetection-compose.yml.j2 new file mode 100644 index 0000000..a736bcb --- /dev/null +++ b/roles/docker/templates/changedetection-compose.yml.j2 @@ -0,0 +1,122 @@ +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=5000 + # + # Log levels are in descending order. (TRACE is the most detailed one) + # Log output levels: TRACE, DEBUG(default), INFO, SUCCESS, WARNING, ERROR, CRITICAL + # - LOGGER_LEVEL=TRACE + # + # 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 target "Chrome" Playwright URL, do not use "'s or 's! + # "Playwright" is a driver/librarythat allows changedetection to talk to a Chrome or similar browser. + - PLAYWRIGHT_DRIVER_URL=ws://sockpuppetbrowser:3000 + # + # 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://watcher.thesatelliteoflove.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 + # + # Absolute minimum seconds to recheck, overrides any watch minimum, change to 0 to disable + # - MINIMUM_SECONDS_RECHECK_TIME=3 + # + # If you want to watch local files file:///path/to/file.txt (careful! security implications!) + # - ALLOW_FILE_URI=False + # + # For complete privacy if you don't want to use the 'check version' / telemetry service + # - DISABLE_VERSION_CHECK=true + # + # A valid timezone name to run as (for scheduling watch checking) see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones + - TZ=America/Denver + + # Comment out ports: when using behind a reverse proxy , enable networks: etc. + # ports: + # - 5000:5000 + 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: + sockpuppetbrowser: + condition: service_started + + + # Sockpuppetbrowser is basically chrome wrapped in an API for allowing fast fetching of web-pages. + # RECOMMENDED FOR FETCHING PAGES WITH CHROME + sockpuppetbrowser: + hostname: sockpuppetbrowser + image: dgtlmoon/sockpuppetbrowser:latest + cap_add: + - SYS_ADMIN +## SYS_ADMIN might be too much, but it can be needed on your platform https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-on-gitlabci + restart: unless-stopped + environment: + - SCREEN_WIDTH=1920 + - SCREEN_HEIGHT=1024 + - SCREEN_DEPTH=16 + - MAX_CONCURRENT_CHROME_PROCESSES=10 + + # Used for fetching pages via Playwright+Chrome where you need Javascript support. + # Note: Works well but is deprecated, does not fetch full page screenshots (doesnt work with Visual Selector) + # Does not report status codes (200, 404, 403) 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: + +networks: + default: + external: true + name: lava