Metadata-Version: 2.5
Name: borgitory
Version: 3.1.1
Summary: A comprehensive web-based management interface for BorgBackup repositories with real-time monitoring, automated scheduling, and cloud synchronization capabilities.
Project-URL: Homepage, https://borgitory.com
Project-URL: Repository, https://github.com/mlapaglia/Borgitory
Project-URL: Issues, https://github.com/mlapaglia/Borgitory/issues
Author-email: mlapaglia <mlapaglia@users.noreply.github.com>
License: MIT License
        
        Copyright (c) 2025 Matt LaPaglia
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: archive-management,backup,borgbackup,cloud-sync,scheduling,web-interface
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: System :: Archiving :: Backup
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.14
Requires-Dist: aiofiles>=25.1.0
Requires-Dist: aiosqlite>=0.21.0
Requires-Dist: alembic>=1.18.2
Requires-Dist: apprise<3,>=2.0.1
Requires-Dist: apscheduler>=3.11.2
Requires-Dist: bcrypt>=5.0.0
Requires-Dist: cron-descriptor>=2.0.6
Requires-Dist: cryptography>=46.0.5
Requires-Dist: docker>=7.1.0
Requires-Dist: fastapi>=0.128.4
Requires-Dist: greenlet>=3.2.0
Requires-Dist: jinja2>=3.1.6
Requires-Dist: pydantic>=2.12.5
Requires-Dist: python-dotenv>=1.2.1
Requires-Dist: python-multipart>=0.0.22
Requires-Dist: sqlalchemy>=2.0.46
Requires-Dist: sse-starlette>=3.2.0
Requires-Dist: urllib3>=2.6.3
Requires-Dist: uvicorn[standard]>=0.40.0
Provides-Extra: dev
Requires-Dist: debugpy>=1.8.20; extra == 'dev'
Requires-Dist: djlint>=1.46.4; extra == 'dev'
Requires-Dist: httpx>=0.28.1; extra == 'dev'
Requires-Dist: mypy>=1.19.1; extra == 'dev'
Requires-Dist: pre-commit>=4.5.1; extra == 'dev'
Requires-Dist: pytest-asyncio>=1.3.0; extra == 'dev'
Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
Requires-Dist: pytest-playwright>=0.7.2; extra == 'dev'
Requires-Dist: pytest>=9.0.2; extra == 'dev'
Requires-Dist: ruff>=0.15.0; extra == 'dev'
Requires-Dist: types-aiofiles>=25.1.0.20251011; extra == 'dev'
Requires-Dist: types-python-dateutil>=2.9.0.20260124; extra == 'dev'
Description-Content-Type: text/markdown


