# Backrest — web UI over restic repositories.
#
# Role here: single central viewer for every host's restic repo on both
# site-local rest-servers (ana-docker writing to the Debian NFS server
# at 10.250.50.50, Synology at 10.100.50.50 writing to its local Btrfs).
# Per-host
# `restic` runs will still be driven by systemd timers on each host; this
# stack is how we see what ran, browse snapshots, and restore.
#
# Repos and S3 credentials are configured in the Backrest UI after first
# boot — nothing baked into this file. Data (its own SQLite + queue) lives
# in a named volume so the config survives container recreation.
#
# All tunables live in .env — edit that, not this file.

services:
  backrest:
    image: garethgeorge/backrest:${BACKREST_VERSION}
    container_name: backrest
    hostname: backrest
    restart: unless-stopped
    ports:
      - "${BACKREST_PORT}:9898"
    volumes:
      - backrest_data:/data
      - backrest_config:/config
      - backrest_cache:/cache
      - backrest_tmp:/tmp
    environment:
      - BACKREST_DATA=/data
      - BACKREST_CONFIG=/config/config.json
      - XDG_CACHE_HOME=/cache
      - TMPDIR=/tmp
      - TZ=${TZ:-America/Los_Angeles}
      - BACKREST_PORT=0.0.0.0:9898
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost:9898/"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 15s
    networks:
      - tnet
    labels:
      - homepage.group=Monitoring
      - homepage.name=Backrest
      - homepage.icon=mdi-backup-restore
      - homepage.description=Restic snapshot viewer / restore UI
      - homepage.href=http://10.250.50.70:${BACKREST_PORT}

volumes:
  backrest_data:
  backrest_config:
  backrest_cache:
  backrest_tmp:

networks:
  tnet:
    name: traefik-net
    external: true
