Skip to content

Commit c548c3b

Browse files
authored
New Script: Watcharr (#2243)
* add watcharr script * fix author name
1 parent 0877e6a commit c548c3b

File tree

3 files changed

+207
-0
lines changed

3 files changed

+207
-0
lines changed

ct/watcharr.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/sbondCo/Watcharr
7+
8+
APP="Watcharr"
9+
TAGS="media"
10+
var_cpu="1"
11+
var_ram="1024"
12+
var_disk="4"
13+
var_os="debian"
14+
var_version="12"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
base_settings
19+
20+
variables
21+
color
22+
catch_errors
23+
24+
function update_script() {
25+
header_info
26+
check_container_storage
27+
check_container_resources
28+
if [[ ! -d /opt/watcharr ]]; then
29+
msg_error "No ${APP} Installation Found!"
30+
exit
31+
fi
32+
RELEASE=$(curl -s https://api.github.com/repos/sbondCo/Watcharr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
33+
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
34+
msg_info "Updating $APP"
35+
36+
msg_info "Stopping $APP"
37+
systemctl stop watcharr
38+
msg_ok "Stopped $APP"
39+
40+
msg_info "Updating $APP to v${RELEASE}"
41+
temp_file=$(mktemp)
42+
wget -q "https://github.com/sbondCo/Watcharr/archive/refs/tags/v${RELEASE}.tar.gz" -O "$temp_file"
43+
tar -xzf "$temp_file"
44+
rm -f /opt/watcharr/server/watcharr
45+
rm -rf /opt/watcharr/server/ui
46+
mv Watcharr-${RELEASE}/ /opt/watcharr
47+
cd /opt/watcharr
48+
export GOOS=linux
49+
npm i &> /dev/null
50+
npm run build &> /dev/null
51+
mv ./build ./server/ui
52+
cd server
53+
go mod download
54+
go build -o ./watcharr
55+
msg_ok "Updated $APP to v${RELEASE}"
56+
57+
msg_info "Starting $APP"
58+
systemctl start watcharr
59+
msg_ok "Started $APP"
60+
61+
msg_info "Cleaning Up"
62+
rm -f ${temp_file}
63+
msg_ok "Cleanup Completed"
64+
65+
echo "${RELEASE}" >/opt/${APP}_version.txt
66+
msg_ok "Update Successful"
67+
else
68+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
69+
fi
70+
exit
71+
}
72+
73+
start
74+
build_container
75+
description
76+
77+
msg_ok "Completed Successfully!\n"
78+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
79+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
80+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3080${CL}"

install/watcharr-install.sh

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: Slaviša Arežina (tremor021)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/sbondCo/Watcharr
7+
8+
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt-get install -y \
18+
curl \
19+
sudo \
20+
mc \
21+
gcc \
22+
gnupg
23+
msg_ok "Installed Dependencies"
24+
25+
msg_info "Setup Golang"
26+
set +o pipefail
27+
temp_file=$(mktemp)
28+
golang_tarball=$(curl -s https://go.dev/dl/ | grep -oP 'go[\d\.]+\.linux-amd64\.tar\.gz' | head -n 1)
29+
wget -q https://golang.org/dl/"$golang_tarball" -O "$temp_file"
30+
tar -C /usr/local -xzf "$temp_file"
31+
ln -sf /usr/local/go/bin/go /usr/local/bin/go
32+
rm -f "$temp_file"
33+
set -o pipefail
34+
msg_ok "Setup Golang"
35+
36+
msg_info "Setup Node.js"
37+
mkdir -p /etc/apt/keyrings
38+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
39+
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
40+
$STD apt-get update
41+
$STD apt-get install -y nodejs
42+
msg_ok "Setup Node.js"
43+
44+
msg_info "Setup Watcharr"
45+
temp_file=$(mktemp)
46+
RELEASE=$(curl -s https://api.github.com/repos/sbondCo/Watcharr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
47+
wget -q "https://github.com/sbondCo/Watcharr/archive/refs/tags/v${RELEASE}.tar.gz" -O "$temp_file"
48+
tar -xzf "$temp_file"
49+
mv Watcharr-${RELEASE}/ /opt/watcharr
50+
cd /opt/watcharr
51+
$STD npm i
52+
$STD npm run build
53+
mv ./build ./server/ui
54+
cd server
55+
export CGO_ENABLED=1 GOOS=linux
56+
go mod download
57+
go build -o ./watcharr
58+
cat <<EOF >/opt/start.sh
59+
#! /bin/bash
60+
source ~/.bashrc
61+
cd /opt/watcharr/server
62+
./watcharr
63+
EOF
64+
chmod +x /opt/start.sh
65+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
66+
msg_ok "Setup Watcharr"
67+
68+
msg_info "Creating Service"
69+
cat <<EOF >/etc/systemd/system/watcharr.service
70+
[Unit]
71+
Description=Watcharr Service
72+
After=network.target
73+
74+
[Service]
75+
WorkingDirectory=/opt/watcharr/server
76+
ExecStart=/opt/start.sh
77+
Restart=always
78+
User=root
79+
80+
[Install]
81+
WantedBy=multi-user.target
82+
EOF
83+
systemctl enable -q --now watcharr
84+
msg_ok "Created Service"
85+
86+
motd_ssh
87+
customize
88+
89+
msg_info "Cleaning up"
90+
rm -f "$temp_file"
91+
$STD apt-get -y autoremove
92+
$STD apt-get -y autoclean
93+
msg_ok "Cleaned"

json/watcharr.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Watcharr",
3+
"slug": "watcharr",
4+
"categories": [
5+
13
6+
],
7+
"date_created": "2025-02-12",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 3080,
12+
"documentation": "https://watcharr.app/docs/introduction",
13+
"website": "https://watcharr.app/",
14+
"logo": "https://watcharr.app/img/favicon.png",
15+
"description": "Open source, self-hostable watched list for all your content with user authentication, modern and clean UI and a very simple setup.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/watcharr.sh",
20+
"resources": {
21+
"cpu": 1,
22+
"ram": 1024,
23+
"hdd": 4,
24+
"os": "debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)