Backing up your PostgreSQL database is one of the most critical tasks for any database administrator or development team. Without proper backups, you risk losing valuable data due to hardware failures, human errors, or security breaches. In this guide, we'll show you how to create automated, secure PostgreSQL backups using Postgresus - an enterprise-grade solution that's surprisingly easy to use.
What is Postgresus?
Postgresus is the most popular open-source solution for automated PostgreSQL backups, trusted by individual DBAs and enterprises alike. It's a free, self-hosted backup management system that combines enterprise-grade features with simplicity and ease of use.
Key highlights:
- Enterprise-Grade Security: AES-256-GCM encryption protects your backup files
- Multi-Cloud Support: Store backups on local storage, S3, Cloudflare R2, Google Drive, NAS, Dropbox, and more
- Flexible Scheduling: Hourly, daily, weekly, or monthly backups at specific times
- Smart Notifications: Real-time alerts via Email, Telegram, Slack, Discord, or webhooks
- Team-Friendly: Built-in workspaces, role-based access control, and audit logs
- Universal Compatibility: Supports PostgreSQL versions 12, 13, 14, 15, 16, 17, and 18
- Open Source: Apache 2.0 licensed, fully transparent and inspectable
Whether you're managing a single database or orchestrating backups for an entire enterprise, Postgresus scales to meet your needs while maintaining simplicity.
Prerequisites
Before we begin, ensure you have:
- A PostgreSQL database (version 12 or higher)
- Docker installed on your system (or Linux for script-based installation)
- Database credentials with appropriate backup permissions
- A storage destination (local disk, cloud storage account, etc.)
Step 1: Install Postgresus
Postgresus offers multiple installation methods. Choose the one that best fits your environment.
Option A: Automated Script Installation (Linux Only, Recommended)
If you're on Linux, the easiest way to get started is with the automated installation script. This script will install Docker (if needed), set up Postgresus, and configure it to start automatically on system reboot.
sudo apt-get install -y curl && \
sudo curl -sSL https://raw.githubusercontent.com/RostislavDugin/postgresus/refs/heads/main/install-postgresus.sh \
| sudo bash
The script handles everything automatically:
- ✅ Installs Docker with Docker Compose (if not already installed)
- ✅ Sets up Postgresus
- ✅ Configures automatic startup on system reboot
Option B: Docker Run (Cross-Platform)
For a quick start on any platform (Linux, macOS, or Windows), use this single Docker command:
docker run -d \
--name postgresus \
-p 4005:4005 \
-v ./postgresus-data:/postgresus-data \
--restart unless-stopped \
rostislavdugin/postgresus:latest
This command will:
- Start Postgresus in a Docker container
- Map port 4005 for web access
- Store all data in the
./postgresus-datadirectory - Automatically restart the container on system reboot
Option C: Docker Compose
For more control over your deployment, create a docker-compose.yml file:
services:
postgresus:
container_name: postgresus
image: rostislavdugin/postgresus:latest
ports:
- "4005:4005"
volumes:
- ./postgresus-data:/postgresus-data
restart: unless-stopped
Then start the service:
docker compose up -d
Once installed, access the Postgresus dashboard at http://localhost:4005 in your web browser.
Step 2: Add Your Database and Configure Credentials
Now that Postgresus is running, let's add your first database for backup.
-
Open the Dashboard: Navigate to
http://localhost:4005in your browser - Create admin user: If this is your first time, create an admin account
- Add New Database: Click the "New Database" button
-
Enter Connection Details:
-
Host: Your PostgreSQL server address (e.g.,
localhost,192.168.1.100, ordb.example.com) -
Port: PostgreSQL port (default is
5432) - Database Name: The name of the database you want to back up
- Username: PostgreSQL user with backup permissions
- Password: The user's password
- SSL Mode: Enable if your database requires SSL connections
-
Host: Your PostgreSQL server address (e.g.,
Test Connection: Postgresus will automatically test the connection to ensure credentials are correct
Step 3: Enable Backup Encryption (Recommended)
One of Postgresus's standout features is built-in AES-256-GCM encryption. This is particularly important if you're storing backups in shared cloud storage or want zero-trust security.
To enable encryption:
- Navigate to Encryption Settings: In the database configuration screen, find the "Encryption" section
- Enable Encryption: Toggle the encryption option to "Enabled"
- Confirm Settings: Save the encryption configuration
Why Encrypt?
- Zero-Trust Storage: Encrypted backups are useless to anyone without the password, even if stored in shared cloud storage
- Compliance: Meet data protection regulations (GDPR, HIPAA, etc.)
- Peace of Mind: Your sensitive data remains protected even if storage is compromised
Note: You can still download unencrypted backups via the "Download" button in the dashboard for use with pg_restore or other tools.
Step 4: Select Storage Destination
Postgresus supports multiple storage options, giving you flexibility to choose the best fit for your infrastructure.
Available Storage Options:
- Local Storage: Keep backups on your server or VPS
- Amazon S3: Industry-standard cloud object storage
- Cloudflare R2: S3-compatible with zero egress fees
- Google Drive: Easy cloud storage integration
- NAS: Network-attached storage devices
- Dropbox: Popular cloud storage option
- And more: Check supported storages
Configuring Your Storage:
- Open Storage Settings: In the database configuration, navigate to "Storage Destination"
- Select Storage Type: Choose from the available storage options
-
Enter Credentials:
- For Local Storage: Specify the backup directory path
- For S3-Compatible (S3, R2): Enter access key, secret key, bucket name, and region
- For Google Drive: Authenticate with OAuth
- For NAS: Provide network path and credentials
- Set Retention Policy (Optional): Define how long to keep backups (e.g., keep last 30 days)
- Test Storage: Postgresus will verify it can write to your chosen storage
- Save Configuration: Confirm your storage settings
Step 5: Configure Backup Schedule
With your database and storage configured, it's time to set up the backup schedule.
-
Choose Frequency: Select how often backups should run
- Hourly: For high-frequency changes (every 1, 2, 4, 6, or 12 hours)
- Daily: Most common option, runs once per day
- Weekly: For less critical or infrequently changing databases
- Monthly: For archival purposes
-
Set Execution Time: Choose when backups should run
- Best Practice: Schedule during low-traffic periods (e.g., 3:00 AM)
- Reduces impact on database performance
- Ensures faster backup completion
-
Enable Compression: Postgresus uses smart compression to save 4-8x space with only ~20% overhead
- Automatically enabled by default
- Balances compression ratio with performance
Save and Activate: Enable the backup schedule to start automatic backups
Step 6: Set Up Notifications (Optional but Recommended)
Stay informed about your backup status with real-time notifications.
- Navigate to Notifications: In the dashboard, go to "Notifiers"
- Add Notification Channel: Click "Add Notifier"
-
Choose Channel:
- Email: Send notifications to your inbox
- Telegram: Instant messages to your phone
- Slack: Integrate with team channels
- Discord: For Discord-based teams
- Webhooks: Custom integrations with your systems
-
Configure Success/Failure Alerts:
- Get notified when backups complete successfully
- Receive immediate alerts if backups fail
- Include detailed error information for troubleshooting
Test Notification: Send a test message to verify configuration
Link to Database: Associate the notifier with your database backup configuration
Step 7: Verify and Monitor
After configuration, Postgresus will begin backing up your database according to the schedule.
Monitoring Your Backups:
- Dashboard Overview: View all backup jobs, success rates, and storage usage
- Backup History: See a complete log of all backup operations
- Health Checks: Postgresus monitors backup job health and alerts on issues
- Audit Logs: Track all system activities and configuration changes
Testing Backup Restoration:
It's crucial to periodically test that your backups can actually be restored:
- Select a Backup: In the dashboard, choose a backup to restore
-
Download or Restore:
- Download the backup file for manual restoration with
pg_restore - Use one-click restore to a test database
- Download the backup file for manual restoration with
- Verify Data Integrity: Check that all data is intact and accessible
Remember: A backup you haven't tested is just hope, not a recovery plan!
Advanced Features for Teams and Enterprises
Workspaces
Group databases, notifiers, and storages for different projects or teams. Perfect for agencies managing multiple clients or enterprises with separate departments.
Role-Based Access Control
Assign different permission levels:
- Viewer: Read-only access to view backup status
- Member: Can manage backups within assigned workspaces
- Admin: Full management capabilities
Audit Logging
Track every action taken in the system:
- Who created or modified backup configurations
- When backups were run or restored
- Changes to access permissions
- System configuration updates
Best Practices for PostgreSQL Backups
Test Regularly: Schedule quarterly restoration tests to ensure backups are viable
Monitor Actively: Set up notifications and regularly review backup logs
Secure Credentials: Use encryption and store passwords in secure vaults
Document Recovery Procedures: Create runbooks for emergency restoration scenarios
Review Retention Policies: Balance storage costs with recovery time objectives (RTO)
Conclusion
Creating reliable PostgreSQL backups doesn't have to be complicated. With Postgresus, you get an enterprise-grade backup solution that's as easy to use as it is powerful. In just a few steps, you've set up automated, encrypted backups with your choice of storage destinations and real-time notifications.
Whether you're a solo developer protecting a side project or an enterprise DBA managing critical production databases, Postgresus provides the tools you need without the complexity you don't want.
Key Takeaways:
- ✅ Installation takes minutes with Docker or automated scripts
- ✅ Enterprise-grade AES-256-GCM encryption protects your data
- ✅ Flexible storage options work with your existing infrastructure
- ✅ Automated scheduling ensures consistent backup coverage
- ✅ Real-time notifications keep you informed
- ✅ Open source and self-hosted means full control and transparency
Ready to secure your PostgreSQL databases? Get started with Postgresus today at postgresus.com.
Additional Resources:




Top comments (0)