mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-28 05:10:40 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 16d3c1933c | |||
| 608b77a662 | |||
| a7b8259022 | |||
| b226c87a00 | |||
| ea296b59f4 | |||
| 6ab9737137 | |||
| 6044637f12 | |||
| 93a53fe16e | |||
| 5cab784bcb | |||
| 585de1ba0c | |||
| c32ca537f1 | |||
| 424575d8c1 | |||
| 782420b4e4 | |||
| 9b8129abd3 | |||
| 1c169fc7e2 | |||
| f985d84952 | |||
| 88397b48dc |
@@ -448,6 +448,43 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
## 2026-04-28
|
||||||
|
|
||||||
|
### 🚀 Updated Scripts
|
||||||
|
|
||||||
|
- Fix Dawarich Install/Update [@Jerry1098](https://github.com/Jerry1098) ([#14078](https://github.com/community-scripts/ProxmoxVE/pull/14078))
|
||||||
|
|
||||||
|
## 2026-04-27
|
||||||
|
|
||||||
|
### 🚀 Updated Scripts
|
||||||
|
|
||||||
|
- Add pamUsername column to userOrgs table [@JVKeller](https://github.com/JVKeller) ([#14075](https://github.com/community-scripts/ProxmoxVE/pull/14075))
|
||||||
|
|
||||||
|
- #### 🐞 Bug Fixes
|
||||||
|
|
||||||
|
- Dawarich: run db:migrate before assets:precompile [@MickLesk](https://github.com/MickLesk) ([#14051](https://github.com/community-scripts/ProxmoxVE/pull/14051))
|
||||||
|
- TechnitiumDNS: always install .NET 10 if not already present [@MickLesk](https://github.com/MickLesk) ([#14049](https://github.com/community-scripts/ProxmoxVE/pull/14049))
|
||||||
|
|
||||||
|
- #### 💥 Breaking Changes
|
||||||
|
|
||||||
|
- PatchMon: v2.0.0 migration [@vhsdream](https://github.com/vhsdream) ([#14015](https://github.com/community-scripts/ProxmoxVE/pull/14015))
|
||||||
|
|
||||||
|
### 💾 Core
|
||||||
|
|
||||||
|
- #### 🔧 Refactor
|
||||||
|
|
||||||
|
- Update build.func - fixed spelling mistake [@m1ckywill](https://github.com/m1ckywill) ([#14047](https://github.com/community-scripts/ProxmoxVE/pull/14047))
|
||||||
|
|
||||||
|
### 🧰 Tools
|
||||||
|
|
||||||
|
- #### 🐞 Bug Fixes
|
||||||
|
|
||||||
|
- update-lxcs/apps: avoid pct exec on containers mid-shutdown [@MickLesk](https://github.com/MickLesk) ([#14050](https://github.com/community-scripts/ProxmoxVE/pull/14050))
|
||||||
|
|
||||||
|
- #### ✨ New Features
|
||||||
|
|
||||||
|
- Add patchmon-agent report execution in update script [@heinemannj](https://github.com/heinemannj) ([#14054](https://github.com/community-scripts/ProxmoxVE/pull/14054))
|
||||||
|
|
||||||
## 2026-04-26
|
## 2026-04-26
|
||||||
|
|
||||||
### 🆕 New Scripts
|
### 🆕 New Scripts
|
||||||
|
|||||||
+13
-1
@@ -53,6 +53,18 @@ function update_script() {
|
|||||||
export PATH="/root/.rbenv/shims:/root/.rbenv/bin:$PATH"
|
export PATH="/root/.rbenv/shims:/root/.rbenv/bin:$PATH"
|
||||||
eval "$(/root/.rbenv/bin/rbenv init - bash)"
|
eval "$(/root/.rbenv/bin/rbenv init - bash)"
|
||||||
|
|
||||||
|
if ! grep -q "OTP_ENCRYPTION_PRIMARY_KEY" /opt/dawarich/.env; then
|
||||||
|
echo "OTP_ENCRYPTION_PRIMARY_KEY=$(openssl rand -hex 64)" >>/opt/dawarich/.env
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -q "OTP_ENCRYPTION_DETERMINISTIC_KEY" /opt/dawarich/.env; then
|
||||||
|
echo "OTP_ENCRYPTION_DETERMINISTIC_KEY=$(openssl rand -hex 64)" >>/opt/dawarich/.env
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -q "OTP_ENCRYPTION_KEY_DERIVATION_SALT" /opt/dawarich/.env; then
|
||||||
|
echo "OTP_ENCRYPTION_KEY_DERIVATION_SALT=$(openssl rand -hex 64)" >>/opt/dawarich/.env
|
||||||
|
fi
|
||||||
|
|
||||||
set -a && source /opt/dawarich/.env && set +a
|
set -a && source /opt/dawarich/.env && set +a
|
||||||
|
|
||||||
$STD bundle config set --local deployment 'true'
|
$STD bundle config set --local deployment 'true'
|
||||||
@@ -67,8 +79,8 @@ function update_script() {
|
|||||||
$STD npm install
|
$STD npm install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$STD bundle exec rake assets:precompile
|
|
||||||
$STD bundle exec rails db:migrate
|
$STD bundle exec rails db:migrate
|
||||||
|
$STD bundle exec rake assets:precompile
|
||||||
$STD bundle exec rake data:migrate
|
$STD bundle exec rake data:migrate
|
||||||
msg_ok "Ran Migrations"
|
msg_ok "Ran Migrations"
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ function update_script() {
|
|||||||
if [[ -f "$DB" ]]; then
|
if [[ -f "$DB" ]]; then
|
||||||
sqlite3 "$DB" "ALTER TABLE 'orgs' ADD COLUMN 'settingsLogRetentionDaysConnection' integer DEFAULT 0 NOT NULL;" 2>/dev/null || true
|
sqlite3 "$DB" "ALTER TABLE 'orgs' ADD COLUMN 'settingsLogRetentionDaysConnection' integer DEFAULT 0 NOT NULL;" 2>/dev/null || true
|
||||||
sqlite3 "$DB" "ALTER TABLE 'clientSitesAssociationsCache' ADD COLUMN 'isJitMode' integer DEFAULT 0 NOT NULL;" 2>/dev/null || true
|
sqlite3 "$DB" "ALTER TABLE 'clientSitesAssociationsCache' ADD COLUMN 'isJitMode' integer DEFAULT 0 NOT NULL;" 2>/dev/null || true
|
||||||
|
sqlite3 "$DB" "ALTER TABLE 'userOrgs' ADD COLUMN 'pamUsername' text;" 2>/dev/null || true
|
||||||
|
|
||||||
# Create new role-mapping tables and migrate data before drizzle-kit
|
# Create new role-mapping tables and migrate data before drizzle-kit
|
||||||
# drops the roleId columns from userOrgs and userInvites.
|
# drops the roleId columns from userOrgs and userInvites.
|
||||||
|
|||||||
+61
-49
@@ -29,63 +29,75 @@ function update_script() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q "PORT=3001" /opt/patchmon/backend/.env; then
|
RELEASE="v2.0.1"
|
||||||
msg_warn "⚠️ The next PatchMon update will include breaking changes (port changes)."
|
|
||||||
msg_warn "See details here: https://github.com/community-scripts/ProxmoxVE/pull/11888"
|
|
||||||
msg_warn "Press Enter to continue with the update, or Ctrl+C to abort..."
|
|
||||||
read -r
|
|
||||||
fi
|
|
||||||
|
|
||||||
RELEASE="v1.4.2"
|
|
||||||
NODE_VERSION="24" setup_nodejs
|
|
||||||
if check_for_gh_release "PatchMon" "PatchMon/PatchMon" "${RELEASE}"; then
|
if check_for_gh_release "PatchMon" "PatchMon/PatchMon" "${RELEASE}"; then
|
||||||
msg_info "Stopping Service"
|
msg_info "Stopping Service"
|
||||||
systemctl stop patchmon-server
|
systemctl stop patchmon-server
|
||||||
msg_ok "Stopped Service"
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
msg_info "Creating Backup"
|
if [[ -d /opt/patchmon/backend ]]; then
|
||||||
cp /opt/patchmon/backend/.env /opt/backend.env
|
msg_info "Legacy install detected - creating full backup, please wait..."
|
||||||
cp /opt/patchmon/frontend/.env /opt/frontend.env
|
$STD tar czf ~/patchmon_legacy.tar.gz /opt/patchmon
|
||||||
msg_ok "Backup Created"
|
cp /opt/patchmon/backend/.env /opt/legacy.env
|
||||||
|
msg_ok "Full backup saved in /root"
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "PatchMon" "PatchMon/PatchMon" "tarball" "${RELEASE}" "/opt/patchmon"
|
msg_info "Starting migration to PatchMon v2.x.x"
|
||||||
|
systemctl disable -q --now nginx
|
||||||
msg_info "Updating PatchMon"
|
$STD npm cache clean --force
|
||||||
VERSION=$(get_latest_github_release "PatchMon/PatchMon")
|
$STD apt autoremove --purge -y {nginx,nodejs}
|
||||||
SERVER_PORT="$(sed -n '/SERVER_PORT/s/[^=]*=//p' /opt/backend.env)"
|
if [[ -f /etc/apt/sources.list.d/nodesource.sources ]]; then
|
||||||
sed -i 's/PORT=3399/PORT=3001/' /opt/backend.env
|
cp /etc/apt/sources.list.d/nodesource.sources /etc/apt/sources.list.d/nodesource.sources.bak
|
||||||
sed -i -e "s/VERSION=.*/VERSION=$VERSION/" \
|
rm -f /etc/apt/sources.list.d/nodesource.sources
|
||||||
-e '/^VITE_API_URL/d' /opt/frontend.env
|
elif [[ -f /etc/apt/sources.list.d/nodesource.list ]]; then
|
||||||
export NODE_ENV=production
|
cp /etc/apt/sources.list.d/nodesource.list /etc/apt/sources.list.d/nodesource.list.bak
|
||||||
cd /opt/patchmon
|
rm -f /etc/apt/sources.list.d/nodesource.list
|
||||||
$STD npm install --no-audit --no-fund --no-save --ignore-scripts
|
|
||||||
cd /opt/patchmon/frontend
|
|
||||||
mv /opt/frontend.env /opt/patchmon/frontend/.env
|
|
||||||
$STD npm install --no-audit --no-fund --no-save --ignore-scripts --include=dev
|
|
||||||
$STD npm run build
|
|
||||||
cd /opt/patchmon/backend
|
|
||||||
mv /opt/backend.env /opt/patchmon/backend/.env
|
|
||||||
$STD npm run db:generate
|
|
||||||
$STD npx prisma migrate deploy
|
|
||||||
cp /opt/patchmon/docker/nginx.conf.template /etc/nginx/sites-available/patchmon.conf
|
|
||||||
sed -i -e 's|proxy_pass .*|proxy_pass http://127.0.0.1:3001;|' \
|
|
||||||
-e '\|try_files |i\ root /opt/patchmon/frontend/dist;' \
|
|
||||||
-e 's|alias.*|alias /opt/patchmon/frontend/dist/assets;|' \
|
|
||||||
-e '\|expires 1y|i\ root /opt/patchmon/frontend/dist;' /etc/nginx/sites-available/patchmon.conf
|
|
||||||
if [[ -n "$SERVER_PORT" ]] && [[ "$SERVER_PORT" != "443" ]]; then
|
|
||||||
sed -i "s/listen [[:digit:]].*/listen ${SERVER_PORT};/" /etc/nginx/sites-available/patchmon.conf
|
|
||||||
fi
|
fi
|
||||||
ln -sf /etc/nginx/sites-available/patchmon.conf /etc/nginx/sites-enabled/
|
rm -rf /opt/patchmon
|
||||||
rm -f /etc/nginx/sites-enabled/default
|
mkdir -p /opt/patchmon/agents
|
||||||
$STD nginx -t
|
cp /opt/legacy.env /opt/patchmon/.env
|
||||||
systemctl restart nginx
|
sed -i -e 's/^PORT=.*/PORT=3000/' \
|
||||||
msg_ok "Updated PatchMon"
|
-e 's/^NODE_/APP_/' \
|
||||||
|
-e '/^SERVER_*/d' \
|
||||||
|
-e '/^# API*/,+2d' /opt/patchmon/.env
|
||||||
|
{
|
||||||
|
echo ""
|
||||||
|
echo "SESSION_SECRET=$(openssl rand -hex 64)"
|
||||||
|
echo "AI_ENCRYPTION_KEY=$(openssl rand -hex 64)"
|
||||||
|
echo "AGENT_BINARIES_DIR=/opt/patchmon/agents"
|
||||||
|
} >>/opt/patchmon/.env
|
||||||
|
sed -i -e '\|Directory|s|/backend||' \
|
||||||
|
-e 's|^ExecStart=.*|ExecStart=/opt/patchmon/patchmon-server|' \
|
||||||
|
-e 's|^Environment=NODE_.*|EnvironmentFile=/opt/patchmon/.env|' \
|
||||||
|
/etc/systemd/system/patchmon-server.service
|
||||||
|
systemctl daemon-reload
|
||||||
|
rm /opt/legacy.env
|
||||||
|
msg_ok "Migration complete!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "PatchMon" "PatchMon/PatchMon" "singlefile" "${RELEASE}" "/opt/patchmon" "patchmon-server-linux-amd64"
|
||||||
|
mv /opt/patchmon/PatchMon /opt/patchmon/patchmon-server
|
||||||
|
|
||||||
|
msg_info "Fetching PatchMon agent binaries"
|
||||||
|
[[ ! -d /opt/patchmon/agents ]] && mkdir -p /opt/patchmon/agents
|
||||||
|
FILE_URL="https://github.com/PatchMon/PatchMon/releases/download/${RELEASE}/patchmon-agent-"
|
||||||
|
AGENT_NAME=(
|
||||||
|
"linux-amd64"
|
||||||
|
"linux-arm64"
|
||||||
|
"linux-arm"
|
||||||
|
"linux-386"
|
||||||
|
"freebsd-amd64"
|
||||||
|
"freebsd-arm64"
|
||||||
|
"freebsd-arm"
|
||||||
|
"freebsd-386"
|
||||||
|
"windows-amd64.exe"
|
||||||
|
"windows-arm64.exe"
|
||||||
|
)
|
||||||
|
for arch in "${AGENT_NAME[@]}"; do
|
||||||
|
curl_with_retry "${FILE_URL}${arch}" "/opt/patchmon/agents/patchmon-agent-${arch}"
|
||||||
|
[[ "${arch}" != *.exe ]] && chmod 755 "/opt/patchmon/agents/patchmon-agent-${arch}"
|
||||||
|
done
|
||||||
|
msg_ok "Fetched PatchMon agent binaries"
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
if grep -q '/usr/bin/node' /etc/systemd/system/patchmon-server.service; then
|
|
||||||
sed -i 's|ExecStart=.*|ExecStart=/usr/bin/npm run start|' /etc/systemd/system/patchmon-server.service
|
|
||||||
systemctl daemon-reload
|
|
||||||
fi
|
|
||||||
systemctl start patchmon-server
|
systemctl start patchmon-server
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
msg_ok "Updated successfully!"
|
msg_ok "Updated successfully!"
|
||||||
|
|||||||
+2
-2
@@ -32,8 +32,8 @@ function update_script() {
|
|||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable -q --now technitium
|
systemctl enable -q --now technitium
|
||||||
fi
|
fi
|
||||||
if is_package_installed "aspnetcore-runtime-8.0" || is_package_installed "aspnetcore-runtime-9.0"; then
|
if ! is_package_installed "aspnetcore-runtime-10.0"; then
|
||||||
$STD apt remove -y aspnetcore-runtime-*
|
$STD apt remove -y aspnetcore-runtime-8.0 aspnetcore-runtime-9.0 2>/dev/null || true
|
||||||
[ -f /etc/apt/sources.list.d/microsoft-prod.list ] && rm -f /etc/apt/sources.list.d/microsoft-prod.list
|
[ -f /etc/apt/sources.list.d/microsoft-prod.list ] && rm -f /etc/apt/sources.list.d/microsoft-prod.list
|
||||||
[ -f /usr/share/keyrings/microsoft-prod.gpg ] && rm -f /usr/share/keyrings/microsoft-prod.gpg
|
[ -f /usr/share/keyrings/microsoft-prod.gpg ] && rm -f /usr/share/keyrings/microsoft-prod.gpg
|
||||||
setup_deb822_repo \
|
setup_deb822_repo \
|
||||||
|
|||||||
@@ -46,10 +46,16 @@ msg_ok "Set up Directories"
|
|||||||
|
|
||||||
msg_info "Configuring Environment"
|
msg_info "Configuring Environment"
|
||||||
SECRET_KEY_BASE=$(openssl rand -hex 64)
|
SECRET_KEY_BASE=$(openssl rand -hex 64)
|
||||||
|
OTP_ENCRYPTION_PRIMARY_KEY=$(openssl rand -hex 64)
|
||||||
|
OTP_ENCRYPTION_DETERMINISTIC_KEY=$(openssl rand -hex 64)
|
||||||
|
OTP_ENCRYPTION_KEY_DERIVATION_SALT=$(openssl rand -hex 64)
|
||||||
RELEASE=$(get_latest_github_release "Freika/dawarich")
|
RELEASE=$(get_latest_github_release "Freika/dawarich")
|
||||||
cat <<EOF >/opt/dawarich/.env
|
cat <<EOF >/opt/dawarich/.env
|
||||||
RAILS_ENV=production
|
RAILS_ENV=production
|
||||||
SECRET_KEY_BASE=${SECRET_KEY_BASE}
|
SECRET_KEY_BASE=${SECRET_KEY_BASE}
|
||||||
|
OTP_ENCRYPTION_PRIMARY_KEY=${OTP_ENCRYPTION_PRIMARY_KEY}
|
||||||
|
OTP_ENCRYPTION_DETERMINISTIC_KEY=${OTP_ENCRYPTION_DETERMINISTIC_KEY}
|
||||||
|
OTP_ENCRYPTION_KEY_DERIVATION_SALT=${OTP_ENCRYPTION_KEY_DERIVATION_SALT}
|
||||||
DATABASE_HOST=localhost
|
DATABASE_HOST=localhost
|
||||||
DATABASE_USERNAME=${PG_DB_USER}
|
DATABASE_USERNAME=${PG_DB_USER}
|
||||||
DATABASE_PASSWORD=${PG_DB_PASS}
|
DATABASE_PASSWORD=${PG_DB_PASS}
|
||||||
|
|||||||
+62
-46
@@ -14,74 +14,90 @@ network_check
|
|||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt install -y \
|
$STD apt install -y redis-server
|
||||||
build-essential \
|
|
||||||
nginx \
|
|
||||||
redis-server
|
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
NODE_VERSION="24" setup_nodejs
|
|
||||||
PG_VERSION="17" setup_postgresql
|
PG_VERSION="17" setup_postgresql
|
||||||
PG_DB_NAME="patchmon_db" PG_DB_USER="patchmon_usr" setup_postgresql_db
|
PG_DB_NAME="patchmon_db" PG_DB_USER="patchmon_usr" setup_postgresql_db
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "PatchMon" "PatchMon/PatchMon" "tarball" "v1.4.2" "/opt/patchmon"
|
RELEASE="v2.0.1"
|
||||||
|
fetch_and_deploy_gh_release "PatchMon" "PatchMon/PatchMon" "singlefile" "$RELEASE" "/opt/patchmon" "patchmon-server-linux-amd64"
|
||||||
|
mv /opt/patchmon/PatchMon /opt/patchmon/patchmon-server
|
||||||
|
|
||||||
msg_info "Configuring PatchMon"
|
msg_info "Configuring PatchMon"
|
||||||
VERSION=$(get_latest_github_release "PatchMon/PatchMon")
|
cat <<EOF >/opt/patchmon/.env
|
||||||
export NODE_ENV=production
|
DATABASE_URL="postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME"
|
||||||
cd /opt/patchmon
|
|
||||||
$STD npm install --no-audit --no-fund --no-save --ignore-scripts
|
|
||||||
|
|
||||||
cd /opt/patchmon/frontend
|
|
||||||
cat <<EOF >./.env
|
|
||||||
VITE_APP_NAME=PatchMon
|
|
||||||
VITE_APP_VERSION=${VERSION}
|
|
||||||
EOF
|
|
||||||
$STD npm install --no-audit --no-fund --no-save --ignore-scripts --include=dev
|
|
||||||
$STD npm run build
|
|
||||||
|
|
||||||
JWT_SECRET="$(openssl rand -hex 64)"
|
JWT_SECRET="$(openssl rand -hex 64)"
|
||||||
mv /opt/patchmon/backend/env.example /opt/patchmon/backend/.env
|
SESSION_SECRET="$(openssl rand -hex 64)"
|
||||||
sed -i -e "s|DATABASE_URL=.*|DATABASE_URL=\"postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME\"|" \
|
AI_ENCRYPTION_KEY="$(openssl rand -hex 64)"
|
||||||
-e "/JWT_SECRET/s/[=$].*/=$JWT_SECRET/" \
|
CORS_ORIGIN=http://${LOCAL_IP}:3000
|
||||||
-e "\|CORS_ORIGIN|s|localhost|$LOCAL_IP|" \
|
PORT=3000
|
||||||
-e "/PORT=3001/aSERVER_PROTOCOL=http \\
|
APP_ENV=production
|
||||||
SERVER_HOST=$LOCAL_IP \\
|
|
||||||
SERVER_PORT=3000" \
|
|
||||||
-e '/_ENV=production/aTRUST_PROXY=1' \
|
|
||||||
-e '/REDIS_USER=.*/,+1d' /opt/patchmon/backend/.env
|
|
||||||
|
|
||||||
cd /opt/patchmon/backend
|
# Redis
|
||||||
$STD npm run db:generate
|
REDIS_HOST=localhost
|
||||||
$STD npx prisma migrate deploy
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
## OIDC / SSO (when OIDC_ENABLED=true, issuer/client/secret/redirect required)
|
||||||
|
# OIDC_ENABLED=false
|
||||||
|
# OIDC_ISSUER_URL=
|
||||||
|
# OIDC_CLIENT_ID=
|
||||||
|
# OIDC_CLIENT_SECRET=
|
||||||
|
# OIDC_REDIRECT_URI=
|
||||||
|
# OIDC_SCOPES=openid email profile groups
|
||||||
|
# OIDC_AUTO_CREATE_USERS=false
|
||||||
|
# OIDC_DEFAULT_ROLE=user
|
||||||
|
# OIDC_DISABLE_LOCAL_AUTH=false
|
||||||
|
# OIDC_BUTTON_TEXT=Login with SSO
|
||||||
|
# OIDC_SESSION_TTL=600
|
||||||
|
# OIDC_POST_LOGOUT_URI=
|
||||||
|
# OIDC_SYNC_ROLES=false
|
||||||
|
# OIDC_ADMIN_GROUP=
|
||||||
|
# OIDC_SUPERADMIN_GROUP=
|
||||||
|
# OIDC_HOST_MANAGER_GROUP=
|
||||||
|
# OIDC_READONLY_GROUP=
|
||||||
|
# OIDC_USER_GROUP=
|
||||||
|
# OIDC_ENFORCE_HTTPS=true
|
||||||
|
|
||||||
|
AGENT_BINARIES_DIR=/opt/patchmon/agents
|
||||||
|
EOF
|
||||||
msg_ok "Configured PatchMon"
|
msg_ok "Configured PatchMon"
|
||||||
|
|
||||||
msg_info "Configuring Nginx"
|
msg_info "Fetching PatchMon agent binaries"
|
||||||
cp /opt/patchmon/docker/nginx.conf.template /etc/nginx/sites-available/patchmon.conf
|
mkdir -p /opt/patchmon/agents
|
||||||
sed -i -e 's|proxy_pass .*|proxy_pass http://127.0.0.1:3001;|' \
|
FILE_URL="https://github.com/PatchMon/PatchMon/releases/download/${RELEASE}/patchmon-agent-"
|
||||||
-e '\|try_files |i\ root /opt/patchmon/frontend/dist;' \
|
AGENT_NAME=(
|
||||||
-e 's|alias.*|alias /opt/patchmon/frontend/dist/assets;|' \
|
"linux-amd64"
|
||||||
-e '\|expires 1y|i\ root /opt/patchmon/frontend/dist;' /etc/nginx/sites-available/patchmon.conf
|
"linux-arm64"
|
||||||
ln -sf /etc/nginx/sites-available/patchmon.conf /etc/nginx/sites-enabled/
|
"linux-arm"
|
||||||
rm -f /etc/nginx/sites-enabled/default
|
"linux-386"
|
||||||
$STD nginx -t
|
"freebsd-amd64"
|
||||||
systemctl restart nginx
|
"freebsd-arm64"
|
||||||
msg_ok "Configured Nginx"
|
"freebsd-arm"
|
||||||
|
"freebsd-386"
|
||||||
|
"windows-amd64.exe"
|
||||||
|
"windows-arm64.exe"
|
||||||
|
)
|
||||||
|
for arch in "${AGENT_NAME[@]}"; do
|
||||||
|
curl_with_retry "${FILE_URL}${arch}" "/opt/patchmon/agents/patchmon-agent-${arch}"
|
||||||
|
[[ "${arch}" != *.exe ]] && chmod 755 "/opt/patchmon/agents/patchmon-agent-${arch}"
|
||||||
|
done
|
||||||
|
msg_ok "Fetched PatchMon agent binaries"
|
||||||
|
|
||||||
msg_info "Creating service"
|
msg_info "Creating service"
|
||||||
cat <<EOF >/etc/systemd/system/patchmon-server.service
|
cat <<EOF >/etc/systemd/system/patchmon-server.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=PatchMon Service
|
Description=PatchMon Server
|
||||||
After=network.target postgresql.service
|
After=network.target postgresql.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=/opt/patchmon/backend
|
WorkingDirectory=/opt/patchmon
|
||||||
ExecStart=/usr/bin/npm run start
|
ExecStart=/opt/patchmon/patchmon-server
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
Environment=NODE_ENV=production
|
|
||||||
Environment=PATH=/usr/bin:/usr/local/bin
|
Environment=PATH=/usr/bin:/usr/local/bin
|
||||||
|
EnvironmentFile=/opt/patchmon/.env
|
||||||
NoNewPrivileges=true
|
NoNewPrivileges=true
|
||||||
PrivateTmp=true
|
PrivateTmp=true
|
||||||
ProtectSystem=strict
|
ProtectSystem=strict
|
||||||
|
|||||||
+2
-2
@@ -5456,14 +5456,14 @@ create_lxc_container() {
|
|||||||
local _has_fallback_option=false
|
local _has_fallback_option=false
|
||||||
if [[ "$do_retry" == "yes" ]] && has_previous_os_version_template; then
|
if [[ "$do_retry" == "yes" ]] && has_previous_os_version_template; then
|
||||||
_has_fallback_option=true
|
_has_fallback_option=true
|
||||||
echo " [1] Run host upgrade now (recommended). WARNING: this runs apt upgrade and updates all Packeages on your host!"
|
echo " [1] Run host upgrade now (recommended). WARNING: this runs apt upgrade and updates all Packages on your host!"
|
||||||
echo " [2] Use an older ${PCT_OSTYPE} template instead (may not work with all scripts)"
|
echo " [2] Use an older ${PCT_OSTYPE} template instead (may not work with all scripts)"
|
||||||
echo " [3] Ignore"
|
echo " [3] Ignore"
|
||||||
echo " [4] Cancel"
|
echo " [4] Cancel"
|
||||||
echo
|
echo
|
||||||
read -rp "Select option [1/2/3/4]: " _ans </dev/tty
|
read -rp "Select option [1/2/3/4]: " _ans </dev/tty
|
||||||
else
|
else
|
||||||
echo " [1] Run host upgrade now (recommended). WARNING: this runs apt upgrade and updates all Packeages on your host!"
|
echo " [1] Run host upgrade now (recommended). WARNING: this runs apt upgrade and updates all Packages on your host!"
|
||||||
echo " [2] Ignore"
|
echo " [2] Ignore"
|
||||||
echo " [3] Cancel"
|
echo " [3] Cancel"
|
||||||
echo
|
echo
|
||||||
|
|||||||
@@ -405,11 +405,6 @@ for container in $CHOICE; do
|
|||||||
esac
|
esac
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
|
|
||||||
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
|
|
||||||
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
|
|
||||||
pct shutdown $container &
|
|
||||||
fi
|
|
||||||
|
|
||||||
#5) if build resources are different than run resources, then:
|
#5) if build resources are different than run resources, then:
|
||||||
if [ "$UPDATE_BUILD_RESOURCES" -eq "1" ]; then
|
if [ "$UPDATE_BUILD_RESOURCES" -eq "1" ]; then
|
||||||
pct set "$container" --cores "$run_cpu" --memory "$run_ram"
|
pct set "$container" --cores "$run_cpu" --memory "$run_ram"
|
||||||
@@ -421,6 +416,11 @@ for container in $CHOICE; do
|
|||||||
containers_needing_reboot+=("$container ($container_hostname)")
|
containers_needing_reboot+=("$container ($container_hostname)")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
|
||||||
|
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
|
||||||
|
pct shutdown $container &>/dev/null &
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $exit_code -eq 0 ]; then
|
if [ $exit_code -eq 0 ]; then
|
||||||
msg_ok "Updated container $container"
|
msg_ok "Updated container $container"
|
||||||
elif [ $exit_code -eq 75 ]; then
|
elif [ $exit_code -eq 75 ]; then
|
||||||
|
|||||||
@@ -66,10 +66,20 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
|
|||||||
pct start "$container"
|
pct start "$container"
|
||||||
sleep 5
|
sleep 5
|
||||||
update_container "$container" || echo " [Error] Update failed for $container"
|
update_container "$container" || echo " [Error] Update failed for $container"
|
||||||
|
# check if patchmon agent is present in container and run a report if found
|
||||||
|
if pct exec "$container" -- [ -e "/usr/local/bin/patchmon-agent" ]; then
|
||||||
|
echo -e "${BL}[Info]${GN} patchmon-agent found in ${BL} $container ${CL}, triggering report. \n"
|
||||||
|
pct exec "$container" -- "/usr/local/bin/patchmon-agent" "report"
|
||||||
|
fi
|
||||||
echo -e "[Info] Shutting down $container"
|
echo -e "[Info] Shutting down $container"
|
||||||
pct shutdown "$container" --timeout 60 &
|
pct shutdown "$container" --timeout 60 &
|
||||||
elif [ "$status" == "status: running" ]; then
|
elif [ "$status" == "status: running" ]; then
|
||||||
update_container "$container" || echo " [Error] Update failed for $container"
|
update_container "$container" || echo " [Error] Update failed for $container"
|
||||||
|
# check if patchmon agent is present in container and run a report if found
|
||||||
|
if pct exec "$container" -- [ -e "/usr/local/bin/patchmon-agent" ]; then
|
||||||
|
echo -e "${BL}[Info]${GN} patchmon-agent found in ${BL} $container ${CL}, triggering report. \n"
|
||||||
|
pct exec "$container" -- "/usr/local/bin/patchmon-agent" "report"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
|
|||||||
elif [ "$status" == "status: running" ]; then
|
elif [ "$status" == "status: running" ]; then
|
||||||
update_container $container
|
update_container $container
|
||||||
fi
|
fi
|
||||||
|
if [ "$status" == "status: running" ]; then
|
||||||
if pct exec "$container" -- [ -e "/var/run/reboot-required" ]; then
|
if pct exec "$container" -- [ -e "/var/run/reboot-required" ]; then
|
||||||
# Get the container's hostname and add it to the list
|
# Get the container's hostname and add it to the list
|
||||||
container_hostname=$(pct exec "$container" hostname)
|
container_hostname=$(pct exec "$container" hostname)
|
||||||
@@ -121,6 +122,7 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
|
|||||||
pct exec "$container" -- "/usr/local/bin/patchmon-agent" "report"
|
pct exec "$container" -- "/usr/local/bin/patchmon-agent" "report"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
header_info
|
header_info
|
||||||
|
|||||||
Reference in New Issue
Block a user