2025-11-02 23:49:54 -08:00
#!/usr/bin/env bash
2026-09-02 11:40:00 +02:00
_cs_boot = " ${ COMMUNITY_SCRIPTS_CORE_DIR :-$( dirname " ${ BASH_SOURCE [0] } " ) /../../core } /core/build.func"
source " $_cs_boot " 2>/dev/null || source <( curl -fsSL " ${ COMMUNITY_SCRIPTS_CORE_URL :- https ://raw.githubusercontent.com/community-scripts/core/main } /core/build.func" )
2026-01-06 13:28:12 +01:00
# Copyright (c) 2021-2026 tteck
2026-08-20 14:32:42 +02:00
# Author: tteck (tteckster) | Co-Author: CrazyWolf13, MickLesk
2024-12-16 12:42:51 +01:00
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
2026-02-24 15:11:53 +01:00
# Source: https://changedetection.io/ | Github: https://github.com/dgtlmoon/changedetection.io
2023-03-22 20:48:20 -04:00
APP = "Change Detection"
2025-04-10 11:56:52 +02:00
var_tags = " ${ var_tags :- monitoring ;crawler } "
2025-11-15 20:28:42 +01:00
var_cpu = " ${ var_cpu :- 4 } "
var_ram = " ${ var_ram :- 4096 } "
2025-04-10 11:56:52 +02:00
var_disk = " ${ var_disk :- 10 } "
var_os = " ${ var_os :- debian } "
2026-08-20 14:32:42 +02:00
var_version = " ${ var_version :- 13 } "
2026-06-12 00:16:15 +10:00
var_arm64 = " ${ var_arm64 :- yes } "
2025-04-10 11:56:52 +02:00
var_unprivileged = " ${ var_unprivileged :- 1 } "
2024-12-16 12:42:51 +01:00
header_info " $APP "
2023-03-22 20:48:20 -04:00
variables
color
catch_errors
function update_script() {
2024-12-16 12:42:51 +01:00
header_info
check_container_storage
check_container_resources
2024-12-26 21:34:33 +01:00
2024-12-16 12:42:51 +01:00
if [[ ! -f /etc/systemd/system/changedetection.service ]] ; then
msg_error "No ${ APP } Installation Found!"
exit
fi
2024-12-26 21:34:33 +01:00
2026-09-17 17:59:50 +02:00
ensure_dependencies libjpeg-dev poppler-utils file locales
msg_info "Generating Locales"
for l in cs_CZ de_DE en_GB en_US es_ES fr_FR id_ID it_IT ja_JP ko_KR \
pl_PL pt_BR ru_RU tr_TR uk_UA zh_CN zh_TW; do
sed -i "s/^# * ${ l } .UTF-8 UTF-8/ ${ l } .UTF-8 UTF-8/" /etc/locale.gen
done
$STD locale-gen
if ! grep -q "^LC_ALL=" /opt/changedetection/.env 2>/dev/null; then
echo "LC_ALL=en_US.UTF-8" >>/opt/changedetection/.env
fi
msg_ok "Generated Locales"
2024-12-26 21:34:33 +01:00
2025-09-30 14:16:27 +02:00
NODE_VERSION = "24" setup_nodejs
2026-06-08 06:33:20 +00:00
VENV_PATH = "/opt/changedetection/.venv"
CHANGEDETECTION_BIN = " ${ VENV_PATH } /bin/changedetection.io"
2024-12-26 21:34:33 +01:00
2026-06-08 06:33:20 +00:00
PYTHON_VERSION = "3.13" setup_uv
if [[ ! -d " $VENV_PATH " || ! -x " $CHANGEDETECTION_BIN " ]] ; then
msg_info "Migrating to uv/venv"
rm -rf " $VENV_PATH "
$STD uv venv --clear " $VENV_PATH "
$STD " $VENV_PATH /bin/python" -m ensurepip --upgrade
$STD " $VENV_PATH /bin/python" -m pip install --upgrade pip
$STD " $VENV_PATH /bin/python" -m pip install changedetection.io playwright
msg_ok "Migrated to uv/venv"
else
msg_info "Updating ${ APP } "
$STD " $VENV_PATH /bin/python" -m pip install --upgrade changedetection.io playwright
msg_ok "Updated ${ APP } "
fi
SERVICE_FILE = "/etc/systemd/system/changedetection.service"
if ! grep -q " ${ VENV_PATH } /bin/changedetection.io" " $SERVICE_FILE " ; then
msg_info "Updating systemd service"
sed -i "s|^ExecStart=.*|ExecStart= ${ VENV_PATH } /bin/changedetection.io -d /opt/changedetection -p 5000|" " $SERVICE_FILE "
$STD systemctl daemon-reload
msg_ok "Updated systemd service"
fi
2024-12-26 21:34:33 +01:00
2024-12-16 12:42:51 +01:00
if [[ -f /etc/systemd/system/browserless.service ]] ; then
2024-12-26 21:34:33 +01:00
msg_info "Updating Browserless (Patience)"
2025-02-24 12:49:16 +01:00
$STD git -C /opt/browserless/ fetch --all
$STD git -C /opt/browserless/ reset --hard origin/main
$STD npm update --prefix /opt/browserless
2025-09-30 18:19:01 +03:00
$STD npm ci --include= optional --include= dev --prefix /opt/browserless
2026-09-11 07:39:20 +02:00
$STD npm install --save-exact playwright-core@1.62.1 --prefix /opt/browserless
2025-02-24 12:49:16 +01:00
$STD /opt/browserless/node_modules/playwright-core/cli.js install --with-deps
2024-12-26 21:34:33 +01:00
# 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.
2025-02-24 12:49:16 +01:00
$STD /opt/browserless/node_modules/playwright-core/cli.js install --force chrome
2025-06-23 09:07:49 +02:00
$STD /opt/browserless/node_modules/playwright-core/cli.js install --force msedge
$STD /opt/browserless/node_modules/playwright-core/cli.js install chromium firefox webkit
2025-10-19 22:05:27 +02:00
$STD npm install --prefix /opt/browserless esbuild typescript ts-node @types/node --save-dev
2025-02-24 12:49:16 +01:00
$STD npm run build --prefix /opt/browserless
$STD npm run build:function --prefix /opt/browserless
$STD npm prune production --prefix /opt/browserless
2024-12-16 12:42:51 +01:00
systemctl restart browserless
2024-12-26 21:34:33 +01:00
msg_ok "Updated Browserless"
2024-12-16 12:42:51 +01:00
else
msg_error "No Browserless Installation Found!"
fi
2024-12-26 21:34:33 +01:00
2024-12-16 12:42:51 +01:00
systemctl restart changedetection
2025-10-30 09:24:16 -07:00
msg_ok "Updated successfully!"
2024-12-16 12:42:51 +01:00
exit
2023-03-22 20:48:20 -04:00
}
start
build_container
description
2026-01-06 22:57:40 +01:00
msg_ok "Completed successfully!\n"
2024-12-16 12:42:51 +01:00
echo -e " ${ CREATING }${ GN }${ APP } setup has been successfully initialized! ${ CL } "
2026-06-03 11:03:13 +02:00
echo -e " ${ INFO }${ YW } Access it using the following URL: ${ CL } "
echo -e " ${ GATEWAY }${ BGN } http:// ${ IP } :5000 ${ CL } "