Skip to content

Commit 6dc7564

Browse files
authored
Add Change Detection
1 parent 36a3fb0 commit 6dc7564

1 file changed

Lines changed: 97 additions & 0 deletions

File tree

ct/changedetection.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
3+
# Copyright (c) 2021-2026 tteck
4+
# Author: tteck (tteckster)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://changedetection.io/ | Github: https://github.com/dgtlmoon/changedetection.io
7+
8+
APP="Change Detection"
9+
var_tags="${var_tags:-monitoring;crawler}"
10+
var_cpu="${var_cpu:-4}"
11+
var_ram="${var_ram:-4096}"
12+
var_disk="${var_disk:-10}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
15+
var_arm64="${var_arm64:-yes}"
16+
var_unprivileged="${var_unprivileged:-1}"
17+
18+
header_info "$APP"
19+
variables
20+
color
21+
catch_errors
22+
23+
function update_script() {
24+
header_info
25+
check_container_storage
26+
check_container_resources
27+
28+
if [[ ! -f /etc/systemd/system/changedetection.service ]]; then
29+
msg_error "No ${APP} Installation Found!"
30+
exit
31+
fi
32+
33+
ensure_dependencies libjpeg-dev
34+
35+
NODE_VERSION="24" setup_nodejs
36+
37+
VENV_PATH="/opt/changedetection/.venv"
38+
CHANGEDETECTION_BIN="${VENV_PATH}/bin/changedetection.io"
39+
40+
PYTHON_VERSION="3.13" setup_uv
41+
42+
if [[ ! -d "$VENV_PATH" || ! -x "$CHANGEDETECTION_BIN" ]]; then
43+
msg_info "Migrating to uv/venv"
44+
rm -rf "$VENV_PATH"
45+
$STD uv venv --clear "$VENV_PATH"
46+
$STD "$VENV_PATH/bin/python" -m ensurepip --upgrade
47+
$STD "$VENV_PATH/bin/python" -m pip install --upgrade pip
48+
$STD "$VENV_PATH/bin/python" -m pip install changedetection.io playwright
49+
msg_ok "Migrated to uv/venv"
50+
else
51+
msg_info "Updating ${APP}"
52+
$STD "$VENV_PATH/bin/python" -m pip install --upgrade changedetection.io playwright
53+
msg_ok "Updated ${APP}"
54+
fi
55+
56+
SERVICE_FILE="/etc/systemd/system/changedetection.service"
57+
if ! grep -q "${VENV_PATH}/bin/changedetection.io" "$SERVICE_FILE"; then
58+
msg_info "Updating systemd service"
59+
sed -i "s|^ExecStart=.*|ExecStart=${VENV_PATH}/bin/changedetection.io -d /opt/changedetection -p 5000|" "$SERVICE_FILE"
60+
$STD systemctl daemon-reload
61+
msg_ok "Updated systemd service"
62+
fi
63+
64+
if [[ -f /etc/systemd/system/browserless.service ]]; then
65+
msg_info "Updating Browserless (Patience)"
66+
$STD git -C /opt/browserless/ fetch --all
67+
$STD git -C /opt/browserless/ reset --hard origin/main
68+
$STD npm update --prefix /opt/browserless
69+
$STD npm ci --include=optional --include=dev --prefix /opt/browserless
70+
$STD /opt/browserless/node_modules/playwright-core/cli.js install --with-deps
71+
# Update Chrome separately, as it has to be done with the force option. Otherwise the installation of other browsers will not be done if Chrome is already installed.
72+
$STD /opt/browserless/node_modules/playwright-core/cli.js install --force chrome
73+
$STD /opt/browserless/node_modules/playwright-core/cli.js install --force msedge
74+
$STD /opt/browserless/node_modules/playwright-core/cli.js install chromium firefox webkit
75+
$STD npm install --prefix /opt/browserless esbuild typescript ts-node @types/node --save-dev
76+
$STD npm run build --prefix /opt/browserless
77+
$STD npm run build:function --prefix /opt/browserless
78+
$STD npm prune production --prefix /opt/browserless
79+
systemctl restart browserless
80+
msg_ok "Updated Browserless"
81+
else
82+
msg_error "No Browserless Installation Found!"
83+
fi
84+
85+
systemctl restart changedetection
86+
msg_ok "Updated successfully!"
87+
exit
88+
}
89+
90+
start
91+
build_container
92+
description
93+
94+
msg_ok "Completed successfully!\n"
95+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
96+
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
97+
echo -e "${GATEWAY}${BGN}http://${IP}:5000${CL}"

0 commit comments

Comments
 (0)