Skip to content

published: · updated:

Postgresus: PostgreSQL’s Reverse Cursed Technique

Postgresus is a free, open-source, self-hosted tool for automated PostgreSQL backups. Set it up with Docker Compose and configure schedules, storage, retention, and notifications.

Written by: gymynnym

Postgresus: PostgreSQL’s Reverse Cursed Technique

What Is Postgresus?

Original: Free, open source and self-hosted solution for automated PostgreSQL backups. With multiple storage options and notifications
Translation: A free, open-source, self-hosted solution for automated PostgreSQL backups with multiple storage options and notifications.

RostislavDugin/postgresus is an automated PostgreSQL backup tool. Its main features include:

1. Scheduled Backups

Run backups at specified times. Balanced compression reduces storage requirements by a factor of 4–8.

2. Multiple Storage Destinations

Use local storage or cloud storage such as S3, R2, and Google Drive. Security options are also available depending on the destination.

3. Smart Notifications

Receive success and failure notifications through email, Telegram, Slack, Discord, and other channels.

See the Postgresus features documentation for more.

Installing Postgresus

An automatic installation script is available, but I am more comfortable with Docker Compose, so that is what we will use.

services:
  my-postgres:
    container_name: my-postgres
    image: postgres:18
    # more options
  my-postgresus:
    container_name: my-postgresus
    image: rostislavdugin/postgresus:latest
    ports:
      - '4005:4005' # Port for the WebUI
    volumes:
      - ./postgresus/data:/postgresus-data # Backup data volume mount
    depends_on:
      - my-postgres # PostgreSQL dependency

I used PostgreSQL 18 for this installation.
When defining the Postgresus container, configure the WebUI port and mount a volume for backup data.

Using Postgresus

1. Open the Postgresus WebUI

Open http://yourhost:4005/ in your browser.

Sign up admin.png
Sign up admin

Follow the on-screen instructions to create an admin account.

Note: I hope your password is not on this list. :)

2. Create a Workspace

Create workspace.png
Create worksapce

After setting up the admin account, click Create workspace.

A Workspace is Postgresus’s unit for managing databases, storage, notification settings, and more.

3. Configure Backups

Add database for backup.png
Add database for backup

Next, configure the PostgreSQL database to back up, using the container defined in Docker Compose.

You will then be asked whether to create a dedicated read-only backup user. This is optional, and I will skip it here.

Add backup options.png
Add backup options

After configuring the target database, configure the backup settings. I will use:

  • Every day at 4 a.m.
  • Three retries on failure.
  • One CPU for restores.
  • Retain backups for one month.
  • Local storage without encryption.
  • Notify on success and failure.

4. Configure Notifications

Add notifier.png
Add notifier

Finally, configure a Notifier. I used a Discord webhook, but Slack, Telegram, and various other providers are supported.

Discord.png
Connection test and backup notifications in Discord
Postgres backups.png
Postgres backups

Once configured, a backup runs as shown above and appears in the backup list.
Delete, restore, and download actions are easy to use. Clicking Make backup right now also creates an immediate backup.

Results

$ docker stats my-postgresus
CONTAINER ID   NAME            CPU %     MEM USAGE / LIMIT
............   my-postgresus   0.00%     77.63MiB / ...

Here is CPU and memory usage while idle. Postgresus seems quite frugal.

├── docker-compose.yml
└── postgresus
    └── data
        ├── backups
        │   └── ...
        ├── pgdata
        ├── secret.key
        └── temp

The backup files are present and correct, too.

Closing Thoughts

Now my data is safe!
It looks like it is time to set up RAID or backups for the physical drives next…