From 0638c23d76720a8f59def53c8bdcb215b5b40793 Mon Sep 17 00:00:00 2001 From: MickLesk Date: Wed, 27 May 2026 08:12:44 +0200 Subject: [PATCH] snapotter --- ct/snapotter.sh | 69 ++++++++++++++++++++++++++++++ install/snapotter-install.sh | 83 ++++++++++++++++++++++++++++++++++++ json/snapotter.json | 42 ++++++++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 ct/snapotter.sh create mode 100644 install/snapotter-install.sh create mode 100644 json/snapotter.json diff --git a/ct/snapotter.sh b/ct/snapotter.sh new file mode 100644 index 00000000..8ccd4d21 --- /dev/null +++ b/ct/snapotter.sh @@ -0,0 +1,69 @@ +#!/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: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://snapotter.com + +APP="SnapOtter" +var_tags="${var_tags:-media;image}" +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_unprivileged="${var_unprivileged:-1}" +var_arm64="${var_arm64:-no}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/snapotter ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + if check_for_gh_release "snapotter" "snapotter-hq/SnapOtter"; then + msg_info "Stopping Service" + systemctl stop snapotter + msg_ok "Stopped Service" + + msg_info "Backing up Data" + cp -r /opt/snapotter/data /opt/snapotter_data_backup + msg_ok "Backed up Data" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "snapotter" "snapotter-hq/SnapOtter" "tarball" + + cd /opt/snapotter + $STD npm pkg delete scripts.prepare + $STD pnpm install --frozen-lockfile + $STD pnpm --filter @snapotter/web build + + msg_info "Restoring Data" + cp -r /opt/snapotter_data_backup/. /opt/snapotter/data + rm -rf /opt/snapotter_data_backup + msg_ok "Restored Data" + + msg_info "Starting Service" + systemctl start snapotter + 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}:1349${CL}" diff --git a/install/snapotter-install.sh b/install/snapotter-install.sh new file mode 100644 index 00000000..9d58ed69 --- /dev/null +++ b/install/snapotter-install.sh @@ -0,0 +1,83 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://snapotter.com + +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 \ + imagemagick \ + ghostscript \ + potrace \ + libopenjp2-tools +msg_ok "Installed Dependencies" + +NODE_VERSION="22" setup_nodejs + +msg_info "Enabling pnpm" +$STD corepack enable +$STD corepack prepare pnpm@9.15.4 --activate +msg_ok "Enabled pnpm" + +fetch_and_deploy_gh_release "snapotter" "snapotter-hq/SnapOtter" "tarball" + +msg_info "Building SnapOtter" +mkdir -p /opt/snapotter/data/files +cd /opt/snapotter +$STD npm pkg delete scripts.prepare +$STD pnpm install --frozen-lockfile +$STD pnpm --filter @snapotter/web build +msg_ok "Built SnapOtter" + +msg_info "Configuring SnapOtter" +cat </opt/snapotter/.env +PORT=1349 +NODE_ENV=production +DB_PATH=/opt/snapotter/data/snapotter.db +WORKSPACE_PATH=/tmp/snapotter-workspace +FILES_STORAGE_PATH=/opt/snapotter/data/files +AUTH_ENABLED=true +DEFAULT_USERNAME=admin +DEFAULT_PASSWORD=admin +LOG_LEVEL=info +TRUST_PROXY=true +FILE_MAX_AGE_HOURS=72 +CLEANUP_INTERVAL_MINUTES=60 +EOF +mkdir -p /tmp/snapotter-workspace +msg_ok "Configured SnapOtter" + +msg_info "Creating Service" +PNPM_BIN=$(which pnpm) +cat </etc/systemd/system/snapotter.service +[Unit] +Description=SnapOtter Service +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/snapotter +EnvironmentFile=/opt/snapotter/.env +ExecStart=${PNPM_BIN} --filter @snapotter/api run start +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now snapotter +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc diff --git a/json/snapotter.json b/json/snapotter.json new file mode 100644 index 00000000..caa718b9 --- /dev/null +++ b/json/snapotter.json @@ -0,0 +1,42 @@ +{ + "name": "SnapOtter", + "slug": "snapotter", + "categories": [13], + "date_created": "2026-05-27", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 1349, + "documentation": "https://docs.snapotter.com/", + "website": "https://snapotter.com/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/snapotter.webp", + "description": "SnapOtter is a self-hosted, privacy-first image processing toolbox with 50+ tools including background removal, upscaling, format conversion, OCR, face enhancement, and more — all running locally in your browser and on your server.", + "install_methods": [ + { + "type": "default", + "script": "ct/snapotter.sh", + "config_path": "/opt/snapotter/.env", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 10, + "os": "Debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": "admin", + "password": "admin" + }, + "notes": [ + { + "text": "Change the default password after first login!", + "type": "warning" + }, + { + "text": "AI features (background removal, upscaling, OCR, etc.) are installed on-demand via the settings page and require additional disk space and RAM.", + "type": "info" + } + ] +}