GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — openshorts/ops at main · VLab-Software/openshorts

Expand file tree

/

ops

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

ops

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 

README.md

Outline

ops/

Operational scripts for OpenShorts Cloud. Nothing here runs automatically: each file is installed and scheduled on the host that needs it.

pg_backup.sh — encrypted PostgreSQL backups, 30-day retention

The only backup mechanism this project has ever had in version control. Art. 32.1.c GDPR requires being able to restore availability of personal data after an incident, and the privacy policy now states that a deletion is gone from every copy within 30 days — this script is what makes both sentences true.

What it does

  1. pg_dump the cloud database (plain SQL, --no-owner --no-privileges).
  2. gzip and encrypt it, in the same pipeline, with age (recommended) or gpg. Only ciphertext ever touches the disk or the bucket. Without a recipient key configured the script exits with an error rather than writing a readable dump — a plaintext copy of users in an object store is the incident this file exists to prevent.
  3. Upload to s3://… (works with Cloudflare R2 via BACKUP_S3_ENDPOINT) or gs://….
  4. Delete backups older than RETENTION_DAYS (default 30).

Install

# On the database host (el servidor de la base de datos), as root:
apt-get install -y postgresql-client age awscli        # or gnupg instead of age
install -m 0750 ops/pg_backup.sh /opt/openshorts/ops/pg_backup.sh

Generate a key pair on your laptop, not on the server — the server only ever needs the public half, which is the whole point:

age-keygen -o openshorts-backup.key      # keep this file in a password manager
grep 'public key' openshorts-backup.key  # -> age1... goes on the server

Then create /etc/openshorts-backup.env (mode 0600):

DATABASE_URL="postgres://user:[email protected]:5432/openshorts"
BACKUP_AGE_RECIPIENT="age1................................................"
BACKUP_DEST="s3://openshorts-backups/pg"
BACKUP_S3_ENDPOINT="https://<accountid>.r2.cloudflarestorage.com"
AWS_ACCESS_KEY_ID="..."          # an R2 token scoped to THIS bucket only
AWS_SECRET_ACCESS_KEY="..."
RETENTION_DAYS=30

Dry run first — it dumps and encrypts locally but uploads nothing:

set -a; . /etc/openshorts-backup.env; set +a
DRY_RUN=1 /opt/openshorts/ops/pg_backup.sh

Schedule it:

15 3 * * * set -a; . /etc/openshorts-backup.env; set +a; /opt/openshorts/ops/pg_backup.sh >> /var/log/openshorts-backup.log 2>&1

Restore (do this once, before you need it)

aws s3 cp --endpoint-url "$BACKUP_S3_ENDPOINT" \
  s3://openshorts-backups/pg/openshorts-pg-20260904T031500Z.sql.gz.age .
age -d -i openshorts-backup.key openshorts-pg-*.sql.gz.age | gunzip \
  | psql "postgres://…/openshorts_restore_test"
psql "postgres://…/openshorts_restore_test" -c 'select count(*) from users;'

A backup nobody has restored is a hypothesis. Write down the date of the last successful restore test somewhere a person will read.

Things to keep true

  • The bucket is not public and not the same bucket as user clips. Give the backup token write access to its own bucket and nothing else.
  • The private key is not on the server. If it were, an attacker with the server has both the ciphertext and the key.
  • RETENTION_DAYS and the privacy policy move together. The policy tells users a deletion disappears from backups within 30 days (docs/compliance/retencion.md, dashboard/seo/legal.js §5). Raising the retention without changing that text makes the policy false.
  • Object-lock / versioning on the bucket would defeat the retention. If you enable it for ransomware protection, set the lock window to the same 30 days, not longer.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.