diff --git a/ct/watcharr.sh b/ct/watcharr.sh new file mode 100644 index 000000000..3290e0735 --- /dev/null +++ b/ct/watcharr.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/sbondCo/Watcharr + +APP="Watcharr" +TAGS="media" +var_cpu="1" +var_ram="1024" +var_disk="4" +var_os="debian" +var_version="12" +var_unprivileged="1" + +header_info "$APP" +base_settings + +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/watcharr ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/sbondCo/Watcharr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Updating $APP" + + msg_info "Stopping $APP" + systemctl stop watcharr + msg_ok "Stopped $APP" + + msg_info "Updating $APP to v${RELEASE}" + temp_file=$(mktemp) + wget -q "https://github.com/sbondCo/Watcharr/archive/refs/tags/v${RELEASE}.tar.gz" -O "$temp_file" + tar -xzf "$temp_file" + rm -f /opt/watcharr/server/watcharr + rm -rf /opt/watcharr/server/ui + mv Watcharr-${RELEASE}/ /opt/watcharr + cd /opt/watcharr + export GOOS=linux + npm i &> /dev/null + npm run build &> /dev/null + mv ./build ./server/ui + cd server + go mod download + go build -o ./watcharr + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting $APP" + systemctl start watcharr + msg_ok "Started $APP" + + msg_info "Cleaning Up" + rm -f ${temp_file} + msg_ok "Cleanup Completed" + + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Update Successful" + 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}:3080${CL}" diff --git a/install/watcharr-install.sh b/install/watcharr-install.sh new file mode 100644 index 000000000..aa3c249df --- /dev/null +++ b/install/watcharr-install.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/sbondCo/Watcharr + +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 \ + curl \ + sudo \ + mc \ + gcc \ + gnupg +msg_ok "Installed Dependencies" + +msg_info "Setup Golang" +set +o pipefail +temp_file=$(mktemp) +golang_tarball=$(curl -s https://go.dev/dl/ | grep -oP 'go[\d\.]+\.linux-amd64\.tar\.gz' | head -n 1) +wget -q https://golang.org/dl/"$golang_tarball" -O "$temp_file" +tar -C /usr/local -xzf "$temp_file" +ln -sf /usr/local/go/bin/go /usr/local/bin/go +rm -f "$temp_file" +set -o pipefail +msg_ok "Setup Golang" + +msg_info "Setup Node.js" +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list +$STD apt-get update +$STD apt-get install -y nodejs +msg_ok "Setup Node.js" + +msg_info "Setup Watcharr" +temp_file=$(mktemp) +RELEASE=$(curl -s https://api.github.com/repos/sbondCo/Watcharr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +wget -q "https://github.com/sbondCo/Watcharr/archive/refs/tags/v${RELEASE}.tar.gz" -O "$temp_file" +tar -xzf "$temp_file" +mv Watcharr-${RELEASE}/ /opt/watcharr +cd /opt/watcharr +$STD npm i +$STD npm run build +mv ./build ./server/ui +cd server +export CGO_ENABLED=1 GOOS=linux +go mod download +go build -o ./watcharr +cat </opt/start.sh +#! /bin/bash +source ~/.bashrc +cd /opt/watcharr/server +./watcharr +EOF +chmod +x /opt/start.sh +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Setup Watcharr" + +msg_info "Creating Service" +cat </etc/systemd/system/watcharr.service +[Unit] +Description=Watcharr Service +After=network.target + +[Service] +WorkingDirectory=/opt/watcharr/server +ExecStart=/opt/start.sh +Restart=always +User=root + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now watcharr +msg_ok "Created 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" \ No newline at end of file diff --git a/json/watcharr.json b/json/watcharr.json new file mode 100644 index 000000000..e2f3476f6 --- /dev/null +++ b/json/watcharr.json @@ -0,0 +1,34 @@ +{ + "name": "Watcharr", + "slug": "watcharr", + "categories": [ + 13 + ], + "date_created": "2025-02-12", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3080, + "documentation": "https://watcharr.app/docs/introduction", + "website": "https://watcharr.app/", + "logo": "https://watcharr.app/img/favicon.png", + "description": "Open source, self-hostable watched list for all your content with user authentication, modern and clean UI and a very simple setup.", + "install_methods": [ + { + "type": "default", + "script": "ct/watcharr.sh", + "resources": { + "cpu": 1, + "ram": 1024, + "hdd": 4, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] +} \ No newline at end of file