From 996ad5aa0eb43c3dd828f60f20e0013238765437 Mon Sep 17 00:00:00 2001 From: Jason Green Date: Thu, 26 Jun 2025 21:16:02 -0700 Subject: [PATCH] Added install script for Scraparr - a Prometheus exporter for *arr applications. --- ct/scraparr.sh | 61 +++++++++++++++++++++++++++ frontend/public/json/scraparr.json | 40 ++++++++++++++++++ install/scraparr-install.sh | 68 ++++++++++++++++++++++++++++++ 3 files changed, 169 insertions(+) create mode 100644 ct/scraparr.sh create mode 100644 frontend/public/json/scraparr.json create mode 100644 install/scraparr-install.sh diff --git a/ct/scraparr.sh b/ct/scraparr.sh new file mode 100644 index 00000000..04ca13ef --- /dev/null +++ b/ct/scraparr.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: JasonGreenC +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/thecfu/scraparr + +APP="Scraparr" +var_tags="${var_tags:-arr;monitoring}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-1024}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/scraparr/ ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating ${APP}" + RELEASE=$(curl -fsSL https://api.github.com/repos/thecfu/scraparr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Stopping Services" + systemctl stop scraparr + msg_ok "Services Stopped" + + msg_info "Updating ${APP} to v${RELEASE}" + temp_file=$(mktemp) + curl -fsSL "https://github.com/thecfu/scraparr/archive/refs/tags/v2.2.2.tar.gz" -o "$temp_file" + tar -zxf "$temp_file" + mv "scrappar-${RELEASE}" /opt/scrappar + pip -q install -r /opt/scrappar/src/scrappar/requirements.txt --root-user-action=ignore + msg_ok "Updated ${APP}" + + msg_info "Starting Service" + systemctl start scraparr + msg_ok "Started Service" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:7100${CL}" diff --git a/frontend/public/json/scraparr.json b/frontend/public/json/scraparr.json new file mode 100644 index 00000000..4502bf2a --- /dev/null +++ b/frontend/public/json/scraparr.json @@ -0,0 +1,40 @@ +{ + "name": "Scraparr", + "slug": "scraparr", + "categories": [ + 14 + ], + "date_created": "2024-05-02", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8989, + "documentation": null, + "website": "https://github.com/thecfu/scraparr", + "logo": "https://github.com/thecfu/scraparr/raw/main/.github/assets/logos/scraparr_logo.svg", + "config_path": "/scraparr/config/config.yaml", + "description": "Scraparr is a Prometheus exporter for the *arr suite (Sonarr, Radarr, Lidarr, etc.). It provides metrics that can be scraped by Prometheus to monitor and visualize the health and performance of your *arr applications.", + "install_methods": [ + { + "type": "default", + "script": "ct/scraparr.sh", + "resources": { + "cpu": 2, + "ram": 1024, + "hdd": 4, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Edit config file then restart the scraparr service: `systemctl restart scraparr`", + "type": "info" + } + ] +} diff --git a/install/scraparr-install.sh b/install/scraparr-install.sh new file mode 100644 index 00000000..388ab78e --- /dev/null +++ b/install/scraparr-install.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: JasonGreenC +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/thecfu/scraparr + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + python3 \ + python3-pip + +msg_ok "Installed Dependencies" + +msg_info "Installing Scraparr" +temp_file=$(mktemp) +RELEASE=$(curl -fsSL https://api.github.com/repos/thecfu/scraparr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +echo "${RELEASE}" >"/opt/Scraparr_version.txt" +curl -fsSL "https://github.com/thecfu/scraparr/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" +tar -zxf "$temp_file" +mv "scraparr-${RELEASE}" /opt/scraparr +pip -q install -r /opt/scraparr/src/scraparr/requirements.txt --root-user-action=ignore +chmod -R 755 /opt/scraparr +mkdir /scraparr && mkdir /scraparr/config +mv /opt/scraparr/config.yaml /scraparr/config/config.yaml +chmod -R 755 /scraparr +msg_ok "Installed Scraparr" + +msg_info "Creating Service" +cat </etc/systemd/system/scraparr.service +[Unit] +Description=Scraparr +Wants=network-online.target +After=network.target + +[Service] +Type=simple +ExecStart=/usr/bin/python3 -m scraparr.scraparr +WorkingDirectory=/opt/scraparr/src +User=root +Restart=always + +[Install] +WantedBy=multi-user.target + +EOF + +systemctl daemon-reload +systemctl enable -q --now scraparr + +msg_ok "Configured Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -f "$temp_file" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"