Compare commits

...

3 Commits

Author SHA1 Message Date
github-actions[bot]
23f1131c50 Update CHANGELOG.md 2026-10-12 12:13:50 +00:00
community-scripts-pr-app[bot]
093d4edd4b Update CHANGELOG.md (#17883)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-10-12 12:03:18 +00:00
push-app-to-main[bot]
9bf6586611 WatchState (#17881)
* Add watchstate (ct)

* Clean up comments in watchstate.sh

Removed comments about version sorting and Redis cache namespacing.

---------

Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com>
Co-authored-by: CanbiZ (MickLesk) <47820557+MickLesk@users.noreply.github.com>
2026-10-12 14:02:50 +02:00
3 changed files with 184 additions and 0 deletions

View File

@@ -564,6 +564,10 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
## 2026-10-12
### 🆕 New Scripts
- WatchState ([#17881](https://github.com/community-scripts/ProxmoxVE/pull/17881))
### 🚀 Updated Scripts
- #### 🐞 Bug Fixes
@@ -573,6 +577,10 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
- Paperless-ngx: QoL restart crashed services | patch regex [@MickLesk](https://github.com/MickLesk) ([#17812](https://github.com/community-scripts/ProxmoxVE/pull/17812))
- Splunk Enterprise: start the service as the splunk user [@rcastley](https://github.com/rcastley) ([#17816](https://github.com/community-scripts/ProxmoxVE/pull/17816))
### 💾 Core
- gh: curl_download: wait between attempts [@MickLesk](https://github.com/MickLesk) ([core#131](https://github.com/community-scripts/core/pull/131))
### 🧰 Tools
- #### ✨ New Features

77
ct/watchstate.sh Normal file
View File

@@ -0,0 +1,77 @@
#!/usr/bin/env bash
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/arabcoders/watchstate
APP="WatchState"
var_tags="${var_tags:-media;plex;jellyfin;emby}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-6}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
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/watchstate ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "watchstate" "arabcoders/watchstate" "" "" "v"; then
msg_info "Stopping WatchState"
systemctl stop watchstate-worker php8.5-fpm
msg_ok "Stopped WatchState"
create_backup /opt/watchstate/.env
setup_composer
NODE_VERSION="24" NODE_MODULE="bun" setup_nodejs
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "watchstate" "arabcoders/watchstate" "tarball" "latest" "/opt/watchstate" "" "v"
restore_backup
msg_info "Building WatchState"
cd /opt/watchstate
sed -i "s/'version' => 'dev-master'/'version' => 'v$(cat ~/.watchstate)'/" config/config.php
$STD composer install --no-dev --optimize-autoloader --no-interaction
cd /opt/watchstate/frontend
$STD bun install --frozen-lockfile --production
NODE_ENV=production $STD bun run generate
mv /opt/watchstate/frontend/exported /opt/watchstate/public/exported
rm -rf /opt/watchstate/frontend/node_modules /opt/watchstate/frontend/.nuxt
msg_ok "Built WatchState"
msg_info "Migrating WatchState Database"
$STD php /opt/watchstate/bin/console db:migrate --execute
$STD php /opt/watchstate/bin/console db:index
chown -R www-data:www-data /opt/watchstate_data
msg_ok "Migrated WatchState Database"
msg_info "Starting WatchState"
systemctl start php8.5-fpm watchstate-worker
msg_ok "Started WatchState"
msg_ok "Updated successfully!"
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 "${GATEWAY}${BGN}http://${IP}:8080${CL}"

View File

@@ -0,0 +1,99 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/arabcoders/watchstate
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
nginx \
redis-server \
ripgrep \
sqlite3
msg_ok "Installed Dependencies"
PHP_VERSION="8.5" PHP_FPM="YES" setup_php
setup_composer
setup_ffmpeg
NODE_VERSION="24" NODE_MODULE="bun" setup_nodejs
fetch_and_deploy_gh_release "watchstate" "arabcoders/watchstate" "tarball" "latest" "/opt/watchstate" "" "v"
msg_info "Building WatchState"
cd /opt/watchstate
sed -i "s/'version' => 'dev-master'/'version' => 'v$(cat ~/.watchstate)'/" config/config.php
$STD composer install --no-dev --optimize-autoloader --no-interaction
cd /opt/watchstate/frontend
$STD bun install --frozen-lockfile --production
NODE_ENV=production $STD bun run generate
mv /opt/watchstate/frontend/exported /opt/watchstate/public/exported
rm -rf /opt/watchstate/frontend/node_modules /opt/watchstate/frontend/.nuxt
msg_ok "Built WatchState"
msg_info "Configuring WatchState"
# loaded first by CLI, worker and php-fpm alike; the default data dir is /opt/watchstate/var, which every update wipes
cat <<EOF >/opt/watchstate/.env
WS_DATA_PATH=/opt/watchstate_data
EOF
$STD php /opt/watchstate/bin/console db:migrate --execute
$STD php /opt/watchstate/bin/console system:apikey
chown -R www-data:www-data /opt/watchstate_data
msg_ok "Configured WatchState"
msg_info "Configuring Nginx"
PHP_SOCK=$(get_php_fpm_socket)
cat <<EOF >/etc/nginx/sites-available/watchstate
server {
listen 8080;
server_name _;
root /opt/watchstate/public;
index index.php;
client_max_body_size 100M;
location / {
try_files \$uri /index.php\$is_args\$args;
}
location ~ \.php\$ {
fastcgi_pass unix:${PHP_SOCK};
fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 600;
}
}
EOF
nginx_enable_site "watchstate"
msg_ok "Configured Nginx"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/watchstate-worker.service
[Unit]
Description=WatchState Worker
After=network.target redis-server.service
[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/opt/watchstate
ExecStart=/usr/bin/php /opt/watchstate/bin/console system:worker -v
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now watchstate-worker
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc