Backrest – 用于 restic 备份的 Web UI 和编排工具
Backrest – a web UI and orchestrator for restic backup

原始链接: https://github.com/garethgeorge/backrest

Backrest 是一个轻量级的 **restic** Web 界面,旨在简化备份管理的同时,保留原命令行工具的强大功能。它基于 Go 语言构建,提供直观的 Web UI,让用户能够轻松创建存储库、定时自动备份、执行维护任务并恢复文件。 **主要功能包括:** * **全方位管理:** 支持定时任务(cron)快照、存储库健康检查(修剪/清理)以及备份前后的命令钩子。 * **多功能存储:** 完全兼容所有 restic 后端(S3、B2、Azure、GCS、SFTP、本地)及 rclone 远程存储。 * **广泛兼容性:** 可作为独立二进制文件在 Linux、macOS、Windows、FreeBSD 和 Docker 上运行,并自动管理其 restic 依赖项。 * **警报提醒:** 支持通过 Discord、Slack、Healthchecks 等渠道进行自定义通知。 Backrest 非常适合 NAS 部署,或希望在 restic 稳健、安全且加密的备份引擎之上使用友好管理层的用户。无论是通过脚本、Homebrew 还是 Docker 安装,Backrest 都能作为本地和远程备份操作的无缝协调器。详细文档和贡献指南可在项目仓库中查看。

Hacker News 的讨论重点介绍了两款用于管理 **Restic** 备份的工具。 主贴介绍了一款名为 **Backrest** 的工具,它是一个旨在简化 Restic 管理的网页界面和编排器。 在评论区,一位用户分享了他个人分叉(fork)的 **Restic Scheduler**。这是一个基于 Mac 的项目,旨在提供类似 Backblaze 那种“设置后即可忽略”的自动化体验。该工具具备菜单栏界面、智能自动排除(包含 Brewfile 集成)以及成本估算功能。 该开发者是一位资深软件工程师,他在开发过程中利用 AI(Codex)辅助编写了 Swift 组件。目前该项目已在 GitHub 上开源,适用于能够通过 Xcode 自行编译的用户。这种方案相比商业云备份服务可显著节省成本,搭配 B2 存储使用时,750GB 存储空间的年费用约为 52 美元。
相关文章

原文


Overview

Backrest is a web-accessible backup solution built on top of restic. Backrest provides a WebUI which wraps the restic CLI and makes it easy to create repos, browse snapshots, and restore files. Additionally, Backrest can run in the background and take an opinionated approach to scheduling snapshots and orchestrating repo health operations.

By building on restic, Backrest leverages its mature, fast, reliable, and secure backup capabilities while adding an intuitive interface.

Built with Go, Backrest is distributed as a standalone, lightweight binary with restic as its sole dependency. It can securely create new repositories or manage existing ones. Once storage is configured, the WebUI handles most operations, while still allowing direct access to the powerful restic CLI for advanced operations when needed.

  • Web Interface: Access locally or remotely (perfect for NAS deployments)
  • Multi-Platform Support:
    • Linux
    • macOS
    • Windows
    • FreeBSD
    • Docker
  • Backup Management:
    • Import existing restic repositories
    • Cron-scheduled backups and maintenance (e.g. prune, check, forget, etc)
    • Browse and restore files from snapshots
    • Configurable notifications (Discord, Slack, Shoutrrr, Gotify, Healthchecks)
    • Pre/post backup command hooks to execute shell scripts
  • Storage Options:
    • Compatible with rclone remotes
    • Supports all restic storage backends (S3, B2, Azure, GCS, local, SFTP, and all rclone remotes)


See the Backrest docs.


Backrest is packaged as a single executable. It runs directly on Linux, macOS, and Windows. restic is downloaded automatically on first run.

Once installed, access Backrest at http://localhost:9898 (default port). First-time setup will prompt for username and password creation.

Note

To change the default port, set the BACKREST_PORT environment variable (e.g., BACKREST_PORT=0.0.0.0:9898 to listen on all interfaces). The install script accepts --allow-remote-access as a shortcut for this.

Backrest will use your system's installed version of restic if it's available and compatible. If not, Backrest will download and install a suitable version in its data directory, keeping it updated. To use a specific restic binary, set the BACKREST_RESTIC_COMMAND environment variable to the desired path.

Linux & macOS (Recommended)

The install script downloads the latest release, drops the binary into /usr/local/bin, and sets up the appropriate auto-start integration (systemd or OpenRC on Linux; launchd on macOS):

curl -fsSL https://raw.githubusercontent.com/garethgeorge/backrest/main/install.sh | bash

Flags go after --:

# Bind to all interfaces (default: 127.0.0.1:9898)
curl -fsSL https://raw.githubusercontent.com/garethgeorge/backrest/main/install.sh | bash -s -- --allow-remote-access

# Uninstall (removes service, autostart entry, and /usr/local/bin/backrest)
curl -fsSL https://raw.githubusercontent.com/garethgeorge/backrest/main/install.sh | bash -s -- --uninstall

The service runs as your user by default (so config and data live under your $HOME). To install as root instead, pass --root. After install, access Backrest at http://localhost:9898.

Tip

Review install.sh before piping it into a shell. You can also clone the repo and run ./install.sh locally; it accepts the same flags.

macOS — Homebrew (alternative)

