mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-03-31 06:24:02 -04:00
Refactor: BentoPDF (#12597)
* Refactor BentoPDF * preserve .env.production if it exists * Increase CPU cores to 2
This commit is contained in:
@@ -7,7 +7,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
|
|||||||
|
|
||||||
APP="BentoPDF"
|
APP="BentoPDF"
|
||||||
var_tags="${var_tags:-pdf-editor}"
|
var_tags="${var_tags:-pdf-editor}"
|
||||||
var_cpu="${var_cpu:-1}"
|
var_cpu="${var_cpu:-2}"
|
||||||
var_ram="${var_ram:-4096}"
|
var_ram="${var_ram:-4096}"
|
||||||
var_disk="${var_disk:-4}"
|
var_disk="${var_disk:-4}"
|
||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
@@ -35,16 +35,32 @@ function update_script() {
|
|||||||
systemctl stop bentopdf
|
systemctl stop bentopdf
|
||||||
msg_ok "Stopped Service"
|
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"
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bentopdf" "alam00000/bentopdf" "tarball" "latest" "/opt/bentopdf"
|
||||||
|
|
||||||
msg_info "Updating BentoPDF"
|
msg_info "Updating BentoPDF"
|
||||||
cd /opt/bentopdf
|
cd /opt/bentopdf
|
||||||
$STD npm ci --no-audit --no-fund
|
$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
|
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_ok "Updated BentoPDF"
|
||||||
|
|
||||||
msg_info "Starting Service"
|
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
|
systemctl start bentopdf
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
msg_ok "Updated successfully!"
|
msg_ok "Updated successfully!"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
"type": "default",
|
"type": "default",
|
||||||
"script": "ct/bentopdf.sh",
|
"script": "ct/bentopdf.sh",
|
||||||
"resources": {
|
"resources": {
|
||||||
"cpu": 1,
|
"cpu": 2,
|
||||||
"ram": 4096,
|
"ram": 4096,
|
||||||
"hdd": 4,
|
"hdd": 4,
|
||||||
"os": "debian",
|
"os": "debian",
|
||||||
|
|||||||
@@ -19,8 +19,12 @@ fetch_and_deploy_gh_release "bentopdf" "alam00000/bentopdf" "tarball" "latest" "
|
|||||||
msg_info "Setup BentoPDF"
|
msg_info "Setup BentoPDF"
|
||||||
cd /opt/bentopdf
|
cd /opt/bentopdf
|
||||||
$STD npm ci --no-audit --no-fund
|
$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
|
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_ok "Setup BentoPDF"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
@@ -31,8 +35,8 @@ After=network.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=/opt/bentopdf
|
WorkingDirectory=/opt/bentopdf/dist
|
||||||
ExecStart=/usr/bin/npx serve dist -p 8080
|
ExecStart=/usr/bin/npx http-server -g -b -d false -r --no-dotfiles
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user