Self-hosting
Backups and restore
Back up a running node, restore it into an empty data directory, bring back deleted repositories, and rebuild the index.
Git is where Moru keeps everything that matters: code, and every change, request, comment and review as git objects in each repo. The rest of the data directory is keys, accounts and node configuration, plus an index the node can rebuild. moru-node backup captures all of it except the parts that rebuild themselves.
Take a backup#
moru-node backup writes one gzipped tar, and is safe to run while the node serves:
moru-node backup moru.tgz # to a file
moru-node backup - > moru.tgz # to stdout What’s in it:
- every repo as a git bundle with all its refs, including Moru’s own (
refs/moru/…), - the keys: the node’s, the host’s, and every person’s and agent’s,
- accounts, organizations, repo access, runners, agent profiles, merge rules, GitHub connections, webhooks and notification preferences,
- the node keys this host revoked, with the checkpoints their revocations vouch from (
host/). Nothing else holds these records: they’re how the node keeps refusing a revoked key in a copy of a repository that lacks the revocation. See How trust works.
What it leaves out:
- the index (
index.sqlite), which the node rebuilds, - what the node learned about hosts from its repositories and the PLC directory (
hosts/), which it learns again, - agents’ scratch repos, which last a day at most,
- the temporary clones a merge or a GitHub delivery works in,
- deleted repos waiting in the trash. To keep a repo you’re about to delete, back up first.
With Docker Compose:
docker compose exec -T moru moru-node backup - > moru-$(date +%F).tgz On a platform, run the same command through its shell: see Fly.io and Railway, Render and Kubernetes.
Encrypt it#
With age, or straight into restic:
docker compose exec -T moru moru-node backup - | age -r age1… > moru-$(date +%F).tgz.age
docker compose exec -T moru moru-node backup - | restic backup --stdin --stdin-filename moru.tgz Every night#
A cron entry on the host is enough for most teams:
15 3 * * * cd /srv/moru && docker compose exec -T moru moru-node backup - | age -r age1… > /backups/moru-$(date +\%F).tgz.age Cron needs the % escaped, as above.
Restore#
moru-node restore recreates a data directory from a backup. It only writes into an empty directory (an empty volume’s lost+found is fine), and checks every ref against the list the backup recorded. The node rebuilds its index when it starts.
A restore needs free disk space of about twice the backup’s size: it unpacks each repository’s bundle, then builds the repository from it. Restoring from a file, it checks for twice the size plus 64 MiB before it writes anything, and refuses with how much it needs and how much is free. Restoring from stdin (-), as with Docker below, it can’t know the size, so check the volume has the room yourself.
With Docker Compose, stop the node, replace its volume with an empty one, and restore into it:
docker compose down
docker volume rm moru_moru-data
docker compose run --rm -T moru restore - < moru-2026-11-10.tgz
docker compose up -d moru_moru-data is the volume’s name in the Compose bundle (project moru, volume moru-data). Check yours with docker volume ls.
Without Docker:
moru-node --data /var/lib/moru-restored restore moru-2026-11-10.tgz A restored node has the same host identity, keys, accounts and runners as the one you backed up. People sign in with the same passwords; runners keep their tokens.
A node key revoked after the backup was taken isn’t revoked in the restored node’s records, nor in its restored repositories. Run moru-node revoke-node for it again, with the same time and checkpoint (or retire-node again, for a key you retired). See How trust works.
Try a restore once before you need one. Restoring into a throwaway container on your machine and cloning a repo from it is enough:
docker volume create moru-restore
docker run --rm -i -v moru-restore:/data ghcr.io/webstonehq/moru-node:latest restore - < moru.tgz
docker run -d --name moru-restore -v moru-restore:/data -p 127.0.0.1:7071:7070 \
-e MORU_PUBLIC_URL=http://127.0.0.1:7071 ghcr.io/webstonehq/moru-node:latest Sign in at http://127.0.0.1:7071 with your usual password and look around. Then remove it:
docker rm -f moru-restore && docker volume rm moru-restore A host with many nodes#
Back up every node. A repo node’s backup leaves out its key, and restores as a new node that joins the host and takes over the old node’s repositories; a control node’s brings back the host-wide state, the host’s revocation records among it. Every node’s backup keeps host/ and leaves out hosts/. See Backups in Running many nodes.
Deleted repositories#
Deleting a repository takes it away at once, but the node keeps it in trash/ for 7 days. Within that time its owner, an owner of its organization or a site admin can bring it back, with its requests, changes, discussions, collaborators and webhooks. After 7 days it’s purged.
In the UI, deleted repos are listed under Recently deleted on the Account page (your own repos) and on an organization’s page. See Repositories.
On the node:
moru-node list-deleted
moru-node restore-repo <id> list-deleted prints each deleted repo’s ID, its name, who deleted it and when it will be purged, latest first. restore-repo brings one back under its own name. If a new repo with that name exists by then, delete it first.
Backups don’t include the trash, so a repo deleted before your last backup isn’t in it.
Rebuild the index#
index.sqlite holds nothing the repos and configuration files don’t: it’s there to make the UI and API fast. The node rebuilds it when it’s missing, and when an upgrade changes its format. To rebuild it by hand, stop the node first:
docker compose stop moru
docker compose run --rm moru rebuild-index
docker compose start moru Or delete index.sqlite (and its -wal and -shm files) while the node is stopped, and start it.
A rebuild brings back repos, changes, requests, Bake-offs, reviews, discussions and notifications. It doesn’t bring back operational state: jobs that were queued or running, their logs, the event history and webhook deliveries waiting to be sent. Let running jobs finish first, or start them again afterwards.
Purge a secret from history#
When a secret was pushed, force-pushing a branch without it takes the commit out of the branches, and the node stops serving it: under git protocol v2 it checks that every object a fetch asks for is reachable from the repo’s refs. The objects stay on disk, and in backups, until git prunes them.
To purge them at once, run this in the repo’s directory, repos/<owner>/<name>.git in the data directory, as the user the node runs as:
git reflog expire --expire=now --all && git gc --prune=now In the container, that user is moru. For the repo acme/timetable:
docker compose exec -u moru moru sh -c \
'cd /data/repos/acme/timetable.git && git reflog expire --expire=now --all && git gc --prune=now' A change or request that refers to the commit keeps it reachable under refs/moru/. Close or rewrite that first. Then replace the backups taken since the push.