Homebrew tap:

brew tap garethgeorge/homebrew-backrest-tap
brew install backrest
brew services start backrest

Note

You may need to grant Full Disk Access to Backrest. Go to System Preferences > Security & Privacy > Privacy > Full Disk Access and add /usr/local/bin/backrest.

Backrest on AUR is third-party (not maintained by the Backrest project) and tweaks the systemd unit; see the AUR service file for details.

paru -Sy backrest  # or: yay -Sy backrest
sudo systemctl enable --now backrest@$USER.service

Image: ghcr.io/garethgeorge/backrest (also on Docker Hub).

  • Includes rclone and common Unix utilities
  • For a minimal image, use ghcr.io/garethgeorge/backrest:scratch
version: "3.8"
services:
  backrest:
    image: ghcr.io/garethgeorge/backrest:latest
    container_name: backrest
    hostname: backrest
    volumes:
      - ./backrest/data:/data
      - ./backrest/config:/config
      - ./backrest/cache:/cache
      - ./backrest/tmp:/tmp
      - ./backrest/rclone:/root/.config/rclone # Mount for rclone config (needed when using rclone remotes)
      - /path/to/backup/data:/userdata  # Mount local paths to backup
      - /path/to/local/repos:/repos     # Mount local repos (optional for remote storage)
    environment:
      - BACKREST_DATA=/data
      - BACKREST_CONFIG=/config/config.json
      - XDG_CACHE_HOME=/cache
      - TMPDIR=/tmp
      - TZ=America/Los_Angeles
    ports:
      - "9898:9898"
    restart: unless-stopped

Download the Windows installer for your architecture from the releases page. The installer, named Backrest-setup-[arch].exe, places Backrest and a GUI tray application in %localappdata%\Programs\Backrest\. The tray application, set to start on login, monitors Backrest.

Tip

To override the default port before installation, set a user environment variable named BACKREST_PORT. On Windows 10+, navigate to Settings > About > Advanced system settings > Environment Variables. Under "User variables", create a new variable BACKREST_PORT with the value 127.0.0.1:port (e.g. 127.0.0.1:8080). If changing post-installation, re-run the installer to update shortcuts with the new port.


Environment Variables (Unix)

Variable Description Default
BACKREST_PORT Port to bind to 127.0.0.1:9898 (or 0.0.0.0:9898 for the docker images)
BACKREST_CONFIG Path to config file $HOME/.config/backrest/config.json
(or, if $XDG_CONFIG_HOME is set, $XDG_CONFIG_HOME/backrest/config.json)
BACKREST_DATA Path to the data directory $HOME/.local/share/backrest
(or, if $XDG_DATA_HOME is set, $XDG_DATA_HOME/backrest)
BACKREST_RESTIC_COMMAND Path to restic binary Defaults to a Backrest managed version of restic at $XDG_DATA_HOME/backrest/restic-x.x.x
XDG_CACHE_HOME Path to the cache directory

Environment Variables (Windows)

Variable Description Default
BACKREST_PORT Port to bind to 127.0.0.1:9898
BACKREST_CONFIG Path to config file %appdata%\backrest\config.json
BACKREST_DATA Path to the data directory %appdata%\backrest\data
BACKREST_RESTIC_COMMAND Path to restic binary Defaults to a Backrest managed version of restic in C:\Program Files\restic\restic-x.x.x
XDG_CACHE_HOME Path to the cache directory

Contributions are welcome! See the issues or feel free to open a new issue to discuss a project. Beyond the core codebase, contributions to documentation, cookbooks, and testing are always welcome.

All build dependencies are defined in shell.nix and can be activated automatically using Nix and direnv.

Using Nix + direnv (Recommended)

  1. Install Nix and direnv
  2. Hook direnv into your shell (e.g. eval "$(direnv hook bash)" in your .bashrc)
  3. Clone the repo and cd into it
  4. Run direnv allow to trust the .envrc — all dependencies (Go, Node.js, pnpm, protoc, buf, etc.) will be available in your shell automatically

If you prefer not to use Nix, install the following manually:

(Optional) To edit protobuf definitions:

apt install -y protobuf-compiler
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install github.com/bufbuild/buf/cmd/buf@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install connectrpc.com/connect/cmd/protoc-gen-connect-go@latest
npm install -g @bufbuild/protoc-gen-es
(cd webui && pnpm i && pnpm run build)
(cd cmd/backrest && go build .)

Using VSCode Dev Containers

The dev container uses Nix and direnv to provide all dependencies. When the container starts, direnv allow runs automatically so the Nix shell is activated in every terminal.

  1. Make sure Docker and VSCode with the Dev Containers extension is installed
  2. Clone this repository
  3. Open this folder in VSCode
  4. When prompted, click on Open in Container button, or run > Dev Containers: Rebuild and Reopen in Containers command
  5. When the container is started, go to Run and Debug, choose Debug Backrest (backend+frontend) and run it

Note

Provided launch configuration has hot reload for the typescript frontend.

Translations are stored in ./webui/messages and are generated using inlang. Machine translations can be updated by running npx @inlang/cli machine translate --project ./project.inlang.

Text is translated on a best-effort basis and is not guaranteed to be accurate. If you find any translations that are incorrect, please submit a pull request to fix them. Contributions here are greatly appreciated!

联系我们 contact @ memedata.com