Compare commits

...

42 Commits

Author SHA1 Message Date
CanbiZ
f9281d3b3a
Merge pull request #965 from HydroshieldMKII/add-guardian-app
Add guardian app
2025-10-01 16:34:29 +02:00
Vincent
d6b981a1b2 Update guardian.sh to source build.func from the correct repository 2025-10-01 10:33:56 -04:00
HydroshieldMKII
8137614d6b Reverted changes in build and install 2025-10-01 10:32:31 -04:00
Slaviša Arežina
1a6c5dbf76
Delete misc/build.func 2025-10-01 15:45:17 +02:00
Slaviša Arežina
b074b25daa
Delete misc/install.func 2025-10-01 15:44:47 +02:00
Slaviša Arežina
e7a9bc04c6
Update guardian-install.sh 2025-10-01 15:44:13 +02:00
Slaviša Arežina
07cc74b074
Update guardian.json 2025-10-01 15:41:31 +02:00
Slaviša Arežina
660d8a21cb
Update guardian.sh 2025-10-01 15:39:34 +02:00
HydroshieldMKII
18c3b2979d Refactor build messages in guardian-install.sh for consistency 2025-10-01 09:36:16 -04:00
HydroshieldMKII
8d44bed6c5 Refactor frontend build process to export DEPLOYMENT_MODE before running npm build 2025-10-01 09:35:51 -04:00
HydroshieldMKII
7a8f1aa0ff Fix case sensitivity in Guardian paths across scripts 2025-10-01 09:10:20 -04:00
HydroshieldMKII
ed6f915b9f temporary edit build and install.func for testing 2025-10-01 09:06:58 -04:00
Vincent
9798c7d6c9 Updated install and update script for PR request. Update the json for the interface 2025-10-01 08:52:27 -04:00
Vincent
64d22d0048
Update script URL for LXC container installation 2025-09-30 18:23:48 -04:00
HydroshieldMKII
d7a1ccd59f Update build and install scripts to source functions from the main community repository 2025-09-30 18:20:46 -04:00
HydroshieldMKII
d8b1ee6c73 Update guardian.sh to source build functions from the correct repository location 2025-09-30 18:15:22 -04:00
HydroshieldMKII
12659a9357 Fix update message to display version without 'v' prefix 2025-09-30 18:13:20 -04:00
HydroshieldMKII
9b1c5d4af0 Fix update message to display version without 'v' prefix 2025-09-30 18:11:59 -04:00
HydroshieldMKII
462c71c457 Update script to source functions from new repository location for consistency 2025-09-30 18:04:40 -04:00
HydroshieldMKII
e8e630c841 Refactor update_script function to replace Docker commands with systemctl for service management and enhance database backup/restore process 2025-09-30 17:41:22 -04:00
HydroshieldMKII
aa2649a933 Refactor guardian-install.sh to remove npm installation and ensure proper dependency setup 2025-09-30 17:34:25 -04:00
HydroshieldMKII
b4646fbd78 Refactor guardian-install.sh to simplify dependency installation and ensure DEPLOYMENT_MODE is set for frontend service 2025-09-30 17:25:41 -04:00
HydroshieldMKII
e9d9d03aa8 Refactor guardian-install.sh to streamline dependency installation by removing npm and ensuring proper package installation order 2025-09-30 17:15:40 -04:00
HydroshieldMKII
a4cc08a194 Remove NODE_ENV and PORT environment variables from frontend and backend service configurations 2025-09-30 17:13:29 -04:00
HydroshieldMKII
a533865a80 Remove DEPLOYMENT_MODE environment variable from frontend service configuration 2025-09-30 17:13:02 -04:00
HydroshieldMKII
fa4e953f72 Update guardian-install.sh to set DEPLOYMENT_MODE for frontend build 2025-09-30 17:12:48 -04:00
HydroshieldMKII
f6a8eed717 Reduce CPU allocation to 2 for Guardian installation and update environment variables for production deployment 2025-09-30 17:04:50 -04:00
Vincent
d30d512091 Update installation scripts to use HydroshieldMKII repository for Guardian app setup 2025-09-30 16:40:35 -04:00
Vincent
385931094c Refactor Guardian installation script to remove Docker installation, streamline dependency setup, and enhance service management for backend and frontend 2025-09-30 16:38:39 -04:00
Vincent
a4420750bd Update URLs in build.func and install.func to use community-scripts repository 2025-09-30 16:20:09 -04:00
Vincent
e48f2c35a8 Update Guardian installation and update scripts to use example docker-compose.yml and remove unnecessary comments 2025-09-30 16:10:18 -04:00
Vincent
544150a57a Update docker-compose.yml download link to use the example file for Guardian setup 2025-09-30 15:59:05 -04:00
Vincent
467a81b1e8 Refactor Guardian installation and update process to utilize Docker Compose, streamline dependency installation, and enhance service management 2025-09-30 15:56:23 -04:00
Vincent
8076c313df Remove redundant cleanup comment from guardian-install.sh 2025-09-30 15:43:27 -04:00
Vincent
7f876d101d Refactor update_script and installation process for Guardian to enhance backup handling, streamline frontend build, and improve service configurations 2025-09-30 15:42:50 -04:00
Vincent
c9f81a23c5 Enhance database backup and restore functionality during Guardian updates 2025-09-30 15:29:39 -04:00
Vincent
f48609011b Refactor frontend setup in guardian-install.sh to streamline installation process and update service configuration 2025-09-30 15:11:18 -04:00
Vincent
c520602fcb Strip 'v' prefix from RELEASE in Guardian installation scripts for consistent folder naming 2025-09-30 14:51:54 -04:00
Vincent
bf38566ff8 Update script sources to use new repository paths for improved functionality 2025-09-30 14:47:15 -04:00
Vincent
e3718d5c63 Refactor update_script function to streamline update process and ensure version tracking 2025-09-30 14:36:26 -04:00
Vincent
552959a39b Update Guardian installation and update scripts to use new repository paths and improve dependency management 2025-09-30 14:36:17 -04:00
Vincent
f5affeda71 Init app install + json + default ct update 2025-09-22 15:46:17 -04:00
3 changed files with 188 additions and 0 deletions

