Files
ProxmoxVE/ct/wizarr.sh
T

107 lines
3.2 KiB
Bash
Raw Normal View History

#!/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
2025-06-19 09:49:27 +02:00
# Author: vhsdream
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/wizarrrr/wizarr
APP="Wizarr"
var_tags="${var_tags:-media;arr}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-1024}"
var_disk="${var_disk:-4}"
var_os="${var_os:-debian}"
2025-10-07 21:40:31 +02:00
var_version="${var_version:-13}"
2026-06-12 00:16:15 +10:00
var_arm64="${var_arm64:-yes}"
2025-06-19 09:49:27 +02:00
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/wizarr ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "wizarr" "wizarrrr/wizarr"; then
2025-10-07 21:40:31 +02:00
msg_info "Stopping Service"
2025-06-19 09:49:27 +02:00
systemctl stop wizarr
2025-10-07 21:40:31 +02:00
msg_ok "Stopped Service"
2025-06-19 09:49:27 +02:00
msg_info "Creating Backup"
BACKUP_FILE="/opt/wizarr_backup_$(date +%F).tar.gz"
$STD tar -czf "$BACKUP_FILE" /opt/wizarr/{.env,start.sh} /opt/wizarr/database/ &>/dev/null
2025-09-10 10:21:52 -04:00
rm -rf /opt/wizarr/migrations/versions/*
2025-06-19 09:49:27 +02:00
msg_ok "Backup Created"
2026-01-07 08:49:12 +01:00
fetch_and_deploy_gh_release "wizarr" "wizarrrr/wizarr" "tarball"
UV_PROJECT_DIR="/opt/wizarr" setup_uv
2025-06-19 09:49:27 +02:00
2025-10-07 21:40:31 +02:00
msg_info "Updating Wizarr"
2026-01-06 13:45:03 +01:00
cd /opt/wizarr
2025-09-10 10:21:52 -04:00
$STD /usr/local/bin/uv sync --frozen
$STD /usr/local/bin/uv run --frozen pybabel compile -d app/translations
2025-06-19 09:49:27 +02:00
$STD npm --prefix app/static install
$STD npm --prefix app/static run build
2025-06-19 09:49:27 +02:00
mkdir -p ./.cache
$STD tar -xf "$BACKUP_FILE" --directory=/
if grep -q 'bind' /opt/wizarr/start.sh; then
WIZARR_PORT=$(awk -F: '{print $2}' /opt/wizarr/start.sh | awk -F' ' '{print $1}' | tr -d '[:space:]')
fi
sed -i -E -e 's/[[:space:]]+/ /g' \
-e 's/--workers 4//' \
-e 's/--bind 0.0.0.0:[0-9]+//' /opt/wizarr/start.sh
KEYS=("FLASK" "WORKERS" "HOST" "PORT")
for key in "${KEYS[@]}"; do
if ! grep -q "$key" /opt/wizarr/.env; then
cat <<EOF >/opt/wizarr/.env
APP_URL=http://${LOCAL_IP}
DISABLE_BUILTIN_AUTH=false
FLASK_ENV=production
GUNICORN_WORKERS=4
HOST=0.0.0.0
PORT=${WIZARR_PORT:-5690}
LOG_LEVEL=info
APP_VERSION=$(cat ~/.wizarr)
EOF
fi
continue
done
sed -i "s/_VERSION=.*$/_VERSION=$(cat ~/.wizarr)/" /opt/wizarr/.env
if grep -q 'abnormal' /etc/systemd/system/wizarr.service; then
sed -i 's/on-abnormal/always \
RestartSec=10 \
KillMode=mixed \
TimeoutStopSec=10/' /etc/systemd/system/wizarr.service
systemctl daemon-reload
2025-09-10 10:21:52 -04:00
fi
rm -rf "$BACKUP_FILE"
export FLASK_SKIP_SCHEDULER=true
$STD /usr/local/bin/uv run --frozen flask db upgrade
2025-10-07 21:40:31 +02:00
msg_ok "Updated Wizarr"
2025-06-19 09:49:27 +02:00
2025-10-07 21:40:31 +02:00
msg_info "Starting Service"
2025-06-19 09:49:27 +02:00
systemctl start wizarr
2025-10-07 21:40:31 +02:00
msg_ok "Started Service"
msg_ok "Updated successfully!"
2025-06-19 09:49:27 +02:00
fi
exit
}
start
build_container
description
2026-01-06 22:57:40 +01:00
msg_ok "Completed successfully!\n"
2025-06-19 09:49:27 +02:00
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}:5690${CL}"