DumpStation is my self-hosted backup service for PostgreSQL. It runs pg_dump on a schedule, ships every archive to an S3-compatible bucket, checks that it actually arrived, and gives you a guided way back when something breaks. It’s open source under the MIT license, one Go server with a built-in web UI, and it currently backs up more than 50 GB of production databases across my own projects and client work.
DumpStation v2.0.0, self-hosted PostgreSQL backups you can actually restore. Website and docs: https://dumpstation.monzim.com. Source on GitHub: https://github.com/monzim/DumpStation. Live demo: https://dumpstation.monzim.com/demo/
DumpStation v2.0.0
Self-hosted PostgreSQL backups you can actually restore.
- MIT
- Go 1.25
- PostgreSQL 12–18
- One Docker image
Six months after the last change, DumpStation v2.0.0 shipped on 27 November 2026. It’s the biggest update the project has had: a redesigned interface, agents that back up databases in private networks without opening a single port, verified artifacts and a guided restore, better scheduling and retention, and PostgreSQL 12 to 18 with the right client picked automatically.
This post is the long version: how it’s built, how a backup moves through it, and why I trust it with data I can’t afford to lose. Most diagrams below are interactive. Press the buttons and drag the sliders.
Key takeaways
- Agents for private databases. A small worker inside the private network makes every connection outward over HTTPS. No inbound ports, no VPN, and the database password can stay on that host.
- A backup counts only once it’s verified. SHA-256 is computed while dumping, the object’s size is checked in the bucket, and the checksum is checked again before every restore.
- Guided restores into the original database, another one or a custom target, with typed confirmation for anything destructive.
- Scheduling with time zones, missed-run detection, and retention that never deletes your newest good backup.
- PostgreSQL 12 to 18, with
pg_dumpmatched to each server. 19 is next. - Secrets encrypted at rest with AES-256-GCM, a written threat model, and a clear list of what a compromised agent can and can’t do.
- 50+ GBproduction data backed uppersonal and client projects
- 12–18PostgreSQL versionsclient matched per server
- 0inbound ports for agentsoutbound HTTPS only
- 3job kinds an executor runsbackup, restore, test
- 416files changed in v2+38k / −49k lines
- MITlicenseself-hosted, no subscription
Why I came back to it
I built DumpStation in November 2025 to solve my own problem: a growing list of Postgres databases, each with its own half-remembered cron job and no single place to see whether last night’s backup worked. v1 did the basics well. It scheduled pg_dump, uploaded to S3 or R2, and kept a history.
Two things kept bothering me.
It had to reach every database itself. That’s fine for a database on a public endpoint. It’s not fine for the ones that matter most: client databases inside a VPC, behind a firewall, or on a machine at the office. The options were all bad. Open a port to the internet. Set up a VPN. Keep an SSH tunnel alive. Each one widens the attack surface of the very thing you’re trying to protect.
“Backup succeeded” meant pg_dump exited with 0. That says nothing about whether the file reached the bucket intact, or whether it restores. A backup you’ve never restored is a hope, not a backup.
v2 is my answer to both. It changed 416 files, with about 38,000 lines added and 49,000 removed, mostly the old UI and a separate web image.
The architecture: a control plane and an execution plane
The most important decision in v2 is a split between two roles.
- The control plane is always the server. It validates requests, decides who runs a job, chooses the storage key, issues presigned URLs, verifies the artifact, records history, applies retention, sends notifications and writes the activity log.
- The execution plane runs
pg_dumpandpg_restore. That’s either the server’s own direct executor or an agent. Executors can run exactly three job kinds:backup,restoreandtest_connection. They never choose storage keys, agents never hold storage credentials, and there’s no “run this command” job at all.
DumpStation's two topologies. Direct: the server connects to a reachable PostgreSQL, runs pg_dump and streams the archive to the bucket. Agent: an agent inside a private network makes only outbound HTTPS requests to the server, runs pg_dump against the private database, and uploads straight to the bucket with presigned URLs; the server never connects into the private network.
Both executors finish through the same code path on the server, so a direct backup and an agent backup produce identical history, retention, notifications and activity entries. The metadata itself lives in a PostgreSQL database next to the server: users, databases, storage configs, backups, agents, the durable agent job queue and the execution log.
The stack is boring on purpose. The server and the agent are Go 1.25. The UI is React 19 with TanStack Router and Query, built into the server image and served from the same origin, so there’s one image to run and no CORS to configure. Storage is anything that speaks S3: AWS S3, Cloudflare R2, MinIO and other compatible services.
Agents: backups for databases nobody can reach
An agent is a small worker you run next to a private database. It ships as a container (ghcr.io/monzim/dumpstation-agent), with ready-made snippets for Docker, Compose, Kubernetes and a plain binary with systemd.

The whole setup is one command on a host that can reach both the database and your DumpStation server:
docker run -d --name dumpstation-agent --restart unless-stopped \
-e DUMPSTATION_SERVER_URL=https://dumpstation.example.com \
-e DUMPSTATION_ENROLLMENT_TOKEN=dse_... \
-e DUMPSTATION_CONN_ORDERS='postgres://backup_user:secret@10.0.0.12:5432/orders' \
-v dumpstation-agent-state:/var/lib/dumpstation-agent \
ghcr.io/monzim/dumpstation-agent:latestDUMPSTATION_CONN_ORDERS defines a local connection named orders. In the UI you add a database, choose Agent, pick the agent and the orders connection. The server only ever learns the name. The password never leaves the agent host.
Enrollment: a token you can only use once
- You create an agent in the UI and get an enrollment token:
dse_plus 32 random bytes. It’s shown once, stored only as a SHA-256 hash, valid for an hour by default (10 minutes to 24 hours), and issuing a new one voids the old. - The agent calls
POST /agent/v1/enrollwith it. In one row-locked transaction the server checks it, marks it used and creates a credential:dsa_plus 32 random bytes, again returned once and stored only as a hash. - The agent saves the credential to a state file with mode
0600and sends it as a bearer token from then on.
The dse_ and dsa_ prefixes aren’t decoration. They make a leaked token easy for secret scanners to spot.
The protocol: the agent always calls
The server never connects to an agent. Every request goes the other way:
sequenceDiagram
participant A as Agent
participant S as Server
participant O as Bucket
A->>S: POST /enroll (dse_ token, once)
S-->>A: agent_id, dsa_ credential (once)
loop every 20 s
A->>S: POST /heartbeat (info, running jobs)
S-->>A: cancel_jobs, server_time
end
A->>S: GET /jobs/next?wait=25 (long-poll)
S-->>A: job + lease token, or 204
A->>S: POST /jobs/id/upload/part-url
S-->>A: presigned UploadPart URL (30 min)
A->>O: PUT part (64 MiB)
A->>S: POST /jobs/id/complete (size, sha256, parts)
S->>O: CompleteMultipartUpload, HEAD (size check)A few details make this hold up in the real world:
- Long-polling instead of a socket.
GET /jobs/nextwaits up to 30 seconds. When a job is queued, the server wakes that agent’s pending request straight away, so a manual “Back up now” starts almost instantly without a persistent connection to keep alive through proxies. - Jobs are durable rows, claimed with
SELECT … FOR UPDATE SKIP LOCKED. A server restart doesn’t lose agent jobs; agents reconnect with backoff and carry on. - Every job has a lease. Claiming a job sets a random lease token and a 120-second expiry. Every job call must present that token, and heartbeats, events and part requests extend it.
The lease is what makes networks failing halfway through a backup a non-event. Drag the slider to cut the connection for longer and longer:
Agent heartbeats every 20 seconds keep a 120-second job lease alive. A short outage changes nothing. After 90 seconds without contact the agent is shown offline and one notification is sent. After 120 seconds the lease expires; the server aborts the multipart upload and requeues the backup as attempt 2 after a 30-second backoff, and the agent's late calls get 409 lease_invalid.
When a lease does expire, a backup is retried up to three attempts, with a backoff of attempts² × 30 seconds. Restores are never retried automatically, because a half-finished restore may already have changed the target. Completion is idempotent per lease: a duplicate gets 200 already_completed, and a late one from a stale lease gets 409 and changes nothing.
Moving the bytes: presigned uploads, with a fallback
The agent dumps to a temp file on disk, never to memory, and hashes it while writing. Then it has to get that file into your bucket without ever holding your storage keys.
Upload paths for an agent. When the bucket is reachable, the agent uploads 64 MiB parts directly with presigned UploadPart URLs scoped to one object the server chose. When the bucket is blocked from the agent's network, the first part fails twice and the agent falls back to proxy mode: it streams the file to the server, which re-hashes it in flight and uploads it with its own credentials.
- Direct transfer. The server starts a multipart upload for a key it chose,
backups/<database-id>/<name>_<timestamp>_<backup-id>.dump, and presigns oneUploadPartURL per part, valid 30 minutes. Parts are 64 MiB, doubled when needed to stay under S3’s 10,000-part limit, read from disk on demand and retried up to four times. The server completes the upload with the ETags the agent reports. - Proxy transfer. Some networks can reach your server but not your bucket. In
automode, if the first part fails twice, the agent streams the file to the server instead, which re-hashes it on the way through and uploads it with its own credentials. - Direct backups from the server itself stream to storage in 16 MiB parts, four at a time.
A backup isn’t done until it’s verified
This is the part I care about most. A backup row moves through stages, and it becomes success only after the server has proved the artifact is in the bucket.
A backup job played stage by stage: queued, preparing, dumping, uploading, verifying, then success or failed, with the execution log from the server and the agent. Scenarios: the happy path; an agent that loses its connection mid-upload, whose lease expires and whose backup is requeued and completes on attempt 2; and a size mismatch at verification, where the partial object is deleted and the backup fails with verification_failed.
Verification in v2 is three checks:
- While dumping:
pg_dump --format=custom -Z 6writes to a temp file and the executor counts and hashes every byte as it’s written, so size and SHA-256 are known without a second pass. - After upload: a
HEADon the object must return exactly the dumped size. For proxied uploads, the server’s own hash must also match the agent’s. Any mismatch deletes the object and fails the backup withverification_failed. - Before any restore: the recorded SHA-256 is checked against the downloaded file.
If a backup is cancelled or fails while its upload is finishing, the freshly uploaded object is deleted as an orphan. Only one backup per database can be active at once, and every step writes an entry to the execution log you see in the UI.

Restores: guided, and hard to do by accident
A restore is the worst moment to read documentation, so v2 has a wizard: Backup → Destination → Options → Validate → Review. You can restore into the original database, any other configured database, or a custom host, and run it on the server or through an agent.

The guard rails are what make it safe to hand to someone at 3 a.m.:
- Typed confirmation. Restoring into an existing configured database, or any restore with
--clean, means typing the target’s name. - No
psqlin the loop. Custom-format archives go throughpg_restore --no-owner --no-privileges, which speaks SQL over libpq and never interpretspsqlmeta-commands. Legacy plain-SQL dumps from v1 are replayed by DumpStation over the wire protocol, and backslash commands such as\!are skipped, not run. - Two keys for agent restores. An agent only receives restore jobs when restores are allowed in the UI and the agent runs with
DUMPSTATION_ALLOW_RESTORE=true. The server won’t even offer the job otherwise. - The checksum check from the previous section runs first, every time.
And because every artifact is a plain pg_dump custom-format file in your own bucket, you can always restore without DumpStation at all.
The right pg_dump, every time: PostgreSQL 12 to 18
pg_dump must be at least as new as the server it reads from, and a client that’s too old refuses to run. v2 bundles client tools for PostgreSQL 12 through 18 in the image, reads server_version before each job, and picks the smallest installed client that is new enough:
// Pick returns the path of tool for a server of the given major version.
// pg_dump must be at least as new as the server, so the smallest installed
// version >= serverMajor is chosen.
for _, m := range majors {
if m >= serverMajor {
chosen = m
break
}
}
if chosen == 0 {
return "", 0, &Error{Code: CodeVersionMismatch, Message: fmt.Sprintf(
"PostgreSQL %d requires client tools version %d or newer; installed: %v",
serverMajor, serverMajor, majors)}
}Agents discover what’s installed on their own host and report it when they enroll, so the same rule works there. Try a few combinations:
Choosing pg_dump for a PostgreSQL server: with client tools 12 to 18 installed, each server version gets its own matching client. On a host with only 15 and 17 installed, PostgreSQL 13 uses pg_dump 15, 16 uses pg_dump 17, and 18 fails early with version_mismatch. PostgreSQL 19 fails with version_mismatch until its client tools are bundled.
The point of failing early is that a version mismatch becomes a clear, typed error (version_mismatch) before anything runs, not a confusing dump failure halfway through. PostgreSQL 19 support is next: it lands as soon as its client tools can be bundled.
Scheduling, retention and monitoring

Schedules are standard 5-field cron or presets like @daily and @every 6h, evaluated in each database’s own IANA time zone, with a preview of the next runs. A run that fires while a backup is still active is skipped and logged instead of piling up.
Missed runs are reported. Every 10 minutes the server looks back 48 hours for scheduled times that passed without a backup starting. If the server was down at 02:00, you get a backup_missed alert within ten minutes of it coming back, instead of finding out on the day you need that backup. Each database also gets a health state: healthy, running, failing, stale, never_backed_up or paused.
Retention runs after every successful backup, with two policies: keep the last N, or keep everything from the last N days. One rule overrides both: the newest successful backup is never deleted.
Retention on fourteen daily backups, two of which failed. Keep the last N deletes the older successful backups beyond N; keep N days deletes successful backups older than N days. Failed backups are never touched by retention. If backups stopped ten days ago, a short days window would delete everything, but the newest successful backup is always kept.
That last checkbox is the reason the rule exists. With “keep 7 days”, a database whose backups quietly stopped two weeks ago would otherwise lose its last good copy to the cleanup job. The whole policy is a small, tested function:
func RetentionCandidates(newestFirst []*models.Backup, p models.RotationPolicy, now time.Time) []*models.Backup {
if len(newestFirst) <= 1 {
return nil
}
rest := newestFirst[1:] // never delete the newest valid backup
// count: keep p.Value - 1 more; days: drop anything started before now - p.Value days
...
}Each deletion goes to the bucket the backup was written to; if that fails, the row stays and is retried next time. Every backup is pinned to the storage it was written to, and a storage config can’t be deleted while artifacts still live in it.
Alerts go to Discord or Telegram per database, with typed error codes instead of “backup failed”: auth_failed, version_mismatch, agent_lost, agent_unavailable, verification_failed, insufficient_disk, timeout and more. An activity log keeps 60 days of who did what.
Security: why I trust it with production data
A backup system holds a full copy of every database it protects, and the credentials to reach them. That makes it one of the most valuable things to attack. So v2 starts from a written threat model.
In scope: an unauthenticated attacker on the internet, an authenticated user reaching for another tenant’s data, the read-only demo account trying to write, a stolen enrollment token or agent credential, a compromised agent host, a tampered backup artifact, and server-side request forgery through configurable URLs. Out of scope: a compromised server host or metadata database, a compromised storage account, and malicious administrators. Anyone who can read the server’s environment can decrypt its secrets; the design says so instead of pretending otherwise.
Secrets at rest
Database passwords, storage keys, webhook URLs, Telegram bot tokens, TOTP secrets and agent job payloads are encrypted in the metadata database with AES-256-GCM under your own DUMPSTATION_SECRET_KEY. Each value gets a fresh random nonce, and the GCM tag means a tampered value fails to decrypt instead of decrypting to garbage. The stored form is enc:v1: followed by base64 of nonce, ciphertext and tag.
This one isn’t a simulation. The button below seals the text with the same construction using your browser’s Web Crypto, under a key made in this tab:
AES-256-GCM sealing in the browser: a password is encrypted with a random 12-byte nonce, producing ciphertext and a 16-byte authentication tag, stored as enc:v1: plus base64. Sealing the same password again produces a completely different value because the nonce changes.
API responses never return secrets either: passwords and keys are never serialised, hosts and buckets are masked in lists, and edit forms get a has_password flag instead of the value. Tool output and agent messages pass through a sanitizer that strips user:password@ from URIs and password= pairs before they reach the log.
Running pg_dump safely
The server and agent share one execution package, pgexec, and it treats every input as hostile:
- No shell. Tools start with an explicit argument vector. No user-supplied string is ever interpreted by a shell.
- Argument-injection guards. Host, database and user can’t start with
-or contain control characters; the database name can’t smuggle in a connection string; the host must be a single hostname or IP. - Passwords in a passfile, not argv. Each run writes a libpq passfile with mode
0600containing only that one entry, runs the tool with--no-password, then deletes it. Nothing shows up inps. - A scrubbed environment. Every inherited
PG*variable is removed, so host settings can’t redirect a connection or leak a password. - No orphans. On Linux,
pg_dumpis bound to its parent and dies with it.
Network and sign-in
DIRECT_ALLOWED_CIDRSlimits which hosts the server may connect to directly. Every resolved address must be inside the list, and the connection is pinned to the checked IP, so DNS can’t change between the check and the connect. Everything else goes through agents.- Webhook SSRF guard. Discord URLs must be HTTPS on Discord’s own hosts and resolve outside loopback, private ranges, link-local (including
169.254.169.254) and CGNAT. - Passwordless sign-in with a 6-digit code (sent to Discord, or to the server log), optional Cloudflare Turnstile, and GitHub OAuth restricted to one allowed account. The GitHub flow binds its result to the browser tab that started it, against login CSRF, and returns tokens in the URL fragment, which never reaches a server log or
Referer. - TOTP two-factor. With it enabled, every sign-in returns only a pending token that the API rejects everywhere except the 2FA check.
- Short sessions. 30-minute JWTs that slide while you work, with a 12-hour hard cap. Roles are reloaded from the database on every request, so a removed admin loses access immediately.
- Tenant isolation. Every resource carries an owner and every query is scoped by it.
- Downloads need a second factor: a code sent to one of your own channels, bound to that backup, valid five minutes, then a presigned URL valid five minutes.
- Browser hardening: a strict Content-Security-Policy, HSTS,
frame-ancestors 'none'and friends on every response.
If an agent is compromised
Agents run on machines I don’t always control, so the design assumes one will be compromised one day and limits what that buys an attacker.
What a compromised agent can reach. Agent A, compromised, can reach the databases on its own network, which it could reach anyway, and could upload a poisoned artifact for its own current job. It cannot touch any other object in the bucket, the server's JWT secret, encryption key or storage keys, other agents' jobs or another network's databases. Revoking it clears its credential; its next request gets 401 and the process exits.
It can read the databases its host could already reach, and could upload a poisoned artifact for backups assigned to it. If those databases use central credentials, it receives them in its job payload, which is why agent-local connections are the recommended setup. It cannot list, read, overwrite or delete any other object, because it holds no storage keys and only gets presigned URLs for single keys the server chose. It can’t touch other agents’ or users’ jobs, make the server run commands or call arbitrary URLs, receive restore jobs unless you allowed them on both sides, or keep access after you revoke it.
What v2 doesn’t do yet
Being honest about the gaps is part of the security story:
- Artifacts aren’t encrypted client-side. They’re protected in transit by TLS and at rest by your bucket’s own encryption. Envelope encryption before upload is on the roadmap. Until then, use a private bucket with server-side encryption, and turn on versioning or object lock if you need protection against deletion.
- SQL in a restored artifact runs with the target role’s privileges. Restore with a role that has no more rights than it needs, and don’t restore artifacts you don’t trust into a database where that role is a superuser.
- Back up
DUMPSTATION_SECRET_KEYoffline. Lose it and every stored secret has to be entered again.
A redesigned interface
The UI was rebuilt from scratch on the Astryx design system, with light, dark and pitch-black themes and a ⌘K command menu.

The Overview answers the questions I actually have in the morning: is everything protected, did anything fail, what runs next. The Backups page has paged, filterable history with the execution log behind every row. The agents page shows each agent’s version, host, installed pg_dump majors and when it was last seen. The DB Explorer shows databases, tables, rows, roles and ER diagrams.
You don’t have to install it to try it. The live demo runs the real interface against sample data, entirely in your browser.
Running it yourself
You need Docker with Compose v2:
git clone https://github.com/monzim/DumpStation.git
cd DumpStation/configs
cp .env.example .env
# set at least:
# POSTGRES_PASSWORD=$(openssl rand -base64 24)
# JWT_SECRET=$(openssl rand -base64 64)
# DUMPSTATION_SECRET_KEY=$(openssl rand -base64 32) # keep it safe
# PUBLIC_URL=https://dumpstation.example.com
docker compose up -dSign in, add a bucket and run its test, add a database, press Back up now and watch the log. Then turn on two-factor before you expose it. Upgrading from v1 is a drop-in for your data: the schema migrates on start, existing databases keep backing up directly, and old backups stay restorable. The upgrade guide covers the one-image switch.
What’s next
- PostgreSQL 19 client tools.
- Scheduled test restores into a scratch database, with a pass/fail report.
- Prometheus metrics (backup age, duration, size, failures, agent connectivity) and a Grafana dashboard.
- Generic webhooks and email as alert channels.
- Client-side encryption of artifacts before upload.
- Per-database
pg_dumpoptions: schemas and tables to include or exclude, compression level, parallel jobs.
FAQ
Is DumpStation free? Yes. It’s MIT licensed and fully self-hosted: no subscription, no account with me, no vendor lock-in.
Does the agent need an inbound port or a VPN? No. It only makes outbound HTTPS requests to your DumpStation server, and outbound uploads to your bucket.
Can I restore a backup without DumpStation? Yes. Every artifact is a standard pg_dump custom-format file in your own bucket. pg_restore reads it directly.
Which storage works? AWS S3, Cloudflare R2, MinIO and other S3-compatible services.
Which PostgreSQL versions are supported? Servers from 12 to 18, each dumped with a matching client. 19 is next.
DumpStation started as a fix for my own backups. After six months away, v2 is the version I’d trust with anyone’s. It’s on GitHub, with docs and a live demo at dumpstation.monzim.com. If it saves you a bad night, I’d love to hear about it, and issues and pull requests are always welcome.