Compare commits

..

2 Commits

Author SHA1 Message Date
community-scripts-pr-app[bot]
6083e802ee Update CHANGELOG.md (#17986)
Some checks are pending
Create Changelog Pull Request / update-changelog-pull-request (push) Waiting to run
Set state to is_deleted in pocketbase / delete-pocketbase-entry (push) Waiting to run
Sync ct/install to Incus / dispatch (push) Waiting to run
Update script timestamp on .sh changes / update-script-timestamp (push) Waiting to run
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-10-18 07:29:09 +00:00
Tobias
2d554a8bb8 fix: geopulse 2.0.0 upgrade support (nginx .mjs, pg18, jwt cleanup) (#17978)
2.0.0 serves its MapLibre worker as a .mjs file, which nginx's stock
mime.types doesn't map, breaking the map on both fresh installs and
updates. Also drops the now-dead JWT key generation/env vars (2.0.0
uses opaque session tokens), clears stale frontend build output on
update via CLEAN_INSTALL+KEEP instead of accumulating it forever,
backs up the database before updating, bumps new installs straight
to PostgreSQL 18/PostGIS 3.6, and raises the default disk size after
hitting real space pressure during a live upgrade.
2026-10-18 09:28:44 +02:00
3 changed files with 69 additions and 8 deletions

View File

@@ -567,6 +567,12 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
## 2026-10-18
### 🚀 Updated Scripts
- #### 💥 Breaking Changes
- fix: geopulse 2.0.0 upgrade support (nginx .mjs, pg18, jwt cleanup) [@CrazyWolf13](https://github.com/CrazyWolf13) ([#17978](https://github.com/community-scripts/ProxmoxVE/pull/17978))
## 2026-10-17
### 🆕 New Scripts

View File

@@ -10,7 +10,7 @@ APP="GeoPulse"
var_tags="${var_tags:-location;tracking;gps}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-1024}"
var_disk="${var_disk:-8}"
var_disk="${var_disk:-12}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
@@ -32,6 +32,16 @@ function update_script() {
fi
if check_for_gh_release "geopulse-backend" "tess1o/geopulse"; then
msg_info "Backing Up Database"
mkdir -p /var/lib/geopulse/dumps
DB_NAME="$(grep -oP '^GEOPULSE_POSTGRES_DB=\K.*' /etc/geopulse/geopulse.env 2>/dev/null)"
DB_NAME="${DB_NAME:-geopulse}"
if sudo -u postgres pg_dump -Fc "${DB_NAME}" >"/var/lib/geopulse/dumps/${DB_NAME}-pre-update-$(date +%Y%m%d%H%M%S).dump" 2>/dev/null; then
msg_ok "Backed Up Database"
else
msg_warn "Database backup failed, continuing anyway"
fi
msg_info "Stopping Service"
systemctl stop geopulse-backend
msg_ok "Stopped Service"
@@ -51,7 +61,48 @@ function update_script() {
fi
fetch_and_deploy_gh_release "geopulse-backend" "tess1o/geopulse" "singlefile" "latest" "/opt/geopulse/backend" "${BINARY_PATTERN}"
fetch_and_deploy_gh_release "geopulse-frontend" "tess1o/geopulse" "prebuild" "latest" "/var/www/geopulse" "geopulse-frontend-*.tar.gz"
CLEAN_INSTALL=1 CLEAN_INSTALL_KEEP="avatars" fetch_and_deploy_gh_release "geopulse-frontend" "tess1o/geopulse" "prebuild" "latest" "/var/www/geopulse" "geopulse-frontend-*.tar.gz"
if [[ -f /etc/geopulse/geopulse.env ]] && grep -q "GEOPULSE_JWT_" /etc/geopulse/geopulse.env 2>/dev/null; then
msg_info "Removing Unused JWT Keys"
sed -i '/^GEOPULSE_JWT_PRIVATE_KEY_LOCATION=/d;/^GEOPULSE_JWT_PUBLIC_KEY_LOCATION=/d' /etc/geopulse/geopulse.env
rm -f /opt/geopulse/keys/jwt-private-key.pem /opt/geopulse/keys/jwt-public-key.pem
msg_ok "Removed Unused JWT Keys"
fi
if [[ -f /etc/nginx/sites-available/geopulse.conf ]] && ! grep -q '\.mjs\$' /etc/nginx/sites-available/geopulse.conf; then
msg_info "Configuring Nginx for .mjs Assets"
cp /etc/nginx/sites-available/geopulse.conf /etc/nginx/sites-available/geopulse.conf.pre-mjs.bak
ANCHOR_LINE="$(grep -n ' add_header Cache-Control "public, max-age=31536000";' /etc/nginx/sites-available/geopulse.conf.pre-mjs.bak | head -1 | cut -d: -f1)"
if [[ -n "$ANCHOR_LINE" ]]; then
INSERT_LINE=$((ANCHOR_LINE + 1))
{
head -n "$INSERT_LINE" /etc/nginx/sites-available/geopulse.conf.pre-mjs.bak
cat <<'MJSBLOCK'
location ~* ^/(?!osm/).*\.mjs$ {
types {
application/javascript mjs;
}
expires 1y;
add_header Cache-Control "public, max-age=31536000";
}
MJSBLOCK
tail -n "+$((INSERT_LINE + 1))" /etc/nginx/sites-available/geopulse.conf.pre-mjs.bak
} >/etc/nginx/sites-available/geopulse.conf
fi
if [[ -n "$ANCHOR_LINE" ]] && grep -q '\.mjs\$' /etc/nginx/sites-available/geopulse.conf && nginx -t >/dev/null 2>&1; then
systemctl reload nginx
msg_ok "Configured Nginx for .mjs Assets"
else
cp /etc/nginx/sites-available/geopulse.conf.pre-mjs.bak /etc/nginx/sites-available/geopulse.conf
nginx -t >/dev/null 2>&1 && systemctl reload nginx
msg_warn "Could not automatically add the .mjs nginx block (customized config?) - add it manually, see the GeoPulse 2.0.0 upgrade notes"
fi
fi
msg_info "Starting Service"
systemctl start geopulse-backend

View File

@@ -19,17 +19,15 @@ $STD apt install -y \
nginx
msg_ok "Installed Dependencies"
PG_VERSION="17" PG_MODULES="postgis" setup_postgresql
PG_VERSION="18" PG_MODULES="postgis" setup_postgresql
PG_DB_NAME="geopulse" PG_DB_USER="geopulse" PG_DB_EXTENSIONS="postgis,postgis_topology" setup_postgresql_db
msg_info "Generating Security Keys"
mkdir -p /opt/geopulse/{backend,keys}
mkdir -p /etc/geopulse /var/www/geopulse /var/lib/geopulse/dumps
mkdir -p /var/log/geopulse/{backend,nginx}
openssl genpkey -algorithm RSA -out /opt/geopulse/keys/jwt-private-key.pem 2>/dev/null
openssl rsa -pubout -in /opt/geopulse/keys/jwt-private-key.pem -out /opt/geopulse/keys/jwt-public-key.pem 2>/dev/null
openssl rand -base64 32 >/opt/geopulse/keys/ai-encryption-key.txt
chmod 640 /opt/geopulse/keys/jwt-private-key.pem /opt/geopulse/keys/jwt-public-key.pem /opt/geopulse/keys/ai-encryption-key.txt
chmod 640 /opt/geopulse/keys/ai-encryption-key.txt
msg_ok "Generated Security Keys"
if [[ "$(uname -m)" == "aarch64" ]]; then
@@ -62,8 +60,6 @@ GEOPULSE_POSTGRES_PORT=5432
GEOPULSE_POSTGRES_DB=${PG_DB_NAME}
GEOPULSE_POSTGRES_USERNAME=${PG_DB_USER}
GEOPULSE_POSTGRES_PASSWORD=${PG_DB_PASS}
GEOPULSE_JWT_PRIVATE_KEY_LOCATION=file:/opt/geopulse/keys/jwt-private-key.pem
GEOPULSE_JWT_PUBLIC_KEY_LOCATION=file:/opt/geopulse/keys/jwt-public-key.pem
GEOPULSE_AI_ENCRYPTION_KEY_LOCATION=file:/opt/geopulse/keys/ai-encryption-key.txt
QUARKUS_LOG_FILE_ENABLE=true
QUARKUS_LOG_FILE_PATH=/var/log/geopulse/backend/geopulse.log
@@ -128,6 +124,14 @@ server {
add_header Cache-Control "public, max-age=31536000";
}
location ~* ^/(?!osm/).*\.mjs$ {
types {
application/javascript mjs;
}
expires 1y;
add_header Cache-Control "public, max-age=31536000";
}
location ^~ /osm/tiles/ {
resolver 8.8.8.8 valid=300s;
resolver_timeout 10s;