Project OWNOpen Web Node
GitHub

06Hosting

Backups

Project OWN (Open Web Node) backs up each site's files, databases and email on a schedule. A restore undoes itself if the site breaks, copies can go off the server, and a recovery kit brings every site back on a new server. This page also covers moving in from cPanel.

How backups work

  • Backups are encrypted, deduplicated snapshots made with restic. Unchanged files aren't stored twice, so frequent backups stay small.
  • Each site has its own backup store and its own key, so handing one site's backups to someone reveals nothing about the others.
  • A backup holds the site's files, its databases (MariaDB and PostgreSQL, each copied with its own tools) and its email. For each database user it keeps the password's hash, never the password, so a restore on another server keeps the site's database password working.
  • They're kept on the server, in /var/backups/own/ID, with the keys in /etc/own/backup-keys, which only root can read. Add offsite copies so they survive losing the server.

Backups need the Backups (restic) package. Every starting set except the bare minimum installs it; otherwise install it from Packages.

Schedule and keep rule

New sites are backed up daily, keeping the last 14. To change that, open the site and, in its Backups card, open Change the schedule:

  • pick off, hourly, daily or weekly;
  • set how many to keep (keep the last), and click Save.

Back up now takes one straight away. The list shows each backup's time and kind; the ones marked before a restore are safety copies (below).

Doctor warns when a site's last backup failed, when it has never been backed up, or when its backups stopped running.

Restore a backup

  1. Open the site. In its Backups card, click Restore next to the backup you want.
  2. Choose what to restore:
    • Everything: files and databases.
    • Files only: the site's folder. Databases stay as they are now.
    • Databases only: databases. Files stay as they are now.
    • Email only (sites with email): the mailboxes as they were then. Mail that came since is lost.
  3. Click Restore.

Before anything changes, a safety snapshot is taken. After the restore, Project OWN checks the site still loads; if it doesn't, the site is put back automatically.

Changed your mind? To undo a restore, restore the newest backup marked before a restore.

Restoring a site never touches its email; only Email only does.

Apps and game servers

Apps and game servers from the catalogue are backed up the same way, each with its own encrypted store. On Apps, click Backups next to an installed app:

  • set its Schedule and keep the last, then Save;
  • Back up now;
  • Restore next to a backup: the app stops, goes back to that backup and starts again. A safety backup is taken first, and if it won't start, it's put back as it was.
  • Backups start off for web apps, since some hold a lot (such as a photo library), and backups are kept on the server's disk first. Game servers are backed up daily, the first time a day after they're installed.
  • An app stops for the moment of its backup, so its databases are copied at rest. A Minecraft Java server keeps running, with its saving paused, so nobody is disconnected.
  • Things that are made again or kept elsewhere are left out, and the app says which: Immich's thumbnails and converted videos, Jellyfin's media library, caches.

Offsite copies

Backups on the server are lost with the server. Offsite copies send them somewhere else, right after each backup. They're encrypted before they leave, so the place they go can't read them. Only an owner can set this up.

  1. Open Backups. Under Offsite copies, choose Where to:
    • S3-compatible storage: AWS, Backblaze B2, Cloudflare R2, Wasabi, MinIO and others.
    • Another server, NAS or PC, over SFTP.
    • Google Drive or OneDrive.
  2. Fill in the details (below), and the Folder: each site gets a folder of its own inside it.
  3. Click Connect. The settings are tried before they're saved: Project OWN must be able to write and delete there.

S3-compatible storage

  • Endpoint: leave it empty for Amazon S3. For others, it's on the provider's bucket page.
  • Region: optional for most providers.
  • Bucket: create it first at the provider.
  • Access key and Secret key. The secret key is kept only on the server, readable only by root.

Plain http:// endpoints are refused, unless they're inside the server or on the local network.

Another server over SFTP

Enter the Host, Port and User of the other machine. Project OWN shows a key it made for this server: add it to ~/.ssh/authorized_keys for that user on the other machine. The other machine's host key is trusted the first time and checked after that (with rclone 1.55 or later; Ubuntu 22.04's rclone is older and can't).

Google Drive and OneDrive

Connect them from your own computer, where you can sign in with a browser. Install rclone there, then run:

rclone authorize "drive"

(or rclone authorize "onedrive"). Your browser opens: allow access, and rclone prints a token. Paste all of it into Token. With Google Drive, Project OWN can only see the files it made itself, never the rest of your Drive.

Once it's on

  • The Backups page lists each site and when it was last copied, or Failed with the reason. Doctor warns when copies fail or fall behind.
  • Copy now copies straight away. Change and Turn off are for owners. Turning off leaves what was already copied where it is.
  • An offsite copy mirrors the server's backups: what the keep rule removes on the server is removed there too. To keep the copies safe even if the server is broken into, see Copies a hacked server can't delete.
  • The rclone (offsite copies) package is installed by itself when you set this up.

Copies a hacked server can't delete

The server holds the key to its offsite copies, so someone who breaks into it could delete them too. S3 storage can stop that: it keeps old versions of every file, and Object Lock holds each version for a number of days after it's written. Then the server's key can only hide files, not delete them, and a site can be brought back as it was before the trouble.

The Backups page says how protected the copies are:

  • Protected: versions are kept and locked in Compliance mode, which nobody can lift early, not even you.
  • Partly protected: locked in Governance mode, which a key with the "bypass" permission can lift. Backblaze's Read and Write keys have it, so switch to Compliance.
  • Not protected: versions aren't kept, or nothing locks them.

