From 261f746ff12f7b63992a6c8724b63bd1cf422caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Wed, 24 Dec 2025 14:21:23 +0100 Subject: [PATCH] Reefactor (#10260) --- install/patchmon-install.sh | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/install/patchmon-install.sh b/install/patchmon-install.sh index 7c67adaff..8c9a2d8a2 100644 --- a/install/patchmon-install.sh +++ b/install/patchmon-install.sh @@ -22,24 +22,9 @@ msg_ok "Installed Dependencies" NODE_VERSION="24" setup_nodejs PG_VERSION="17" setup_postgresql - -msg_info "Setup PostgreSQL Database" -DB_NAME=patchmon_db -DB_USER=patchmon_usr -DB_PASS="$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13)" -$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" -$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER ENCODING 'UTF8' TEMPLATE template0;" -$STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET client_encoding TO 'utf8';" -$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;" -{ - echo "PatchMon Credentials" - echo "PatchMon Database Name: $DB_NAME" - echo "PatchMon Database User: $DB_USER" - echo "PatchMon Database Password: $DB_PASS" -} >>~/patchmon.creds -msg_ok "Setup PostgreSQL Database" - +PG_DB_NAME="patchmon_db" PG_DB_USER="patchmon_usr" setup_postgresql_db fetch_and_deploy_gh_release "PatchMon" "PatchMon/PatchMon" "tarball" "latest" "/opt/patchmon" +import_local_ip msg_info "Configuring PatchMon" cd /opt/patchmon @@ -50,12 +35,10 @@ $STD npm install --no-audit --no-fund --no-save --ignore-scripts cd /opt/patchmon/frontend $STD npm install --include=dev --no-audit --no-fund --no-save --ignore-scripts $STD npm run build - JWT_SECRET="$(openssl rand -base64 64 | tr -d "=+/" | cut -c1-50)" -LOCAL_IP="$(hostname -I | awk '{print $1}')" cat </opt/patchmon/backend/.env # Database Configuration -DATABASE_URL="postgresql://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME" +DATABASE_URL="postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME" PY_THRESHOLD=3M_DB_CONN_MAX_ATTEMPTS=30 PM_DB_CONN_WAIT_INTERVAL=2 @@ -272,7 +255,6 @@ async function updateSettings() { updateSettings(); EOF - cd /opt/patchmon/backend $STD node update-settings.js msg_ok "Settings updated successfully"