Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

What to back up (and watch) when you self-host a crypto payment gateway

Description and use

Implementing automated nightly database dumps, off‑site restic storage, offline archiving of secrets, and log‑based alerts restores resilience against server failure and ensures quick recovery.

Problem

A self-hosted crypto payment gateway must preserve critical state to avoid loss of proof, secrets, and hot‑wallet identity, while ensuring backups survive server failure.

Outcome

Implementing automated nightly database dumps, off‑site restic storage, offline archiving of secrets, and log‑based alerts restores resilience against server failure and ensures quick recovery.

Workflow

  • 1. Create a backup script that dumps PostgreSQL via pg_dump inside the postgres container and compresses it.
  • 2. Schedule the script in root’s crontab to run nightly.
  • 3. Initialize restic with an S3‑compatible bucket, set RESTIC_REPOSITORY and RESTIC_PASSWORD_FILE, and run restic init.
  • 4. Append restic backup and forget commands to the backup script to store dumps off‑site and prune old snapshots.
  • 5. Archive .env and secrets/ once to an encrypted tarball with gpg and store it offline.
  • 6. Test restoration by spinning a spare VPS, restoring .env, secrets/, and the database dump, then verifying two‑factor and payment data.
  • 7. Set up a health check endpoint and monitor it with an uptime service.
  • 8. Tail Docker logs for ERROR, hot‑wallet warnings, nonce gaps, delivery mismatches, and payout review events, and alert on them via a cron‑based watcher.

Evidence

A dead server doesn’t lose you money. The money was never on it. What a dead server loses you is the ability to prove what happened…

Source

pg_dump through the running container is all you need:

Source

restic init

Source

Put that file wherever you keep things like recovery codes. Not in the same bucket as the dumps: the whole point is that someone who gets the dumps shouldn’t also get the key that unseals them.

Source

Sign in, check two‑factor still works, open the Payments page and compare a few rows against the live server.

Source

Here's what I'd page on, and why: ... "level":"ERROR" from any process.

Source

  • Record date: 2026-11-03T11:28:48.208Z