Compare commits

..

1 Commits

Author SHA1 Message Date
Sam Heinz b1eec90772 add helper function for get_arch_value 2026-06-12 20:02:52 +10:00
8 changed files with 22 additions and 191 deletions
-6
View File
@@ -480,12 +480,6 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
</details>
## 2026-06-13
### 🆕 New Scripts
- BookOrbit ([#15080](https://github.com/community-scripts/ProxmoxVE/pull/15080))
## 2026-06-12
### 🆕 New Scripts
-78
View File
@@ -1,78 +0,0 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/bookorbit/bookorbit
APP="BookOrbit"
var_tags="${var_tags:-books;library;reading}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-10}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-no}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/bookorbit ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "bookorbit" "bookorbit/bookorbit"; then
msg_info "Stopping Service"
systemctl stop bookorbit
msg_ok "Stopped Service"
create_backup /opt/bookorbit/.env
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bookorbit" "bookorbit/bookorbit" "tarball"
msg_info "Rebuilding Application"
cd /opt/bookorbit
PNPM_VERSION=$(jq -r '.packageManager | ltrimstr("pnpm@")' /opt/bookorbit/package.json)
$STD corepack enable
$STD corepack prepare "pnpm@${PNPM_VERSION}" --activate
$STD pnpm install --frozen-lockfile
$STD pnpm --filter client run build-only
$STD pnpm --filter server run build
cp -r /opt/bookorbit/client/dist /opt/bookorbit/server/public
mkdir -p /opt/bookorbit/server/migrations
cp -r /opt/bookorbit/server/src/db/migrations/. /opt/bookorbit/server/migrations/
chmod +x /opt/bookorbit/server/bin/kepubify/*
APP_VER=$(cat ~/.bookorbit)
sed -i "s/^APP_VERSION=.*/APP_VERSION=v$APP_VER/" /opt/bookorbit/.env
msg_ok "Rebuilt Application"
msg_info "Updating Kobo Python Runtime"
$STD uv pip install --python /opt/bookorbit-python/bin/python -r /opt/bookorbit/server/requirements/kobo-cloudscraper.txt
msg_ok "Updated Kobo Python Runtime"
msg_info "Starting Service"
systemctl start bookorbit
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"
-1
View File
@@ -33,7 +33,6 @@ function update_script() {
RELEASE="${RELEASE%%+*}"
msg_info "Updating checkmk"
$STD omd stop monitoring
$STD omd -f rm monitoringbackup 2>/dev/null || true
$STD omd cp monitoring monitoringbackup
curl_download "/opt/checkmk.deb" "https://download.checkmk.com/checkmk/${RELEASE}/check-mk-community-${RELEASE}_0.$(get_os_info codename)_amd64.deb"
$STD apt install -y /opt/checkmk.deb
-6
View File
@@ -1,6 +0,0 @@
____ __ ____ __ _ __
/ __ )____ ____ / /__/ __ \_____/ /_ (_) /_
/ __ / __ \/ __ \/ //_/ / / / ___/ __ \/ / __/
/ /_/ / /_/ / /_/ / ,< / /_/ / / / /_/ / / /_
/_____/\____/\____/_/|_|\____/_/ /_.___/_/\__/
-99
View File
@@ -1,99 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/bookorbit/bookorbit
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
build-essential \
ffmpeg \
poppler-utils
msg_ok "Installed Dependencies"
PG_VERSION="16" PG_MODULES="pgvector" setup_postgresql
PG_DB_NAME="bookorbit" PG_DB_USER="bookorbit" PG_DB_EXTENSIONS="uuid-ossp,pg_trgm,vector" setup_postgresql_db
NODE_VERSION="24" setup_nodejs
setup_uv
fetch_and_deploy_gh_release "bookorbit" "bookorbit/bookorbit" "tarball"
msg_info "Building Application"
cd /opt/bookorbit
PNPM_VERSION=$(jq -r '.packageManager | ltrimstr("pnpm@")' /opt/bookorbit/package.json)
$STD corepack enable
$STD corepack prepare "pnpm@${PNPM_VERSION}" --activate
$STD pnpm install --frozen-lockfile
$STD pnpm --filter client run build-only
$STD pnpm --filter server run build
cp -r /opt/bookorbit/client/dist /opt/bookorbit/server/public
mkdir -p /opt/bookorbit/server/migrations
cp -r /opt/bookorbit/server/src/db/migrations/. /opt/bookorbit/server/migrations/
chmod +x /opt/bookorbit/server/bin/kepubify/*
msg_ok "Built Application"
msg_info "Setting up Python Runtime"
$STD uv venv /opt/bookorbit-python
$STD uv pip install --python /opt/bookorbit-python/bin/python -r /opt/bookorbit/server/requirements/kobo-cloudscraper.txt
msg_ok "Set up Python Runtime"
msg_info "Configuring Application"
mkdir -p /opt/bookorbit-data/covers /opt/bookorbit-data/book-bucket /opt/bookorbit-books
APP_VER=$(cat ~/.bookorbit)
JWT_SECRET=$(openssl rand -hex 32)
SETUP_BOOTSTRAP_TOKEN=$(openssl rand -hex 16)
cat <<EOF >>~/bookorbit.creds
Setup Token: ${SETUP_BOOTSTRAP_TOKEN}
EOF
cat <<EOF >/opt/bookorbit/.env
NODE_ENV=production
PORT=3000
DATABASE_URL=postgres://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
JWT_SECRET=${JWT_SECRET}
SETUP_BOOTSTRAP_TOKEN=${SETUP_BOOTSTRAP_TOKEN}
APP_URL=http://${LOCAL_IP}:3000
CLIENT_URL=http://${LOCAL_IP}:3000
NODE_OPTIONS=--max-old-space-size=2048
APP_DATA_PATH=/opt/bookorbit-data
KOBO_CLOUDSCRAPER_PYTHON=/opt/bookorbit-python/bin/python
BOOK_DOCK_PATH=/opt/bookorbit-data/book-bucket
APP_VERSION=v${APP_VER}
EOF
msg_ok "Configured Application"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/bookorbit.service
[Unit]
Description=BookOrbit Service
After=network.target postgresql.service
Requires=postgresql.service
[Service]
Type=simple
User=root
WorkingDirectory=/opt/bookorbit/server
EnvironmentFile=/opt/bookorbit/.env
ExecStartPre=/usr/bin/node /opt/bookorbit/server/dist/scripts/migrate.js
ExecStart=/usr/bin/node /opt/bookorbit/server/dist/main.js
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now bookorbit
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc
+1
View File
@@ -3838,6 +3838,7 @@ build_container() {
export ENABLE_TUN="$ENABLE_TUN"
export PCT_OSTYPE="$var_os"
export PCT_OSVERSION="$var_version"
export PCT_ARCH="$(dpkg --print-architecture 2>/dev/null || uname -m)"
export PCT_DISK_SIZE="$DISK_SIZE"
export IPV6_METHOD="$IPV6_METHOD"
export ENABLE_GPU="$ENABLE_GPU"
+20
View File
@@ -360,6 +360,26 @@ arch_check() {
fi
}
# ------------------------------------------------------------------------------
# get_arch_value()
#
# - Selects an architecture-specific value while preserving amd64 defaults
# - Usage: get_arch_value "amd64-value" "arm64-value"
# - Defaults: amd64="amd64", arm64="arm64"
# ------------------------------------------------------------------------------
get_arch_value() {
local amd64_val="${1:-amd64}"
local arm64_val="${2:-arm64}"
case "$PCT_ARCH" in
amd64) echo "$amd64_val" ;;
arm64) echo "$arm64_val" ;;
*)
msg_error "Unsupported architecture: $PCT_ARCH"
return 106
;;
esac
}
# ------------------------------------------------------------------------------
# ssh_check()
#
+1 -1
View File
@@ -8098,7 +8098,7 @@ setup_postgresql_db() {
IFS=',' read -ra EXT_LIST <<<"${PG_DB_EXTENSIONS:-}"
for ext in "${EXT_LIST[@]}"; do
ext=$(echo "$ext" | xargs) # Trim whitespace
$STD sudo -u postgres psql -d "$PG_DB_NAME" -c "CREATE EXTENSION IF NOT EXISTS \"$ext\";"
$STD sudo -u postgres psql -d "$PG_DB_NAME" -c "CREATE EXTENSION IF NOT EXISTS $ext;"
done
fi