Files
ProxmoxVE/install/peanut-install.sh
T

79 lines
1.7 KiB
Bash
Raw Normal View History

2024-06-13 22:33:41 -04:00
#!/usr/bin/env bash
# Copyright (c) 2021-2026 tteck
2024-06-13 22:33:41 -04:00
# Author: tteck (tteckster)
# Co-Author: remz1337
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/Brandawg93/PeaNUT/
2024-06-13 22:33:41 -04:00
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
2024-06-13 22:33:41 -04:00
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing NUT"
$STD apt install -y nut-client
2024-06-13 22:33:41 -04:00
msg_ok "Installed NUT"
2026-01-18 15:18:51 +01:00
NODE_VERSION="24" NODE_MODULE="pnpm" setup_nodejs
2025-07-15 12:22:38 +02:00
fetch_and_deploy_gh_release "peanut" "Brandawg93/PeaNUT" "tarball" "latest" "/opt/peanut"
msg_info "Setup Peanut"
2024-06-13 22:33:41 -04:00
cd /opt/peanut
$STD pnpm i
2025-07-15 12:22:38 +02:00
$STD pnpm run build:local
2024-06-13 22:33:41 -04:00
cp -r .next/static .next/standalone/.next/
mkdir -p /opt/peanut/.next/standalone/config
mkdir -p /etc/peanut/
2026-01-18 15:18:51 +01:00
ln -sf .next/standalone/server.js server.js
2026-05-03 22:38:30 +02:00
if [[ ! -f /etc/peanut/settings.yml ]]; then
cat <<EOF >/etc/peanut/settings.yml
NUT_SERVERS: []
EOF
2026-05-03 22:38:30 +02:00
fi
ln -sf /etc/peanut/settings.yml /opt/peanut/.next/standalone/config/settings.yml
2026-05-03 22:38:30 +02:00
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
2025-07-15 12:22:38 +02:00
msg_ok "Setup Peanut"
2024-06-13 22:33:41 -04:00
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
2026-05-03 22:38:30 +02:00
EnvironmentFile=/etc/peanut/peanut.env
2024-06-13 22:33:41 -04:00
WorkingDirectory=/opt/peanut
2026-01-18 15:18:51 +01:00
ExecStart=node /opt/peanut/entrypoint.mjs
2024-06-13 22:33:41 -04:00
TimeoutStopSec=30
[Install]
WantedBy=multi-user.target
EOF
2025-04-01 20:22:40 +02:00
systemctl enable -q --now peanut
2024-06-13 22:33:41 -04:00
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc