diff --git a/ct/scraparr.sh b/ct/scraparr.sh new file mode 100644 index 00000000..b7eeee7e --- /dev/null +++ b/ct/scraparr.sh @@ -0,0 +1,66 @@ +#!/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 + + 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 "${HOME}/.scrappar" ]] || [[ "${RELEASE}" != "$(cat "${HOME}"/.scrappar)" ]]; then + msg_info "Stopping Services" + systemctl stop scraparr + msg_ok "Services Stopped" + + PYTHON_VERSION="3.12" setup_uv + fetch_and_deploy_gh_release "scrappar" "thecfu/scraparr" "tarball" "latest" "/opt/scraparr" + + msg_info "Updating ${APP} to ${RELEASE}" + cd /opt/scraparr || exit + $STD uv venv /opt/scraparr/.venv + $STD /opt/scraparr/.venv/bin/python -m ensurepip --upgrade + $STD /opt/scraparr/.venv/bin/python -m pip install --upgrade pip + $STD /opt/scraparr/.venv/bin/python -m pip install -r /opt/scraparr/src/scraparr/requirements.txt + chmod -R 755 /opt/scraparr + msg_ok "Updated ${APP} to v${RELEASE}" + + msg_info "Starting Services" + systemctl start scraparr + msg_ok "Services Started" + 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..731618e3 --- /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": 7100, + "documentation": "https://github.com/thecfu/scraparr/blob/main/README.md", + "website": "https://github.com/thecfu/scraparr", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/svg/scraparr-dark.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..4eafe0a6 --- /dev/null +++ b/install/scraparr-install.sh @@ -0,0 +1,56 @@ +#!/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 Scraparr" +PYTHON_VERSION="3.12" setup_uv +fetch_and_deploy_gh_release "scrappar" "thecfu/scraparr" "tarball" "latest" "/opt/scraparr" +cd /opt/scraparr || exit +$STD uv venv /opt/scraparr/.venv +$STD /opt/scraparr/.venv/bin/python -m ensurepip --upgrade +$STD /opt/scraparr/.venv/bin/python -m pip install --upgrade pip +$STD /opt/scraparr/.venv/bin/python -m pip install -r /opt/scraparr/src/scraparr/requirements.txt +chmod -R 755 /opt/scraparr +mkdir -p /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 +WorkingDirectory=/opt/scraparr/src +ExecStart=/opt/scraparr/.venv/bin/python -m scraparr.scraparr +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" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"