Files
ProxmoxVE/install/umami-install.sh
CanbiZ (MickLesk) 3ff7e281ed Umami: pin pnpm from engines.pnpm on install, set APP_SECRET (#19057)
* Umami: pin pnpm from engines.pnpm on install, set APP_SECRET

The install took pnpm@latest before the release was fetched, but Umami
pins an exact engines.pnpm, so pnpm install refused to run. setup_nodejs
now runs after the fetch and reads that version, as the update does.

3.5 also requires APP_SECRET and no longer falls back to DATABASE_URL,
so a fresh install and every container updated to 3.5 answered 500. New
installs get a random secret. An existing .env gets APP_SECRET set to
its DATABASE_URL, which is the value 3.4 derived its secret from, so
logins, share links and session IDs stay valid. It runs before the
release check, so containers already on 3.5 are fixed by the next
update.

Fixes #19055

* Umami: raise RAM to 4 GB for the Next.js build

A cold next build peaks at about 2.9 GB of anonymous memory on top of
PostgreSQL, so 2 GB containers get OOM-killed on install and on every
update (CLEAN_INSTALL drops .next).
2026-11-26 17:31:23 +01:00

52 lines
1.2 KiB
Bash

#!/usr/bin/env bash
# Copyright (c) 2021-2026 tteck
# Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://umami.is/ | Github: https://github.com/umami-software/umami
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
PG_VERSION="17" setup_postgresql
PG_DB_NAME="umamidb" PG_DB_USER="umami" setup_postgresql_db
fetch_and_deploy_gh_release "umami" "umami-software/umami" "tarball"
PNPM_VERSION=$(jq -r '.engines.pnpm // "latest"' /opt/umami/package.json)
NODE_VERSION="22" NODE_MODULE="pnpm@${PNPM_VERSION}" setup_nodejs
msg_info "Configuring Umami"
cd /opt/umami
$STD pnpm install
echo -e "DATABASE_URL=postgresql://$PG_DB_USER:$PG_DB_PASS@localhost:5432/$PG_DB_NAME" >>/opt/umami/.env
echo "APP_SECRET=$(openssl rand -hex 32)" >>/opt/umami/.env
$STD pnpm run build
msg_ok "Configured Umami"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/umami.service
[Unit]
Description=umami
[Service]
Type=simple
Restart=always
User=root
WorkingDirectory=/opt/umami
ExecStart=/usr/bin/pnpm run start
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now umami
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc