Skip to content

pops-restore: --list to show the available backups #111

Open

Description

@TheP4SHA

Context

pops-backup writes one folder per backup under BACKUP_DIR (default /var/backups/pops, set in /etc/pops/backup.conf), named by UTC time, e.g. 20260929T023000Z. Each folder holds db.dump, files.tgz, SHA256SUMS and meta.json (created_at, version, db_name, pg_dump, …). Failed runs are kept as *.failed for a while.

To restore, an operator has to pass one of these folders to pops-restore. Today they have to ls the directory and open meta.json by hand to see which backup is which.

What to do

Add pops-restore --list:

  • read BACKUP_DIR from the same config file pops-restore already sources (POPS_BACKUP_CONF, default /etc/pops/backup.conf), default /var/backups/pops;
  • print one line per backup folder, newest first: folder name, created_at and version from meta.json, and the size (du -sh);
  • mark *.failed folders, and folders without SHA256SUMS or meta.json, as not restorable;
  • touch nothing: no database, no service, no files.

Acceptance criteria

  • pops-restore --list works without root when BACKUP_DIR is readable, and changes nothing.
  • --list together with a backup folder or with --yes/--check stops with a clear error.
  • jq is not required: read meta.json with the tools the script already uses (sed/grep), or python3.
  • The -h help text (the comment block at the top) and docs/backup.md describe the option.
  • The Backup and restore job in .github/workflows/ci.yml calls Installer/server/pops-restore --list after the first backup and checks that the folder appears in the output.
  • shellcheck --severity=warning Installer/server/pops-restore is clean (CI checks it).

Comments in the script are in Turkish; keep them in Turkish. Output messages may follow the existing [pops-restore] style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions