arculaDocumentation

Backups

Backup methods and consistency

A backup method is how the agent captures a resource's data. You can see it in the protection plan, in the “How to copy” column, and on the server overview, in the “In the backup” block. The agent suggests the method when it finds the resource.

Why consistency matters

A database writes to its files all the time. If you just copy the files of a running database, the copy may be taken in the middle of a write: some files from before the change, some from after. Such a database may fail to start or lose its latest data.

A consistent copy is a snapshot of a single moment: a database dump or the application's own snapshot. arcula has adapters for this.

Methods

Method in the panelForHow
“file copy”Directories, files, Docker volumesrestic reads them from disk at the moment of upload to the storage
“pg_dump — consistent dump”PostgreSQL in a container, including in GitLab Omnibuspg_dump -Fc of each database and pg_dumpall --globals-only inside the container
“host settings”The server itselfUsers and groups, systemd services, cron, Docker, Caddy and nginx configs, Let's Encrypt certificates
“Redis snapshot (RDB)”RedisBGSAVE in the container and a copy of the finished RDB file
“consistent SQLite copy”An application with an embedded SQLite database, such as GrafanaThe directory is copied while the application runs; the database files — while the container is paused
“Prometheus snapshot”PrometheusA database snapshot via the Prometheus admin API
“Vault snapshot (raft)”Vault on Raft — only if you choose itA snapshot via the Vault API
“gitlab-backup”GitLab Omnibus: repositories, uploads, artifacts, LFS, packages, registryThe standard gitlab-backup create

The agent takes database and Redis passwords inside the container, from its environment and configuration. They don't go to the panel.

Dumps and snapshots are prepared on the server once, in the staging directory, and go to all storages identical. restic reads directories and volumes from disk at the moment of upload to each storage — so in different storages they're from different moments. Details — Points and copies.

Adapter specifics

Redis

If BGSAVE fails, the last automatic RDB file goes into the backup with a warning. If AOF is on in Redis — also a warning: when restoring, turn off appendonly first.

SQLite

The container is paused (docker pause) only while the database files are copied, and only if they're 1 GB or less. If the database is larger or there's no container — a copy without pausing, with a warning. This is the only case where arcula pauses anything on the server: it doesn't stop services.

Prometheus

The admin API in Prometheus is off by default. Then the agent copies the data directory as files and writes a warning. To get a snapshot, run Prometheus with the --web.enable-admin-api flag.

Vault

By default Vault is copied as files. A raft snapshot — only if you choose it in the plan: “Vault snapshot (raft) — needs setup on the server”. Before that, on the server:

sudo arcula vault setup

The command creates a login in Vault with a single permission — taking a snapshot. If the snapshot fails (Vault is sealed, the storage isn't raft, the login isn't set up), the agent copies files and writes a warning. The agent doesn't store unseal keys: a snapshot can only be restored with the original keys — keep them yourself.

GitLab

gitlab-backup captures everything except the database: the database is captured by pg_dump, and gitlab.rb and secrets by a file copy. A restore needs the same GitLab version and edition. arcula restore extracts the Vault snapshot and the GitLab archive, and you restore them yourself — following the hint in the restore step.

Without consistency

“File copy without consistency” means: restic copies the files of a live volume or directory as they are, without coordinating with the application. arcula doesn't promise that such a copy of a database will come up.

This happens when:

  • there's no adapter for the resource: MySQL, MariaDB, MongoDB, ClickHouse, Elasticsearch and other databases;
  • you included a volume or directory from “Needs a decision” as “protect — file copy”;
  • the server's agent can't do the needed method yet: “… — the agent can't do this yet (update it); file copy without consistency for now”. After the agent is updated, the plan switches to the adapter by itself with a new revision;
  • the adapter failed: the Prometheus admin API is off, Vault is sealed. Then there's a warning in the log.

When a file copy is enough

  • user uploads, static files, media, documents — files that are written in one go and rarely change;
  • configs, project directories, Compose files;
  • data of an application that doesn't keep it open, or is stopped.

When it's not enough

A live database that writes all the time. Its file copy may not come up, or may come up without the latest data. It's more reliable to make your own dump — for example, with a cron job (mysqldump, mongodump) into a directory that is checked in the plan. Then a finished dump goes into the backup, and the file copy of the database becomes a fallback.

The same article is in the panel, under “Help”.