mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-03 23:45:59 +00:00
Refactor: PeaNUT for v6 (#14224)
This commit is contained in:
committed by
GitHub
parent
dca3fb40a8
commit
08b1398e7b
@@ -45,6 +45,33 @@ function update_script() {
|
||||
msg_ok "Fixed entrypoint"
|
||||
fi
|
||||
|
||||
if [[ ! -f /etc/peanut/peanut.env ]]; then
|
||||
msg_info "Migrating service to EnvironmentFile"
|
||||
mkdir -p /etc/peanut
|
||||
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
|
||||
sed -i '/^Environment=/d' /etc/systemd/system/peanut.service
|
||||
if ! grep -q '^EnvironmentFile=/etc/peanut/peanut.env' /etc/systemd/system/peanut.service; then
|
||||
sed -i '/^Type=simple/a EnvironmentFile=/etc/peanut/peanut.env' /etc/systemd/system/peanut.service
|
||||
fi
|
||||
systemctl daemon-reload
|
||||
msg_ok "Migrated to /etc/peanut/peanut.env"
|
||||
fi
|
||||
|
||||
msg_info "Updating PeaNUT"
|
||||
cd /opt/peanut
|
||||
$STD pnpm i
|
||||
|
||||
+21
-10
@@ -29,13 +29,28 @@ 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
|
||||
cat <<EOF >/etc/peanut/settings.yml
|
||||
WEB_HOST: 0.0.0.0
|
||||
WEB_PORT: 8080
|
||||
NUT_HOST: 0.0.0.0
|
||||
NUT_PORT: 3493
|
||||
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"
|
||||
@@ -48,11 +63,7 @@ SyslogIdentifier=peanut
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
Type=simple
|
||||
Environment="NODE_ENV=production"
|
||||
#Environment="NUT_HOST=localhost"
|
||||
#Environment="NUT_PORT=3493"
|
||||
#Environment="WEB_HOST=0.0.0.0"
|
||||
#Environment="WEB_PORT=8080"
|
||||
EnvironmentFile=/etc/peanut/peanut.env
|
||||
WorkingDirectory=/opt/peanut
|
||||
ExecStart=node /opt/peanut/entrypoint.mjs
|
||||
TimeoutStopSec=30
|
||||
|
||||
Reference in New Issue
Block a user