79
ct/guardian.sh Executable file
View File

@ -0,0 +1,79 @@
#!/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: HydroshieldMKII
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/HydroshieldMKII/Guardian
APP="Guardian"
var_tags="${var_tags:-media;monitoring}"
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_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/guardian" ]] ; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "guardian" "HydroshieldMKII/Guardian" ; then
msg_info "Stopping Services"
systemctl stop guardian-backend guardian-frontend
msg_ok "Stopped Services"
if [[ -f "/opt/guardian/backend/plex-guard.db" ]] ; then
msg_info "Saving Database"
cp "/opt/guardian/backend/plex-guard.db" "/tmp/plex-guard.db.backup"
msg_ok "Database backed up"
fi
cp /opt/guardian/.env /opt
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "guardian" "HydroshieldMKII/Guardian" "tarball" "latest" "/opt/guardian"
mv /opt/.env /opt/guardian
if [[ -f "/tmp/plex-guard.db.backup" ]] ; then
msg_info "Restoring Database"
cp "/tmp/plex-guard.db.backup" "/opt/guardian/backend/plex-guard.db"
rm "/tmp/plex-guard.db.backup"
msg_ok "Database restored"
fi
msg_info "Updating Guardian"
cd /opt/guardian/backend
$STD npm ci
$STD npm run build
cd /opt/guardian/frontend
$STD npm ci
$STD DEPLOYMENT_MODE=standalone npm run build
msg_ok "Updated Guardian"
msg_info "Starting Services"
systemctl start guardian-backend guardian-frontend
msg_ok "Started Services"
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 "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"

View File

@ -0,0 +1,35 @@
{
"name": "Guardian",
"slug": "guardian",
"categories": [
13
],
"date_created": "2025-09-22",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 3000,
"documentation": "https://github.com/HydroshieldMKII/Guardian/blob/main/README.md",
"config_path": "/opt/guardian/.env",
"website": "https://github.com/HydroshieldMKII/Guardian",
"logo": null,
"description": "Guardian is a lightweight companion app for Plex that lets you monitor, approve or block devices in real time. It helps you enforce per-user or global policies, stop unwanted sessions automatically and grant temporary access - all through a simple web interface.",
"install_methods": [
{
"type": "default",
"script": "ct/guardian.sh",
"resources": {
"cpu": 2,
"ram": 2048,
"hdd": 6,
"os": "Debian",
"version": "13"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"notes": []
}

View File

@ -0,0 +1,74 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: HydroshieldMKII
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/HydroshieldMKII/Guardian
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 sqlite3
msg_ok "Installed Dependencies"
NODE_VERSION="24" setup_nodejs
fetch_and_deploy_gh_release "guardian" "HydroshieldMKII/Guardian" "tarball" "latest" "/opt/guardian"
msg_info "Configuring ${APPLICATION}"
cd /opt/guardian/backend
$STD npm ci
$STD npm run build
cd /opt/guardian/frontend
$STD npm ci
export DEPLOYMENT_MODE=standalone
$STD npm run build
msg_ok "Configured {APPLICATION}"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/guardian-backend.service
[Unit]
Description=Guardian Backend
After=network.target
[Service]
WorkingDirectory=/opt/guardian/backend
ExecStart=/usr/bin/node dist/main.js
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
cat <<EOF >/etc/systemd/system/guardian-frontend.service
[Unit]
Description=Guardian Frontend
After=guardian-backend.service network.target
Wants=guardian-backend.service
[Service]
WorkingDirectory=/opt/guardian/frontend
Environment=DEPLOYMENT_MODE=standalone
ExecStart=/usr/bin/npm run start
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now guardian-backend
systemctl enable -q --now guardian-frontend
msg_ok "Created Service"
motd_ssh
customize
apt -y autoremove
apt -y autoclean
apt -y clean
msg_ok "Cleaned"