Skip to content

title Change Detection

Change Detection is used to monitor websites and send notifications for when the websites have changed. I typically use this to be notified of when a new release of an OS image is released.

🛠 Installation

Default Port: 5000

bash -c "$(curl -sL https://github.com/community-scripts/ProxmoxVE/raw/main/ct/changedetection.sh)"
bash -c "$(curl -sL https://github.com/asylumexp/Proxmox/raw/main/ct/changedetection.sh)"

⚙ Config

apt install apprise

Test

apprise -vv -t 'my title' -b 'my notification body' 'mailto://user:[email protected]'

Notification URL List

mailto://user:[email protected]

Traefik

homelab/pve/traefik/conf.d/changedetection.yaml
---
http:
 #region routers 
  routers:
    changedetection:
      entryPoints:
        - "websecure"
      rule: "Host(`cd.l.nicholaswilde.io`)"
      middlewares:
        - default-headers@file
        - https-redirectscheme@file
      tls: {}
      service: changedetection

#endregion
#region services
  services:
    changedetection:
      loadBalancer:
        servers:
          - url: "http://192.168.1.72:5000"
        passHostHeader: true
#endregion

📝 Usage

Monitoring Gitea Releases

To monitor Gitea releases for a repository, use the RSS feed URL format:

https://gitea.com/<owner>/<repo>/releases.rss

Monitoring GitHub Commits

For repositories that do not use releases, you can monitor commits using the Atom feed URL:

https://github.com/<owner>/<repo>/commits.atom

🚀 Upgrade

(
  echo 'bash -c "$(curl -sL https://github.com/community-scripts/ProxmoxVE/raw/main/ct/changedetection.sh)"' | tee -a ~/.bash_aliases && \
  source ~/.bashrc && \
  update
)

🔔 Notifications

  1. Apprise

🤖 Automated LXC Updates

I use ChangeDetection to monitor for new Debian standard releases and automatically trigger a Proxmox LXC template rebuild.

🔑 SSH Key Configuration

The automation requires passwordless SSH access from the ChangeDetection LXC to the Proxmox nodes.

Generate Automation Key

ssh-keygen -t ed25519 -f /root/.ssh/id_pve_automation -N ""

Add to Proxmox Nodes

ssh-copy-id -i /root/.ssh/id_pve_automation root@<pve_node_ip>

⚓ Webhook Setup

The webhook tool listens for HTTP requests from ChangeDetection and executes the trigger script.

Hooks Configuration (pve/changedetection/hooks.json)

[
  {
    "id": "rebuild-amd64",
    "execute-command": "/root/git/nicholaswilde/homelab/pve/changedetection/trigger-lxc-update.sh",
    "command-working-directory": "/root/git/nicholaswilde/homelab/pve/changedetection",
    "pass-arguments-to-command": [
      { "source": "string", "name": "--host" },
      { "source": "string", "name": "192.168.1.141" }
    ]
  },
  {
    "id": "rebuild-arm64",
    "execute-command": "/root/git/nicholaswilde/homelab/pve/changedetection/trigger-lxc-update.sh",
    "command-working-directory": "/root/git/nicholaswilde/homelab/pve/changedetection",
    "pass-arguments-to-command": [
      { "source": "string", "name": "--host" },
      { "source": "string", "name": "192.168.1.66" }
    ]
  }
]

Systemd Service (pve/changedetection/webhook-pve.service)

[Unit]
Description=Webhook Listener for PVE LXC Automation
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/git/nicholaswilde/homelab/pve/changedetection
ExecStart=/usr/bin/webhook -hooks /root/git/nicholaswilde/homelab/pve/changedetection/hooks.json -verbose -port 9000
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Enable Service

cp pve/changedetection/webhook-pve.service /etc/systemd/system/
systemctl enable --now webhook-pve

For general installation and service setup, see the Webhook Tool Documentation.

Trigger Script

The trigger-lxc-update.sh script orchestrates the remote execution of the rebuild process on the specified Proxmox host.

Location: pve/changedetection/trigger-lxc-update.sh

ChangeDetection.io Setup

To trigger the rebuild when a change is detected:

  1. Edit the watch item for the Debian standard release.
  2. Go to the Notifications tab.
  3. Add the following URL to the Notification URL List:

Notification URL

json://localhost:9000/hooks/rebuild-amd64

Task List

task: Available tasks for this project:
* backup:        Backup ChangeDetection
* clean:         Clean node_modules
* decrypt:       Decrypt scan.db using SOPS
* deps:          Install dependencies
* encrypt:       Encrypt scan.db using SOPS
* export:        Export the task list
* init:          Init app
* mklinks:       Make symlinks
* restart:       Restart ChangeDetection service
* start:         Start ChangeDetection service
* stop:          Stop changedetection service
* update:        Update ChangeDetection
* upgrade:       Upgrade ChangeDetection

🔗 References