mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-03 23:45:59 +00:00
7096281fd0
PeaNUT v6 enables authentication by default and on first boot redirects to a setup page (#14221). Settings can only be controlled via environment variables (AUTH_DISABLED, WEB_USERNAME, WEB_PASSWORD, WEB_HOST/PORT, NUT_HOST/PORT) — settings.yml does not cover them. Refactor the systemd unit to load all runtime configuration from /etc/peanut/peanut.env (mode 0600) instead of hardcoded Environment= lines. The file documents every supported variable, with auth-related options pre-listed but commented out. Existing installations are migrated transparently in update_script: the env file is created on first update, hardcoded Environment= lines are stripped and EnvironmentFile= is injected into the unit.
79 lines
1.7 KiB
Bash
79 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2021-2026 tteck
|
|
# Author: tteck (tteckster)
|
|
# Co-Author: remz1337
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://github.com/Brandawg93/PeaNUT/
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
color
|
|
verb_ip6
|
|
catch_errors
|
|
setting_up_container
|
|
network_check
|
|
update_os
|
|
|
|
msg_info "Installing NUT"
|
|
$STD apt install -y nut-client
|
|
msg_ok "Installed NUT"
|
|
|
|
NODE_VERSION="24" NODE_MODULE="pnpm" setup_nodejs
|
|
fetch_and_deploy_gh_release "peanut" "Brandawg93/PeaNUT" "tarball" "latest" "/opt/peanut"
|
|
|
|
msg_info "Setup Peanut"
|
|
cd /opt/peanut
|
|
$STD pnpm i
|
|
$STD pnpm run build:local
|
|
cp -r .next/static .next/standalone/.next/
|
|
mkdir -p /opt/peanut/.next/standalone/config
|
|
mkdir -p /etc/peanut/
|
|
ln -sf .next/standalone/server.js server.js
|
|
if [[ ! -f /etc/peanut/settings.yml ]]; then
|
|
cat <<EOF >/etc/peanut/settings.yml
|
|
NUT_SERVERS: []
|
|
EOF
|
|
fi
|
|
ln -sf /etc/peanut/settings.yml /opt/peanut/.next/standalone/config/settings.yml
|
|
cat <<EOF >/etc/peanut/peanut.env
|
|
NODE_ENV=production
|
|
|
|
#WEB_HOST=0.0.0.0
|
|
#WEB_PORT=8080
|
|
#NUT_HOST=localhost
|
|
#NUT_PORT=3493
|
|
|
|
# Disable auth entirely:
|
|
#AUTH_DISABLED=true
|
|
|
|
# Bootstrap initial account on first start (ignored afterwards):
|
|
#WEB_USERNAME=admin
|
|
#WEB_PASSWORD=changeme
|
|
EOF
|
|
chmod 600 /etc/peanut/peanut.env
|
|
msg_ok "Setup Peanut"
|
|
|
|
msg_info "Creating Service"
|
|
cat <<EOF >/etc/systemd/system/peanut.service
|
|
[Unit]
|
|
Description=Peanut
|
|
After=network.target
|
|
[Service]
|
|
SyslogIdentifier=peanut
|
|
Restart=always
|
|
RestartSec=5
|
|
Type=simple
|
|
EnvironmentFile=/etc/peanut/peanut.env
|
|
WorkingDirectory=/opt/peanut
|
|
ExecStart=node /opt/peanut/entrypoint.mjs
|
|
TimeoutStopSec=30
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
systemctl enable -q --now peanut
|
|
msg_ok "Created Service"
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|