MediaGarrd Self-hosted backups GitHub

Scheduled backups for everything you self-host.

MediaGarrd zips the configuration of the services on your Docker host on a schedule, keeps the newest archives, and has a client on another machine download the newest archive. Any service can be backed up: you give it a name and the host paths that matter.

Backs upAny file or folder on the host
Runs asTwo Docker containers
ArchiveOne .zip per run, mirroring /
Restoresudo ./mgrecover.sh <archive>.zip
Set up fromA web page, no config files

How it works

1 Host paths /srv/radarr/config
/etc/nginx/sites-available
2 Server Mounts each service's paths read-only into a helper container and streams them into a zip.
3 Archive One archive per run. Only the newest are kept (10 by default).
4 Client Downloads the latest archive on its own schedule, on a different machine.
ServerRepo →

Runs next to the services it backs up and talks to Docker through /var/run/docker.sock.

  • Backs up every service on an interval (12 hours by default) and keeps the newest archives.
  • Never starts the helper containers. It only creates them, with the paths mounted read-only, and reads the files out through the Docker API.
  • Stores settings and services in a database on a mounted volume, so they survive rebuilds.
  • Is set up once from /config, unlocked with a Setup PIN from its logs.
  • Shows a Pairing PIN when setup finishes (it is also in the logs). After setup the API needs the token a Client gets by pairing; only the health, version, setup and pairing endpoints stay open.
  • Needs a Linux host.
ClientRepo →

Runs anywhere else on your network. A backup on the same disk as the data doesn't protect much.

  • Finds servers with a quick LAN scan, by IP, or from MEDIAGARRD_SERVER_IP.
  • Downloads the latest archive on an interval (12 hours by default). These copies get an -AD suffix.
  • Starts a backup, downloads any archive, and shows the server's status live: the state flips between Running and Idle as soon as a run starts or finishes, and the archive list refreshes on its own.
  • Shows when the server or the client is unreachable, and when a newer release is available.
  • Pairs with a server using its Pairing PIN, or a pairing code created by a client that is already paired.
  • Once paired, changes the server's settings and services.
  • Protects its dashboard with a password: the first visitor chooses it, or you set CLIENT_PASSWORD.
What it backs up

Anything you can point at. A service is just a name and a list of absolute host paths:

  • A directory includes everything inside it.
  • A file includes only that file.
  • Permissions, owners, modification times and symbolic links are kept.
  • If one path fails, none of it is included and the run is reported as partial, so you never get half a folder.

Demo

This is the Client dashboard, running in your browser against a simulated server that is already set up. Nothing leaves this page. Connect to the server, pair with the Pairing PIN from its logs, then change its configuration and run backups. The dashboard updates live, with no refreshing. The real Client also asks for a dashboard password on first visit, which the demo leaves out.

http://192.168.1.50:8081/
MediaGarrd Client Dashboard
Not Connected
Server Connection

Last scan: not run yet.

Server Status

No server connected.

Backup Archives
Get

No backups loaded. Connect to a server to view archives.

Archives and restoring

Archive Layout

Each entry sits at its absolute host path without the leading /, with no folder per service. Services backing up /etc/nginx/sites-available/default and /srv/radarr/config produce:

etc/nginx/sites-available/default
srv/radarr/config/
srv/radarr/config/config.xml
srv/radarr/config/radarr.db
srv/radarr/config/logs -> /var/log/radarr

Hard links are stored as regular copies, and empty directories are kept. Named pipes, sockets and device files are skipped. If two services back up the same path, it appears once.

The client's archive list updates by itself when a run finishes or retention deletes an old archive.

RestoringREADME →

Restore archives with mgrecover (latest release). It puts every file back at its original path with contents, permissions, owners (as root) and modification times. Unlike plain extraction, it prints a plan and asks for confirmation first, recreates a symbolic link only if its target exists on the machine or in the archive, and refuses the whole archive, before writing anything, if a name is unsafe. It needs bsdtar (the libarchive-tools package on Debian/Ubuntu), bash 4+, coreutils, awk and sed.

curl -fLO https://github.com/MediaGarrd/Recovery/releases/latest/download/mgrecover.sh
chmod +x mgrecover.sh

Stop the MediaGarrd server first: the archive contains its database, and restoring over a running server corrupts it. Then restore:

sudo ./mgrecover.sh 20261026-120000-000-media-backup.zip

To preview, -n prints the plan and writes nothing. To look inside a backup, -C <dir> restores under that directory instead of / and creates no symbolic links.

sudo ./mgrecover.sh -n 20261026-120000-000-media-backup.zip
sudo ./mgrecover.sh -C /tmp/restore 20261026-120000-000-media-backup.zip
Without mgrecover, sudo bsdtar -xpPf <archive>.zip -C / extracts every entry exactly as stored, including links whose targets are missing, with none of these checks. unzip 6.00 doesn't restore owners, and Python's zipfile and most GUI archive managers restore only file contents.

Install

Both parts need Docker with Compose v2, and the server needs a Linux host. The defaults in each compose file work as-is.

1. Server, on the Docker hostREADME →
git clone --depth 1 https://github.com/MediaGarrd/Server.git
cd Server
cp docker-compose.example.yml docker-compose.yml
docker compose up --build -d

Get the Setup PIN from the logs:

docker logs mediagarrd-server 2>&1 | grep "Setup PIN"

Then open http://<server-ip>:38471/config, enter the Setup PIN, add your services and press Finish Setup.

Finish Setup shows a Pairing PIN. It is also printed in the logs, and it stops working once a Client has paired:

docker logs mediagarrd-server 2>&1 | grep "Pairing PIN"
2. Client, on another machineREADME →
git clone --depth 1 https://github.com/MediaGarrd/Client.git
cd Client
cp docker-compose.example.yml docker-compose.yml
docker compose up --build -d

Open http://<client-ip>:8081 right away and choose a dashboard password: whoever opens a new dashboard first chooses it. To choose it yourself, add CLIENT_PASSWORD to the client's environment.

Connect to the server by IP or with Scan Local Network, then enter the Pairing PIN to pair. To connect automatically, add MEDIAGARRD_SERVER_IP=<server-ip> to the client's environment.

To pair another Client, press Create Pairing Code in a paired Client's dashboard and enter the code in the new one. A code works once and expires after 10 minutes.

A scan only sees servers on the client's own Docker network unless you add network_mode: host and remove the client's ports mapping.

The dashboard follows the server live, so there is nothing to reload. If the server stops responding, the connection badge turns to Unreachable and recovers by itself.

Once a day it checks GitHub for newer vX.Y.Z releases of the server and the client. The Versions panel at the bottom of the dashboard shows Up-to-date, or Update available with a link to the release page.

Defaults
SettingWhereDefault
Server portSERVER_PORT + ports8080 (38471 in the example compose file)
Time between backupsSetup page, then the clientPT12H
Backups to keepSetup page, then the client10
Archives on the server hostServer volume./data/server/backups
Client portCLIENT_PORT + ports8081
Time between client downloadsClient dashboardPT12H
Client dashboard passwordFirst visit, or CLIENT_PASSWORDNone until the first visitor sets it
Downloads on the client hostClient volume./data/client/downloads