Files
SnapOtter/apps/docs/zh-CN/guide/getting-started.md
T
SnapOtterandGitHub d10d0f544f fix: release QA hardening across processing, media, security, and CI gates (#649)
A release-readiness QA pass over the whole product. The commits split into
defects a user would hit and gates that were reporting green while measuring
nothing.

## Fixes that change behaviour

Rate limiting was bypassable on every install: TRUST_PROXY defaulted to true, so
request.ip came from a client-set header and a forged X-Forwarded-For got past
the login limiter. The default is now a private-network trust list.

A transient Postgres outage stranded in-flight jobs, leaving finished output on
disk with no row pointing at it. A reconciler now resolves those rows and adopts
the bytes rather than dropping the work.

A Redis connection that moved to a new address wedged every read-blocked
consumer, so completions stopped signalling while health still answered 200.
Socket timeouts plus subscriber pings recover it.

Installing more than one AI bundle left the shared venv multi-versioned and
silently broke three tools. The installer now reconciles distributions to one
version each.

Converting an image to JXL at quality 1 through 4 returned a 500, because
libjxl 0.7 rejects the distance those values compute. The quality is floored at
what the encoder honours. A missing ffmpeg was also reported to the user as a
corrupt upload; it now says the engine is unavailable.

RAW uploads reached an unpatched LibRaw on arm64, so it is built from source at
0.22.2, and the release scan was split so it can fail on an unfixed critical
instead of hiding it behind ignore-unfixed.

## Gates that could not fail

Two mutation lanes ran zero mutants because Stryker crawled the gitignored docs
build; coverage discarded its whole report on any failing test; the lint gate
skipped root tests, scripts, and two workspaces; and several generated matrices
counted a host missing ffmpeg as a passing tool. Each now measures what it
claims.

Full evidence and the outstanding release items are tracked locally and are not
part of this branch.
2026-07-27 15:37:30 +08:00

7.2 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash, i18n_hash_version
description i18n_source_hash i18n_provenance i18n_output_hash i18n_hash_version
用一条 Docker 命令安装 SnapOtter。包含 Docker Compose 配置、从源码构建,以及完整的功能概览。 8040133a6982 machine 00a743d88802 2

快速上手

::: tip 安装前先试用 在 demo.snapotter.com 体验完整 UI - 无需注册或安装。 :::

快速开始

docker run -d --name SnapOtter -p 1349:1349 -v SnapOtter-data:/data snapotter/snapotter:latest

这个单一容器运行它所需的一切:在没有设置 DATABASE_URL 的情况下,它在环回接口(嵌入模式)上启动自己的 PostgreSQL 和 Redis,并将所有数据保存在 SnapOtter-data 卷中。这是在家庭实验室上尝试 SnapOtter 或自托管的最快方法。对于生产,请使用规范的 Docker Compose 堆栈,它将 PostgreSQL 和 Redis 保留在自己的容器中。嵌入模式以 root 身份运行(默认),并在您设置 DATABASE_URL 后自动关闭。

要安装在 Raspberry Pi、旧笔记本电脑或小型 VPS 上?参阅低资源环境部署,那里有调优后的分步指南,以及对受限硬件该有的预期。

首次登录时会要求你更改密码。

::: tip 匿名产品分析 SnapOtter 默认包含匿名产品分析。要关闭它,请打开 Settings → System → Privacy,关闭 Anonymous Product Analytics。它会立即对整个实例停止。

你也可以设置环境变量 SNAPOTTER_TELEMETRY=0falseoff 同样有效)来为整个实例禁用所有遥测,无需重新构建。

错误监控由 Sentry 提供,它通过其开源计划赞助 SnapOtter。

关于收集内容的详情,请参阅 SnapOtter 收集的内容。 :::

::: tip NVIDIA CUDA 加速 添加 --gpus all 以实现 NVIDIA CUDA 加速的背景去除、放大、面部增强和恢复。 OCR 仍然基于 CPU,并且在有或没有 GPU 访问的情况下在同一映像中工作:

docker run -d --name SnapOtter -p 1349:1349 --gpus all -v SnapOtter-data:/data snapotter/snapotter:latest

需要 NVIDIA 容器工具包。当 CUDA 不可用时自动回退到 CPU。目前,AI 推理不支持通过 VA-API、Quick Sync 或 OpenCL 进行 Intel/AMD iGPU 加速。请参阅 Docker 标签 了解基准。如果 AI 工具在 CPU 上运行(尽管 --gpus all),请参阅验证 GPU 加速。 :::

::: details 也可在 GHCR 获取

docker run -d --name SnapOtter -p 1349:1349 -v SnapOtter-data:/data ghcr.io/snapotter-hq/snapotter:latest

两个镜像仓库在每次发布时都会发布相同的镜像。 :::

Docker 编写

使用每个版本维护和测试的生产文件,而不是从此页面复制缩写的 Compose 示例:

install -d -m 700 snapotter && cd snapotter
curl --proto '=https' --tlsv1.2 -fsSLo docker-compose.yml \
  https://raw.githubusercontent.com/snapotter-hq/SnapOtter/v2.1.0/docker/docker-compose.yml

# Keep generated service credentials out of shell history and world-readable files.
umask 077
POSTGRES_PASSWORD="$(openssl rand -hex 32)"
REDIS_PASSWORD="$(openssl rand -hex 32)"
printf 'POSTGRES_PASSWORD=%s\nREDIS_PASSWORD=%s\n' \
  "$POSTGRES_PASSWORD" "$REDIS_PASSWORD" > .env

docker compose -f docker-compose.yml pull
docker compose -f docker-compose.yml up -d --no-build

规范的 docker/docker-compose.yml 包括所有四个运行时卷、运行状况检查、资源限制、持久 Redis 配置、固定数据库/缓存映像以及当前容器强化。首次登录后立即更改默认管理员密码。对于可重现的部署,请将 SnapOtter 应用程序映像固定到您验证的发布标签或摘要,而不是遵循 latest

有关所有环境变量,请参阅配置;有关机密、网络策略和备份指南,请参阅安全和强化

从源码构建

前置条件: Node.js 22.22+、pnpm 9+、Docker(用于 Postgres + Redis)、Python 3.11+(用于 AI 功能)、Git。

git clone https://github.com/snapotter-hq/SnapOtter.git
cd SnapOtter
docker compose -f docker-compose.dev.yml up -d   # start Postgres + Redis
pnpm install
pnpm dev

你能做什么

文件处理(200+ 工具)

模态 数量 示例工具
图像 107 缩放、裁剪、压缩、转换、背景移除、放大、OCR、水印、拼贴、上色、GIF 工具、格式预设
视频 57 剪辑、裁剪、压缩、转换、合并、提取音频、自动字幕、视频转 GIF、缩放、防抖、格式预设
音频 27 剪辑、合并、转换、归一化、降噪、转录、变调、淡入淡出、铃声制作、格式预设
PDF / 文档 29 合并、拆分、压缩、OCR、水印、涂黑、Word 转 PDF、Excel 转 PDF、旋转、加密、修复
文件 23 CSV 转 JSON、JSON 转 XML、合并 CSV、拆分 CSV、创建 ZIP、解压 ZIP、图表制作、YAML/JSON

流水线

将工具串联成多步骤工作流,并将其应用于单张图像或整个批次:

  1. 在侧边栏中打开 Pipelines
  2. 添加步骤(任意工具、任意设置)。
  3. 对单个文件运行 - 或一次性对整批文件运行。
  4. 保存流水线以便日后复用。

流水线默认允许 20 个步骤。设置 MAX_PIPELINE_STEPS=0 可使该限制变为无限制。

文件库

你处理的每个文件都可以保存到你的 Files 库中。SnapOtter 会跟踪完整的版本历史,让你能够追溯从原始上传到最终输出的每一个处理步骤。

保存是显式的:保存到库中的结果会一直保留,直到你删除它们;而你处理后未保存的结果会在 72 小时后自动清除(可通过 FILE_MAX_AGE_HOURS 配置)。

REST API 与 API 密钥

每个工具都可通过 HTTP 访问:

curl -X POST http://localhost:1349/api/v1/tools/image/resize \
  -H "Authorization: Bearer si_<your-api-key>" \
  -F "file=@photo.jpg" \
  -F 'settings={"width":800,"height":600,"fit":"cover"}'

Settings → API Keys 下生成 API 密钥。所有端点请参阅 REST API 参考,或访问 http://localhost:1349/api/docs 查看交互式参考。

多用户与团队

启用基于角色的访问控制的多用户功能:

  • Admin:完全访问 - 管理用户、团队、设置,以及所有文件/流水线/API 密钥
  • User:使用工具,管理自己的文件/流水线/API 密钥

Settings → Teams 下创建团队以对用户分组。

设置 AUTH_ENABLED=true(或对单用户/自用无需登录的场景设置 false)。