diff --git a/ct/printventory.sh b/ct/printventory.sh new file mode 100644 index 0000000000..eb459627a5 --- /dev/null +++ b/ct/printventory.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: TechJeeper (TechJeeper) +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://printventory.com | https://github.com/TechJeeper/Printventory + +APP="Printventory" +var_tags="${var_tags:-3dprinting;inventory;models}" +var_cpu="${var_cpu:-4}" +var_ram="${var_ram:-8192}" +var_disk="${var_disk:-20}" +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/printventory ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_branch "printventory" "TechJeeper/Printventory" "main"; then + msg_info "Stopping Printventory" + systemctl stop printventory + msg_ok "Stopped Printventory" + + fetch_and_deploy_gh_branch "printventory" "TechJeeper/Printventory" "main" + + msg_info "Updating Printventory Dependencies (Patience)" + cd /opt/printventory + $STD npm install --ignore-scripts + $STD npx --yes @electron/rebuild --version="$(node -p 'require("electron/package.json").version')" || $STD npx electron-builder install-app-deps + chmod +x /opt/printventory/scripts/run-server.sh + msg_ok "Updated Printventory Dependencies" + + msg_info "Starting Printventory" + systemctl start printventory + msg_ok "Started Printventory" + 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 "${GATEWAY}${BGN}http://${IP}:5000${CL}" diff --git a/install/printventory-install.sh b/install/printventory-install.sh new file mode 100644 index 0000000000..c35d2b2da0 --- /dev/null +++ b/install/printventory-install.sh @@ -0,0 +1,109 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: TechJeeper (TechJeeper) +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://printventory.com | https://github.com/TechJeeper/Printventory + +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 \ + g++ \ + make \ + python3 \ + xvfb \ + dbus \ + chromium \ + chromium-sandbox \ + ca-certificates \ + fonts-liberation \ + libappindicator3-1 \ + libasound2 \ + libatk-bridge2.0-0 \ + libatk1.0-0 \ + libc6 \ + libcairo2 \ + libcups2 \ + libdbus-1-3 \ + libexpat1 \ + libfontconfig1 \ + libgbm1 \ + libgcc1 \ + libglib2.0-0 \ + libgtk-3-0 \ + libnspr4 \ + libnss3 \ + libpango-1.0-0 \ + libpangocairo-1.0-0 \ + libstdc++6 \ + libx11-6 \ + libx11-xcb1 \ + libxcb1 \ + libxcomposite1 \ + libxcursor1 \ + libxdamage1 \ + libxext6 \ + libxfixes3 \ + libxi6 \ + libxrandr2 \ + libxrender1 \ + libxss1 \ + libxtst6 \ + lsb-release \ + wget \ + xdg-utils +msg_ok "Installed Dependencies" + +NODE_VERSION="22" setup_nodejs + +# Upstream publishes no GitHub Releases yet — deploy from main (see AGENTS.md branch helpers). +fetch_and_deploy_gh_branch "printventory" "TechJeeper/Printventory" "main" + +msg_info "Installing Printventory (Patience)" +cd /opt/printventory +$STD npm install --ignore-scripts +# Match upstream Dockerfile: rebuild native modules for the bundled Electron ABI. +$STD npx --yes @electron/rebuild --version="$(node -p 'require("electron/package.json").version')" || $STD npx electron-builder install-app-deps +chmod +x /opt/printventory/scripts/run-server.sh +mkdir -p /root/.config/printventory +msg_ok "Installed Printventory" + +msg_info "Creating Service" +cat </etc/systemd/system/printventory.service +[Unit] +Description=Printventory Server Mode +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/printventory +Environment=DISPLAY=:99 +Environment=PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true +Environment=PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium +Environment=DCONF_DISABLE=1 +Environment=GIO_USE_VFS=local +Environment=GIO_USE_VOLUME_MONITOR=unix +Environment=DBUS_FATAL_WARNINGS=0 +Environment=PRINTVENTORY_GPU=swiftshader +ExecStart=/opt/printventory/scripts/run-server.sh +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now printventory +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc diff --git a/json/printventory.json b/json/printventory.json new file mode 100644 index 0000000000..c460a89bc9 --- /dev/null +++ b/json/printventory.json @@ -0,0 +1,49 @@ +{ + "name": "Printventory", + "slug": "printventory", + "categories": [11], + "date_created": "2026-11-02", + "type": "ct", + "updateable": true, + "privileged": false, + "architectures": ["amd64"], + "platforms": ["pve"], + "interface_port": 5000, + "documentation": "https://github.com/TechJeeper/Printventory/blob/main/README.md", + "website": "https://printventory.com/", + "repository": "https://github.com/TechJeeper/Printventory", + "logo": "https://raw.githubusercontent.com/TechJeeper/Printventory/main/logo.png", + "description": "Printventory indexes local STL, 3MF and related 3D model files, then tracks tags, print status, filament and library organization. Server mode serves the same UI over HTTP on port 5000 for homelab and NAS-style access without uploading models.", + "install_methods": [ + { + "type": "default", + "script": "ct/printventory.sh", + "config_path": "/root/.config/printventory", + "resources": { + "cpu": 4, + "ram": 8192, + "hdd": 20, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Printventory runs Electron headlessly (Xvfb). Defaults are 4 CPU / 8 GB RAM / 20 GB disk — lower RAM often OOMs during thumbnail work.", + "type": "warning" + }, + { + "text": "Bind-mount your model storage into the CT (for example /mnt/models), then set STL Home in Settings to those Linux paths. Files stay on your mounts; nothing is uploaded.", + "type": "info" + }, + { + "text": "Upstream has no GitHub Releases yet, so install and update track the main branch. After you publish Releases, the script can move to fetch_and_deploy_gh_release.", + "type": "info" + } + ] +}