Refactor: PeaNUT (#6002)
This commit is contained in:
parent
417c4e466c
commit
7d223b984b
29
ct/peanut.sh
29
ct/peanut.sh
@ -8,7 +8,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
|
|||||||
APP="PeaNUT"
|
APP="PeaNUT"
|
||||||
var_tags="${var_tags:-network;ups;}"
|
var_tags="${var_tags:-network;ups;}"
|
||||||
var_cpu="${var_cpu:-2}"
|
var_cpu="${var_cpu:-2}"
|
||||||
var_ram="${var_ram:-3072}"
|
var_ram="${var_ram:-4096}"
|
||||||
var_disk="${var_disk:-7}"
|
var_disk="${var_disk:-7}"
|
||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-12}"
|
var_version="${var_version:-12}"
|
||||||
@ -27,22 +27,31 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/Brandawg93/PeaNUT/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
|
if ! command -v jq &>/dev/null; then
|
||||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
$STD apt-get install -y jq
|
||||||
msg_info "Updating $APP to ${RELEASE}"
|
fi
|
||||||
|
NODE_VERSION="22" NODE_MODULE="pnpm" setup_nodejs
|
||||||
|
RELEASE=$(curl -fsSL https://api.github.com/repos/Brandawg93/PeaNUT/releases/latest | jq -r '.tag_name' | sed 's/^v//')
|
||||||
|
if [[ "${RELEASE}" != "$(cat ~/.peanut 2>/dev/null)" ]] || [[ ! -f ~/.peanut ]]; then
|
||||||
|
|
||||||
|
msg_info "Stopping $APP"
|
||||||
systemctl stop peanut
|
systemctl stop peanut
|
||||||
curl -fsSL "https://api.github.com/repos/Brandawg93/PeaNUT/tarball/${RELEASE}" -o "peanut.tar.gz"
|
msg_ok "Stopped $APP"
|
||||||
tar -xzf peanut.tar.gz -C /opt/peanut --strip-components=1
|
|
||||||
rm peanut.tar.gz
|
fetch_and_deploy_gh_release "peanut" "Brandawg93/PeaNUT" "tarball" "latest" "/opt/peanut"
|
||||||
|
|
||||||
|
msg_info "Updating $APP to ${RELEASE}"
|
||||||
cd /opt/peanut
|
cd /opt/peanut
|
||||||
$STD pnpm i
|
$STD pnpm i
|
||||||
$STD pnpm run build
|
$STD pnpm run build:local
|
||||||
cp -r .next/static .next/standalone/.next/
|
cp -r .next/static .next/standalone/.next/
|
||||||
mkdir -p /opt/peanut/.next/standalone/config
|
mkdir -p /opt/peanut/.next/standalone/config
|
||||||
ln -sf /etc/peanut/settings.yml /opt/peanut/.next/standalone/config/settings.yml
|
ln -sf /etc/peanut/settings.yml /opt/peanut/.next/standalone/config/settings.yml
|
||||||
systemctl start peanut
|
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
msg_ok "Updated $APP to ${RELEASE}"
|
msg_ok "Updated $APP to ${RELEASE}"
|
||||||
|
|
||||||
|
msg_info "Starting $APP"
|
||||||
|
systemctl start peanut
|
||||||
|
msg_ok "Started $APP"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||||
fi
|
fi
|
||||||
|
66
frontend/public/json/peanut.json
generated
66
frontend/public/json/peanut.json
generated
@ -1,35 +1,35 @@
|
|||||||
{
|
{
|
||||||
"name": "PeaNUT",
|
"name": "PeaNUT",
|
||||||
"slug": "peanut",
|
"slug": "peanut",
|
||||||
"categories": [
|
"categories": [
|
||||||
4
|
4
|
||||||
],
|
],
|
||||||
"date_created": "2024-06-14",
|
"date_created": "2024-06-14",
|
||||||
"type": "ct",
|
"type": "ct",
|
||||||
"updateable": true,
|
"updateable": true,
|
||||||
"privileged": false,
|
"privileged": false,
|
||||||
"interface_port": 3000,
|
"interface_port": 3000,
|
||||||
"documentation": null,
|
"documentation": null,
|
||||||
"website": "https://github.com/Brandawg93/PeaNUT/",
|
"website": "https://github.com/Brandawg93/PeaNUT/",
|
||||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/peanut.webp",
|
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/peanut.webp",
|
||||||
"config_path": "/etc/peanut/settings.yml",
|
"config_path": "/etc/peanut/settings.yml",
|
||||||
"description": "PeaNUT is a small dashboard for Network UPS Tools (NUT). It provides a web interface to monitor and manage UPS devices. PeaNUT allows users to view device status, retrieve information, and manage UPS parameters through its API. It's customizable for different UPS devices and supports integration with the Homepage dashboard.",
|
"description": "PeaNUT is a small dashboard for Network UPS Tools (NUT). It provides a web interface to monitor and manage UPS devices. PeaNUT allows users to view device status, retrieve information, and manage UPS parameters through its API. It's customizable for different UPS devices and supports integration with the Homepage dashboard.",
|
||||||
"install_methods": [
|
"install_methods": [
|
||||||
{
|
{
|
||||||
"type": "default",
|
"type": "default",
|
||||||
"script": "ct/peanut.sh",
|
"script": "ct/peanut.sh",
|
||||||
"resources": {
|
"resources": {
|
||||||
"cpu": 2,
|
"cpu": 2,
|
||||||
"ram": 3072,
|
"ram": 4096,
|
||||||
"hdd": 7,
|
"hdd": 7,
|
||||||
"os": "debian",
|
"os": "debian",
|
||||||
"version": "12"
|
"version": "12"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"default_credentials": {
|
"default_credentials": {
|
||||||
"username": null,
|
"username": null,
|
||||||
"password": null
|
"password": null
|
||||||
},
|
},
|
||||||
"notes": []
|
"notes": []
|
||||||
}
|
}
|
||||||
|
@ -14,22 +14,17 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
NODE_VERSION="22" setup_nodejs
|
|
||||||
|
|
||||||
msg_info "Installing NUT"
|
msg_info "Installing NUT"
|
||||||
$STD apt-get install -y nut-client
|
$STD apt-get install -y nut-client
|
||||||
msg_ok "Installed NUT"
|
msg_ok "Installed NUT"
|
||||||
|
|
||||||
msg_info "Installing Peanut"
|
NODE_VERSION="22" NODE_MODULE="pnpm" setup_nodejs
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/Brandawg93/PeaNUT/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
|
fetch_and_deploy_gh_release "peanut" "Brandawg93/PeaNUT" "tarball" "latest" "/opt/peanut"
|
||||||
curl -fsSL "https://api.github.com/repos/Brandawg93/PeaNUT/tarball/${RELEASE}" -o "peanut.tar.gz"
|
|
||||||
mkdir -p /opt/peanut
|
msg_info "Setup Peanut"
|
||||||
tar -xzf peanut.tar.gz -C /opt/peanut --strip-components=1
|
|
||||||
rm peanut.tar.gz
|
|
||||||
cd /opt/peanut
|
cd /opt/peanut
|
||||||
$STD npm install -g pnpm
|
|
||||||
$STD pnpm i
|
$STD pnpm i
|
||||||
$STD pnpm run build
|
$STD pnpm run build:local
|
||||||
cp -r .next/static .next/standalone/.next/
|
cp -r .next/static .next/standalone/.next/
|
||||||
mkdir -p /opt/peanut/.next/standalone/config
|
mkdir -p /opt/peanut/.next/standalone/config
|
||||||
mkdir -p /etc/peanut/
|
mkdir -p /etc/peanut/
|
||||||
@ -40,7 +35,7 @@ NUT_HOST: 0.0.0.0
|
|||||||
NUT_PORT: 3493
|
NUT_PORT: 3493
|
||||||
EOF
|
EOF
|
||||||
ln -sf /etc/peanut/settings.yml /opt/peanut/.next/standalone/config/settings.yml
|
ln -sf /etc/peanut/settings.yml /opt/peanut/.next/standalone/config/settings.yml
|
||||||
msg_ok "Installed Peanut"
|
msg_ok "Setup Peanut"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/peanut.service
|
cat <<EOF >/etc/systemd/system/peanut.service
|
||||||
|
Loading…
x
Reference in New Issue
Block a user