To set it up, pick a number of days long enough to notice trouble (30 is a good start):

  • Backblaze B2 (tested): make the bucket with Object Lock on. In the bucket's settings, set the default retention to Compliance and 30 days, and the lifecycle rule to keep prior versions for 31 days, so old versions are cleared once their lock ends.
  • Amazon S3 and Wasabi: turn on Object Lock for the bucket (which turns on versioning), set a default retention in Compliance mode, and a lifecycle rule that expires noncurrent versions after the lock ends.
  • Cloudflare R2 doesn't keep versions, so it can't do this.

Old versions take space until their lock ends, so storage costs a little more: about one extra copy of what changed in those days.

A copy on your own PC or NAS

A PC at home can keep a copy of the server's backups too, by fetching them: the PC asks and the server answers, so it works behind your router with nothing to open, and the server holds no key to the copy, so a break-in there can't reach it.

  • OWN DevKit does it for you: connect the server (Settings, Project OWN servers), then on its Backups page, under Copies of your servers' backups, pick a folder (a drive or a NAS share). It fetches what's new every few hours while it runs, checks every file, and keeps files the server's keep rule removed for 30 more days.
  • It needs an API token of an owner or admin; read-only is enough. Only the backup stores are served, encrypted as they are: opening them takes the recovery kit.
  • Anything else can fetch them too (a script on a NAS): GET /api/mirror lists the stores, GET /api/mirror/{id}/files a store's files, and GET /api/mirror/{id}/file?path=PATH fetches one, in parts if you ask (Range). Each file is named after the SHA-256 of what's in it (but config), so a copy can check it.

The recovery kit

Each site's backups are locked with a key that lives on the server. If the server is lost, the offsite copies can only be opened with those keys. The recovery kit is one file with all of them.

  1. On Backups, click Download the recovery kit. Only owners can.
  2. Keep the file somewhere safe, off the server. A password manager is ideal.

Treat it like a password: anyone with it and your offsite copies can open your backups. Each download is in the activity log. When sites are newer than your kit, the Backups page and Doctor remind you to download it again.

Bring sites back on a new server

If a server is lost, a new one can bring its sites back from the offsite copies and the kit.

  1. Install Project OWN on the new server and finish the setup wizard.
  2. On Backups, connect Offsite copies to the same place, and the same folder, the old server used.
  3. Under Bring sites back, choose the Recovery kit file.
  4. Tick the sites and apps to bring back. Any with no copy at the offsite place can't be ticked (with S3 storage they can: they may be there at an earlier time). Click Bring them back.
  5. Point the domains at the new server, and get each site a free certificate.

Each site comes back with its files, its databases, its database users with the same passwords, and the same site ID, so WordPress and other apps connect straight away. Each one is checked to load; any that doesn't is named at the end. App sites come back with their start command and settings, apps with their data and saved passwords, and load balancers from their settings alone.

A site whose domain, ID or database already exists on the new server is refused.

From a copy on your PC instead of offsite copies: put each site's folder from the copy in /var/backups/own/ on the new server, under its own name (the site's ID), for example with scp -r. Bring sites back lists it and brings it back with the kit, without offsite copies set up.

After a break-in, the last copies may be spoiled or hidden. With locked S3 copies, open As they were at an earlier time before clicking Bring them back, and pick a time before the trouble began (in your own time zone): the sites come back from the copies as they were then. This needs rclone 1.59 or newer on the new server: Debian 12, Ubuntu 24.04 and newer have it; Ubuntu 22.04 doesn't.

Moving in from cPanel

Bring a hosting account over from cPanel: its sites, files, databases and email, with their passwords. Only owners can import.

  1. In cPanel, open Backup and download a full account backup (a .tar.gz file). In WHM, it's a cpmove file.
  2. In Project OWN, open Sites and click Import from cPanel. Choose the file under Account backup and click Upload and look inside. Backups up to 50 GB can be uploaded from the browser, and nothing changes yet.
  3. Look through what's in it: Domains, Databases and, with email installed, Email. Untick anything you don't want, then click Import.
  4. Save any new passwords shown: they aren't shown again.
  5. Try each site, then point its DNS here and get it a free certificate. For email, add the DNS records on the Email page (MX first) straight after importing, so new mail comes here.

What comes over

  • Each domain becomes a site with its files: the main domain with its www and parked domains, addon domains and subdomains. Each keeps its PHP version where Project OWN offers it, or gets the current default, and the import says which to check.
  • Each database comes over with its users and their password hashes, so WordPress and similar apps keep working without changing their settings. Users whose password MariaDB can't take (MySQL 8's newer kind) get a new one, shown once: put it in the site's settings (wp-config.php for WordPress).
  • Email accounts, with email installed: their passwords (SHA512-CRYPT, SHA256-CRYPT and bcrypt keep working), their mail in every folder, size limits and forwarders. An account with an older kind of password hash gets a new password, shown once. Without email installed, install it on the Email page and import again.
  • Imported sites get daily backups.

Mail that arrives at the old server after the backup was made isn't in it, which is why the MX record should move right after the import.

Nothing in an uploaded backup is trusted. It's unpacked by an unprivileged user, and every folder the import reads or copies from must be inside the backup with no link on the way. The upload and its unpacked copy are deleted when the import ends or is cancelled.

Something wrong or unclear on this page? Open an issue on GitHub.