ProxmoxVED/ct/discopanel.sh
2025-11-28 15:51:36 -05:00

75 lines
2.0 KiB
Bash

#!/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: DragoQC
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://discopanel.app/
APP="DiscoPanel"
var_tags="${var_tags:-gaming}"
var_cpu="${var_cpu:-4}"
var_ram="${var_ram:-8096}"
var_disk="${var_disk:-20}"
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/discopanel" ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "discopanel" "nickheyer/discopanel"; then
msg_info "Stopping Service"
systemctl stop discopanel
msg_ok "Stopped Service"
msg_info "Creating Backup"
tar -czf "/opt/discopanel_backup_last.tar.gz" -C "/opt/discopanel/data" discopanel.db .recovery_key servers
msg_ok "Created Backup"
rm -rf /opt/discopanel
CLEAN_INSTALL= 1 fetch_and_deploy_gh_release "discopanel" "nickheyer/discopanel" "tarball" "latest" "/opt/discopanel"
msg_info "Building frontend"
cd /opt/discopanel/web/discopanel
npm install
npm run build
msg_ok "Builded frontend"
msg_info "Building backend"
cd /opt/discopanel
go build -o discopanel cmd/discopanel/main.go
msg_ok "Builded backend"
msg_info "Restoring Data"
tar -xzf "/opt/discopanel_backup_last.tar.gz" -C "/opt/discopanel/data"
msg_ok "Restored Data"
msg_info "Starting Service"
systemctl start discopanel
msg_ok "Started Service"
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}:8080${CL}"