# Borgitory
[![OpenSSF Baseline](https://www.bestpractices.dev/projects/12059/baseline)](https://www.bestpractices.dev/projects/12059)
[![codecov](https://codecov.io/gh/mlapaglia/Borgitory/graph/badge.svg?token=3XFFTWSKTB)](https://codecov.io/gh/mlapaglia/Borgitory)
[![build](https://img.shields.io/github/actions/workflow/status/mlapaglia/borgitory/build.yml?logo=github)](https://github.com/mlapaglia/Borgitory/actions/workflows/release.yml)
[![sponsors](https://img.shields.io/github/sponsors/mlapaglia?logo=githubsponsors)](https://github.com/sponsors/mlapaglia)
[![docker pulls](https://img.shields.io/docker/pulls/mlapaglia/borgitory?logo=docker&label=pulls)](https://hub.docker.com/r/mlapaglia/borgitory)
[![pypi downloads](https://img.shields.io/pypi/dm/borgitory?style=flat&logo=pypi&logoColor=%23ffd343&label=downloads&labelColor=%23ffd343&link=https%3A%2F%2Fpypi.org%2Fproject%2Fborgitory%2F)](https://pypi.org/project/borgitory/)
[![Read the Docs](https://img.shields.io/readthedocs/borgitory?logo=readthedocs)](https://borgitory.com)

[![borgbackup version](https://img.shields.io/badge/dynamic/regex?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmlapaglia%2FBorgitory%2Frefs%2Fheads%2Fmain%2FDockerfile&search=ARG%20BORGBACKUP_VERSION%3D(.%2B)&replace=%241&logo=borgbackup&label=BorgBackup)](https://borgbackup.readthedocs.io/)
[![rclone version](https://img.shields.io/badge/dynamic/regex?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmlapaglia%2FBorgitory%2Frefs%2Fheads%2Fmain%2FDockerfile&search=ARG%20RCLONE_VERSION%3D(.%2B)&replace=%241&logo=rclone&label=Rclone)](https://rclone.org/)
[![fuse3 version](https://img.shields.io/badge/dynamic/regex?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmlapaglia%2FBorgitory%2Frefs%2Fheads%2Fmain%2FDockerfile&search=ARG%20FUSE3_VERSION%3D(.%2B)&replace=%241&logo=python&label=pfuse3)](https://github.com/libfuse/libfuse)

<img alt="borgitory logo" src="./assets/logo.png" width="400">

Borgitory is a comprehensive web-based management interface for BorgBackup repositories that provides real-time monitoring, automated scheduling, and cloud synchronization capabilities. It offers complete backup lifecycle management including on-demand backups, automated pruning policies, interactive archive browsing with file downloads, and cloud sync to S3-compatible storage via Rclone. The FastAPI powered system features a modern responsive web interface built with HTMX, and Tailwind CSS.

## Quick Start

- full documentation is available at <https://borgitory.com>

### Prerequisites

- **Docker Installation (Recommended)**: Docker with Docker Compose for containerized deployment
- **PyPI Installation**: Python 3.14+ for direct installation from PyPI

### Installation

#### Option 1: Docker Installation (Recommended)

1. **Pull and run the Docker image**

   ```bash
   # Using Docker directly
   docker run -d \
     -p 8000:8000 \
     -v ./data:/app/data \
     -v /path/to/backup/sources:/backup/sources:ro \
     -v /path/to/borg/repos:/repos \
     --cap-add SYS_ADMIN \
     --device /dev/fuse \
     --name borgitory \
     mlapaglia/borgitory:latest
   ```

   **Or using Docker Compose** (create a `docker-compose.yml`):

   ```yaml
   version: '3.8'
   services:
     borgitory:
       image: mlapaglia/borgitory:latest
       ports:
         - "8000:8000"
       volumes:
         - ./data:/app/data # database and encryption key location
         - /path/to/backup/sources:/sources:ro
         - /path/to/any/backup/repos:/repos:ro
       cap_add:
         - SYS_ADMIN # optional, needed to mount borg archives and browse them
       devices:
         - /dev/fuse # borg uses FUSE to mount archives
       restart: unless-stopped
   ```

   ```bash
   docker-compose up -d
   ```

2. **Access the web interface**
   - Open <http://localhost:8000> in your browser
   - Create your first admin account on initial setup

<img width="1237" height="729" alt="image" src="https://github.com/user-attachments/assets/078ce596-3ba2-4b6f-ba3f-c2d8b95e02db" />

#### Option 2: PyPI Installation

Install Borgitory directly from PyPI:

```bash
# Install stable release from PyPI
pip install borgitory

# Start the server
borgitory serve

# Or run with custom settings
borgitory serve --host 0.0.0.0 --port 8000
```

**PyPI Installation Requirements:**

- Python 3.14 or higher
- BorgBackup installed and available in PATH
- Rclone (optional, for cloud sync features)
- FUSE (optional, for browsing archives)

**Windows Requirements:**

- WSL2 (Windows Subsystem for Linux) must be installed and configured
- Inside WSL2, you need:
  - BorgBackup installed (`sudo apt install borgbackup` or similar)
  - Python 3.14+ installed
  - Rclone installed (optional, for cloud sync features)
- BorgBackup does not have a native Windows executable, so WSL2 is required for all backup operations

### Running behind a reverse proxy (HTTPS)

| Variable | Default | Purpose |
|---|---|---|
| `BORGITORY_SECURE_COOKIES` | auto | `true` marks the session cookie `Secure`. Set it when TLS terminates at a proxy; by default the cookie is only `Secure` when Borgitory itself sees an `https` request. |
| `BORGITORY_TRUSTED_ORIGINS` | *(empty)* | Comma-separated origins (e.g. `https://backup.example.com`) allowed to make state-changing requests if your proxy rewrites the `Host` header and your browser does not send `Sec-Fetch-Site`. Not normally needed. |

Borgitory rejects cross-site `POST`/`PUT`/`PATCH`/`DELETE` requests (CSRF protection), and throttles repeated failed logins per client IP.

The container exposes an unauthenticated `GET /health` endpoint for health checks; the image's `HEALTHCHECK` uses it.

### Development with Docker

`docker-compose.yml` runs the production image. To attach a debugger, layer the development override, which builds the `dev` image target and publishes debugpy on `127.0.0.1:5678` only:

```bash
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
```

Python dependencies are pinned with hashes in `requirements.txt` (runtime) and `requirements-dev.txt` (development). After changing dependencies in `pyproject.toml`, regenerate them:

```bash
uv pip compile pyproject.toml --universal --generate-hashes --python-version 3.14 -o requirements.txt
uv pip compile pyproject.toml --extra dev --universal --generate-hashes --python-version 3.14 -o requirements-dev.txt
```

### Remote Repositories (SSH)

Borgitory can back up directly to a repository on a remote borg server, such as BorgBase, a Hetzner Storage Box, or another machine running borg. This keeps an off-site copy that is a separate borg repository rather than an rclone mirror of a local one, so corruption of the local repository does not spread to it. This is not full ransomware protection on its own: a backup that runs after files are encrypted stores the encrypted files, and prune can remove older clean archives. Use append-only mode (below) and a retention policy that keeps older archives.

Remote repositories need an SSH client (`ssh`) on the machine running borg. The Docker image includes one; for PyPI installs, install it alongside borg (for example `sudo apt install openssh-client`).

When creating or importing a repository, enter an `ssh://` URL as the path:

- BorgBase: `ssh://abcd1234@abcd1234.repo.borgbase.com/./repo`
- Hetzner Storage Box: `ssh://u123456@u123456.your-storagebox.de:23/./backups/repo` (set **Remote Borg Path** to `borg-1.4`)
- Your own server: `ssh://borg@nas.example.com/./borg/repo` (`/./` means relative to the user's home directory)

Paste the SSH private key into the form and add its public key to the server's `authorized_keys`. The key is stored encrypted in the database. The server's host key is trusted on first connection and saved in `<data dir>/ssh/known_hosts`. If the host key later changes deliberately, remove the old entry with `ssh-keygen -R host -f <data dir>/ssh/known_hosts` for port 22, or `ssh-keygen -R "[host]:port" -f <data dir>/ssh/known_hosts` for any other port.

For backups that can't be deleted from the client, restrict the key on the server to append-only mode in `authorized_keys`, for example `command="borg serve --append-only --restrict-to-path /home/borg/repo",restrict ssh-ed25519 AAAA...`. Borgitory can't enforce this itself, and in append-only mode prune and compact won't free space on the server.

Cloud sync only applies to local repositories and is skipped for remote ones.
