Big NodeJS Update: Use Helper Function on all Install-Scripts (#4744)

* Big NodeJS Update: Use Helper Function on all Install-Scripts

* add jq in node_function

* add more
This commit is contained in:
CanbiZ
2025-05-27 13:48:34 +02:00
committed by GitHub
parent e6805db9f5
commit 72db97b226
58 changed files with 148 additions and 791 deletions

View File

@ -16,26 +16,14 @@ update_os
msg_info "Installing Dependencies"
$STD apt-get install -y \
git \
gnupg
git
msg_ok "Installed Dependencies"
msg_info "Setting up Node.js Repository"
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
msg_ok "Set up Node.js Repository"
msg_info "Installing Node.js"
$STD apt-get update
$STD apt-get install -y nodejs
$STD npm install pm2 -g
msg_ok "Installed Node.js"
NODE_VERSION="22" NODE_MODULE="pm2" install_node_and_modules
msg_info "Installing Pingvin Share (Patience)"
cd /opt
RELEASE=$(curl -fsSL https://api.github.com/repos/stonith404/pingvin-share/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
curl -fsSL "https://github.com/stonith404/pingvin-share/archive/refs/tags/v${RELEASE}.zip" -o $(basename "https://github.com/stonith404/pingvin-share/archive/refs/tags/v${RELEASE}.zip")
unzip -q v${RELEASE}.zip
echo "${RELEASE}" >"/opt/pingvin_version.txt"
@ -49,10 +37,9 @@ sed -i '/"admin.config.smtp.allow-unauthorized-certificates":\|admin.config.smtp
$STD npm install
$STD npm run build
$STD pm2 start --name="pingvin-share-frontend" npm -- run start
# create and enable pm2-root systemd script
$STD pm2 startup systemd
# save running pm2 processes so pingvin-share can survive reboots
$STD pm2 save
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Installed Pingvin Share"
motd_ssh