From 6e147b8adfee3259cf7cf1546082f29911775506 Mon Sep 17 00:00:00 2001 From: vhsdream Date: Sat, 24 Jan 2026 13:56:59 -0500 Subject: [PATCH] Shelfmark --- ct/shelfmark.sh | 68 ++++++++++++++++++++++ frontend/public/json/shelfmark.json | 40 +++++++++++++ install/shelfmark-install.sh | 89 +++++++++++++++++++++++++++++ 3 files changed, 197 insertions(+) create mode 100644 ct/shelfmark.sh create mode 100644 frontend/public/json/shelfmark.json create mode 100644 install/shelfmark-install.sh diff --git a/ct/shelfmark.sh b/ct/shelfmark.sh new file mode 100644 index 000000000..c76518c08 --- /dev/null +++ b/ct/shelfmark.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: vhsdream +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/calibrain/shelfmark + +APP="shelfmark" +var_tags="${var_tags:-ebooks}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-8}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +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/shelfmark ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + NODE_VERSION="22" setup_nodejs + PYTHON_VERSION="3.12" setup_uv + + if check_for_gh_release "shelfmark" "calibrain/shelfmark"; then + msg_info "Stopping Service" + systemctl stop shelfmark + msg_ok "Stopped Service" + + cp /opt/shelfmark/start.sh /opt/start.sh.bak + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "shelfmark" "calibrain/shelfmark" "tarball" "latest" "/opt/shelfmark" + + msg_info "Updating Shelfmark" + cd /opt/shelfmark/src/frontend + $STD npm ci + $STD npm run build + cd /opt/shelfmark + $STD uv venv -c ./venv + $STD uv pip install -r requirements-base.txt + mv /opt/start.sh.bak /opt/start.sh + msg_ok "Updated Shelfmark" + + msg_info "Starting Service" + systemctl start shelfmark + 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}:8084${CL}" diff --git a/frontend/public/json/shelfmark.json b/frontend/public/json/shelfmark.json new file mode 100644 index 000000000..f73232a7c --- /dev/null +++ b/frontend/public/json/shelfmark.json @@ -0,0 +1,40 @@ +{ + "name": "Shelfmark", + "slug": "shelfmark", + "categories": [ + 13 + ], + "date_created": "2026-01-24", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8084, + "documentation": "https://github.com/calibrain/shelfmark/tree/main/docs", + "website": "https://github.com/calibrain/shelfmark", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/shelfmark.webp", + "config_path": "/etc/shelfmark", + "description": "Shelfmark is a unified web interface for searching and aggregating books and audiobook downloads from multiple sources - all in one place.", + "install_methods": [ + { + "type": "default", + "script": "ct/shelfmark.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 6, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Check `https://github.com/calibrain/shelfmark/blob/main/docs/environment-variables.md` for more configuration options you can add to `/etc/shelfmark/.env`", + "type": "info" + } + ] +} diff --git a/install/shelfmark-install.sh b/install/shelfmark-install.sh new file mode 100644 index 000000000..da999c380 --- /dev/null +++ b/install/shelfmark-install.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: vhsdream +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://github.com/calibrain/shelfmark + +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 \ + unrar-free +msg_ok "Installed Dependencies" + +NODE_VERSION="22" setup_nodejs +PYTHON_VERSION="3.12" setup_uv + +fetch_and_deploy_gh_release "shelfmark" "calibrain/shelfmark" "tarball" "latest" "/opt/shelfmark" + +msg_info "Building Shelfmark frontend" +cd /opt/shelfmark/src/frontend +$STD npm ci +$STD npm run build +msg_ok "Built Shelfmark frontend" + +msg_info "Configuring Shelfmark" +cd /opt/shelfmark +$STD uv venv ./venv +$STD source ./venv/bin/activate +$STD uv pip install -r requirements-base.txt +mkdir -p {/var/log/shelfmark,/tmp/shelfmark,/etc/shelfmark} +cat </etc/shelfmark/.env +DOCKERMODE=false +CONFIG_DIR=/etc/shelfmark +TMP_DIR=/tmp/shelfmark +ENABLE_LOGGING=true +FLASK_HOST=0.0.0.0 +FLASK_PORT=8084 +# SESSION_COOKIES_SECURE=true +# CWA_DB_PATH= +USE_CF_BYPASS=true +USING_EXTERNAL_BYPASSER=true +# EXT_BYPASSER_URL= +# EXT_BYPASSER_PATH= +EOF +msg_ok "Configured Shelfmark" + +msg_info "Creating Service and start script" +cat </etc/systemd/system/shelfmark.service +[Unit] +Description=Shelfmark server +After=network.target + +[Service] +Type=simple +WorkingDirectory=/opt/shelfmark +EnvironmentFile=/etc/shelfmark/.env +ExecStart=/usr/bin/bash /opt/shelfmark/start.sh +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF + +cat </opt/shelfmark/start.sh +#!/usr/bin/env bash + +source /opt/shelfmark/venv/bin/activate +set -a +source /opt/shelfmark/.env +set +a + +gunicorn --worker-class geventwebsocket.gunicorn.workers.GeventWebSocketWorker --workers 1 -t 300 -b 0.0.0.0:8084 shelfmark.main:app +EOF +chmod +x /opt/shelfmark/start.sh + +systemctl enable -q --now shelfmark +msg_ok "Created Services and start script" + +motd_ssh +customize +cleanup_lxc