diff --git a/ct/bentopdf.sh b/ct/bentopdf.sh index 557c37a54..c07f95bb6 100644 --- a/ct/bentopdf.sh +++ b/ct/bentopdf.sh @@ -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!" diff --git a/frontend/public/json/bentopdf.json b/frontend/public/json/bentopdf.json index 89a9bb114..1c71cbc69 100644 --- a/frontend/public/json/bentopdf.json +++ b/frontend/public/json/bentopdf.json @@ -19,7 +19,7 @@ "type": "default", "script": "ct/bentopdf.sh", "resources": { - "cpu": 1, + "cpu": 2, "ram": 4096, "hdd": 4, "os": "debian", diff --git a/install/bentopdf-install.sh b/install/bentopdf-install.sh index fddf98cfe..f447eec76 100644 --- a/install/bentopdf-install.sh +++ b/install/bentopdf-install.sh @@ -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