Files
ProxmoxVE/install/changedetection-install.sh
T

158 lines
4.2 KiB
Bash
Raw Normal View History

2023-03-22 20:48:20 -04:00
#!/usr/bin/env bash
# Copyright (c) 2021-2026 tteck
# Author: tteck (tteckster) | Co-Author: CrazyWolf13, MickLesk
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://changedetection.io/ | Github: https://github.com/dgtlmoon/changedetection.io
2023-03-22 20:48:20 -04:00
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
2023-03-22 20:48:20 -04:00
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
2023-05-29 09:40:56 -04:00
msg_info "Installing Dependencies (Patience)"
$STD apt install -y \
2023-05-29 09:40:56 -04:00
git \
build-essential \
dumb-init \
2024-03-08 14:17:39 -05:00
libjpeg-dev \
2023-05-29 09:40:56 -04:00
libatk-bridge2.0-0 \
2023-06-23 13:34:16 -04:00
libasound2 \
2023-05-29 09:40:56 -04:00
libatk1.0-0 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libgbm-dev \
libgbm1 \
libgdk-pixbuf-2.0-0 \
2023-05-29 09:40:56 -04:00
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
qpdf \
xdg-utils \
2023-09-01 06:44:41 -04:00
xvfb \
ca-certificates \
locales \
poppler-utils \
file
2023-03-22 20:48:20 -04:00
msg_ok "Installed Dependencies"
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
msg_ok "Generated Locales"
PYTHON_VERSION="3.13" setup_uv
2023-05-29 09:40:56 -04:00
2025-09-30 14:16:27 +02:00
NODE_VERSION="24" setup_nodejs
2023-05-29 09:40:56 -04:00
2023-03-22 20:48:20 -04:00
msg_info "Installing Change Detection"
mkdir -p /opt/changedetection
$STD uv venv --clear /opt/changedetection/.venv
$STD /opt/changedetection/.venv/bin/python -m ensurepip --upgrade
$STD /opt/changedetection/.venv/bin/python -m pip install --upgrade pip
$STD /opt/changedetection/.venv/bin/python -m pip install changedetection.io
cat <<EOF >/opt/changedetection/.env
WEBDRIVER_URL=http://127.0.0.1:4444/wd/hub
PLAYWRIGHT_DRIVER_URL=ws://localhost:3000/chrome?launch=eyJkZWZhdWx0Vmlld3BvcnQiOnsiaGVpZ2h0Ijo3MjAsIndpZHRoIjoxMjgwfSwiaGVhZGxlc3MiOmZhbHNlLCJzdGVhbHRoIjp0cnVlfQ==&blockAds=true
LC_ALL=en_US.UTF-8
EOF
2023-03-22 20:48:20 -04:00
msg_ok "Installed Change Detection"
2023-05-29 09:40:56 -04:00
msg_info "Installing Browserless & Playwright"
mkdir /opt/browserless
$STD /opt/changedetection/.venv/bin/python -m pip install playwright
2024-08-13 08:43:41 -04:00
$STD git clone https://github.com/browserless/chrome /opt/browserless
$STD npm ci --include=optional --include=dev --prefix /opt/browserless
$STD npm install --save-exact playwright-core@1.62.1 --prefix /opt/browserless
$STD /opt/browserless/node_modules/playwright-core/cli.js install --with-deps &>/dev/null
$STD /opt/browserless/node_modules/playwright-core/cli.js install --force chrome &>/dev/null
$STD /opt/browserless/node_modules/playwright-core/cli.js install chromium firefox webkit &>/dev/null
$STD /opt/browserless/node_modules/playwright-core/cli.js install --force msedge
2023-05-29 09:40:56 -04:00
$STD npm run build --prefix /opt/browserless
$STD npm run build:function --prefix /opt/browserless
2023-05-29 09:40:56 -04:00
$STD npm prune production --prefix /opt/browserless
msg_ok "Installed Browserless & Playwright"
msg_info "Installing Font Packages"
$STD apt install -y \
2023-05-29 09:40:56 -04:00
fontconfig \
libfontconfig1 \
fonts-freefont-ttf \
fonts-gfs-neohellenic \
fonts-indic fonts-ipafont-gothic \
fonts-kacst-one fonts-liberation \
2023-05-29 09:40:56 -04:00
fonts-noto-cjk \
fonts-noto-color-emoji \
fonts-roboto \
fonts-thai-tlwg \
fonts-wqy-zenhei
msg_ok "Installed Font Packages"
msg_info "Installing X11 Packages"
$STD apt install -y \
2023-05-29 09:40:56 -04:00
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6
msg_ok "Installed X11 Packages"
msg_info "Creating Services"
2023-03-22 20:48:20 -04:00
cat <<EOF >/etc/systemd/system/changedetection.service
[Unit]
Description=Change Detection
After=network-online.target
2023-05-29 09:40:56 -04:00
After=network.target browserless.service
Wants=browserless.service
2023-03-22 20:48:20 -04:00
[Service]
Type=simple
EnvironmentFile=/opt/changedetection/.env
2023-03-22 20:48:20 -04:00
WorkingDirectory=/opt/changedetection
ExecStart=/opt/changedetection/.venv/bin/changedetection.io -d /opt/changedetection -p 5000
2023-03-22 20:48:20 -04:00
[Install]
WantedBy=multi-user.target
EOF
2023-05-29 09:40:56 -04:00
cat <<EOF >/etc/systemd/system/browserless.service
[Unit]
Description=browserless service
After=network.target
2023-05-29 09:40:56 -04:00
[Service]
Environment=CONNECTION_TIMEOUT=60000
2023-05-29 09:40:56 -04:00
WorkingDirectory=/opt/browserless
2024-09-24 04:50:43 -07:00
ExecStart=/opt/browserless/scripts/start.sh
2023-05-29 09:40:56 -04:00
SyslogIdentifier=browserless
2023-05-29 09:40:56 -04:00
[Install]
WantedBy=default.target
EOF
systemctl enable -q --now browserless
systemctl enable -q --now changedetection
msg_ok "Created Services"
2023-03-22 20:48:20 -04:00
motd_ssh
2023-05-30 01:06:37 -04:00
customize
cleanup_lxc