Refactor: BentoPDF (#12597)

* Refactor BentoPDF

* preserve .env.production if it exists

* Increase CPU cores to 2
This commit is contained in:
Chris
2026-03-05 12:53:15 -05:00
committed by GitHub
parent 5162f13372
commit 352716319f
3 changed files with 26 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
APP="BentoPDF"
var_tags="${var_tags:-pdf-editor}"
var_cpu="${var_cpu:-1}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-4096}"
var_disk="${var_disk:-4}"
var_os="${var_os:-debian}"
@@ -35,16 +35,32 @@ function update_script() {
systemctl stop bentopdf
msg_ok "Stopped Service"
[[ -f /opt/bentopdf/.env.production ]] && cp /opt/bentopdf/.env.production /opt/production.env
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bentopdf" "alam00000/bentopdf" "tarball" "latest" "/opt/bentopdf"
msg_info "Updating BentoPDF"
cd /opt/bentopdf
$STD npm ci --no-audit --no-fund
$STD npm install http-server -g
if [[ -f /opt/production.env ]]; then
mv /opt/production.env ./.env.production
else
cp ./.env.example ./.env.production
fi
export NODE_OPTIONS="--max-old-space-size=3072"
export SIMPLE_MODE=true
$STD npm run build -- --mode production
export VITE_USE_CDN=true
$STD npm run build:all
msg_ok "Updated BentoPDF"
msg_info "Starting Service"
if grep -q '8080' /etc/systemd/system/bentopdf.service; then
sed -i -e 's|/bentopdf|/bentopdf/dist|' \
-e 's|npx.*|npx http-server -g -b -d false -r --no-dotfiles|' \
/etc/systemd/system/bentopdf.service
systemctl daemon-reload
fi
systemctl start bentopdf
msg_ok "Started Service"
msg_ok "Updated successfully!"

View File

@@ -19,7 +19,7 @@
"type": "default",
"script": "ct/bentopdf.sh",
"resources": {
"cpu": 1,
"cpu": 2,
"ram": 4096,
"hdd": 4,
"os": "debian",

View File

@@ -19,8 +19,12 @@ fetch_and_deploy_gh_release "bentopdf" "alam00000/bentopdf" "tarball" "latest" "
msg_info "Setup BentoPDF"
cd /opt/bentopdf
$STD npm ci --no-audit --no-fund
$STD npm install http-server -g
cp ./.env.example ./.env.production
export NODE_OPTIONS="--max-old-space-size=3072"
export SIMPLE_MODE=true
$STD npm run build -- --mode production
export VITE_USE_CDN=true
$STD npm run build:all
msg_ok "Setup BentoPDF"
msg_info "Creating Service"
@@ -31,8 +35,8 @@ After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/bentopdf
ExecStart=/usr/bin/npx serve dist -p 8080
WorkingDirectory=/opt/bentopdf/dist
ExecStart=/usr/bin/npx http-server -g -b -d false -r --no-dotfiles
Restart=always
RestartSec=10