Deploy PostgreSQL on Dublyo
Run a production-ready PostgreSQL database on your own server with persistent storage and automatic backups.
PostgreSQL is the world's most advanced open-source relational database. It powers everything from small side projects to enterprise applications handling millions of rows. With Dublyo, you can deploy a fully configured PostgreSQL instance on your own cloud server in under two minutes — no manual setup, no Docker knowledge required.
Requirements
Before deploying PostgreSQL, make sure you have a running server on Dublyo. If you haven't created one yet, follow the server creation guide first.
Server Sizing
| Server Type | RAM | Best For |
|---|---|---|
| Starter (minimum) | 4 GB | Small-medium databases, development, side projects |
| Standard (recommended) | 8 GB | Production workloads, moderate query complexity |
| Performance | 16 GB | Large datasets, complex queries, high concurrency |
A Starter server is sufficient for most small-to-medium databases. For production workloads with frequent queries or large datasets, a Standard or Performance server is recommended to ensure consistent performance.
Deploy PostgreSQL
Deploying PostgreSQL on Dublyo takes just a few clicks. Follow these steps to get your database up and running.
Go to the Deploy page
Click Deploy in the sidebar navigation to open the template catalog.
Search for "PostgreSQL"
Use the search bar at the top to find the PostgreSQL template quickly.
Click the PostgreSQL template
Select the PostgreSQL card to open the deployment configuration view.
Set your app name
Give your PostgreSQL instance a descriptive name (e.g., my-app-db or production-postgres).
Set POSTGRES_PASSWORD
Enter a strong password for the database superuser. This is required and cannot be changed easily after deployment.
Optionally set POSTGRES_DB and POSTGRES_USER
Customize the default database name and username if needed. These default to postgres if left blank.
Select your server
Choose which server to deploy PostgreSQL on. You can run it alongside other apps on the same server.
Click Deploy
Hit the Deploy button. PostgreSQL will be pulled, configured, and running within a minute or two.
POSTGRES_PASSWORD. This password grants full superuser access to your database. Avoid simple passwords like password123. Configuration
PostgreSQL on Dublyo is configured through environment variables set during deployment. Here are the available options.
Environment Variables
| Variable | Default | Required | Description |
|---|---|---|---|
POSTGRES_PASSWORD | — | Yes | Superuser password for the PostgreSQL instance |
POSTGRES_USER | postgres | No | Name of the default superuser account |
POSTGRES_DB | postgres | No | Name of the default database created on first start |
Port
PostgreSQL listens on the standard port 5432, which is exposed on the server. Other containers on the same server can connect using the container name as the hostname on this port.
Data Storage
All PostgreSQL data is stored in a persistent Docker volume mounted at /var/lib/postgresql/data inside the container. This means your data survives container restarts, image updates, and redeployments. The volume lives on the server's SSD for fast I/O.
POSTGRES_PASSWORD after initial setup requires manual intervention inside the database — it won't automatically update the existing superuser password. Connecting to PostgreSQL
Once deployed, you can connect to your PostgreSQL instance from other applications, database clients, or the command line.
Connection String
Use the standard PostgreSQL connection string format to connect from any client or application:
postgresql://user:password@server-ip:5432/dbname Replace user, password, server-ip, and dbname with your actual values. You can find your server IP on the server detail page in your Dublyo dashboard.
From Other Apps on the Same Server
If you have other applications deployed on the same Dublyo server, they can connect to PostgreSQL using the container name as the hostname instead of the server IP. This uses Docker's internal networking and is faster and more secure since traffic never leaves the server.
postgresql://postgres:yourpassword@my-app-db:5432/postgresExternal Access
To connect from outside the server (e.g., from your local machine or a remote application), use the server's public IP address. Make sure your server's firewall allows incoming connections on port 5432.
Recommended Tools
- pgAdmin — Full-featured web-based GUI for managing PostgreSQL databases
- DBeaver — Universal database tool with a visual query builder and ERD support
- psql CLI — The official PostgreSQL command-line client, great for scripting and quick queries
- TablePlus — Lightweight native database client for macOS, Windows, and Linux
Backup & Restore
Regular backups are essential for any production database. PostgreSQL provides powerful tools for creating and restoring backups at both the logical and physical level.
Logical Backups with pg_dump
Use pg_dump to create a logical backup of your database. This exports your data as SQL statements that can be restored on any PostgreSQL instance.
pg_dump -h server-ip -U postgres -d dbname > backup.sqlFor compressed backups that save disk space:
pg_dump -h server-ip -U postgres -Fc -d dbname > backup.dumpAutomated Backups
Schedule automated backups using a cron job on your server or by deploying an n8n workflow on Dublyo. Automated backups ensure you always have a recent copy of your data without manual intervention.
Restoring from Backup
Restore a plain SQL backup with psql:
psql -h server-ip -U postgres -d dbname < backup.sql Restore a compressed backup with pg_restore:
pg_restore -h server-ip -U postgres -d dbname backup.dumpVolume-Level Snapshots
For full instance snapshots, you can use Portainer (pre-installed on every Dublyo server) to back up the Docker volume directly. This captures the entire database state including all databases, roles, and configuration. Volume snapshots are useful for disaster recovery and migrating to a different server.
Troubleshooting
Running into issues with your PostgreSQL deployment? Here are the most common problems and how to resolve them.
Connection Refused
If you're getting a "connection refused" error when trying to connect to PostgreSQL:
- Check if PostgreSQL is running — Open the app management page in your Dublyo dashboard and verify the container status is "Running". If it's stopped, click Restart.
- Verify port 5432 is open — If connecting from outside the server, ensure your server's firewall allows incoming TCP connections on port 5432. Dublyo's default firewall only opens HTTP, HTTPS, and SSH.
- Check the server IP — Make sure you're using the correct server IP address from your Dublyo dashboard, not the container's internal IP.
- Wait for startup — After a fresh deployment or restart, PostgreSQL may take a few seconds to initialize. Try again after 10-15 seconds.
Authentication Failed
If you're seeing "password authentication failed" or similar authentication errors:
- Verify your credentials — Double-check that the username and password match the
POSTGRES_USERandPOSTGRES_PASSWORDenvironment variables you set during deployment. - Check the database name — Ensure you're connecting to the correct database. The default is
postgresunless you specified a customPOSTGRES_DB. - Special characters in password — If your password contains special characters, make sure they are properly escaped or URL-encoded in your connection string.
Disk Space Issues
If PostgreSQL stops accepting writes or becomes unresponsive due to disk space:
- Monitor volume usage — Check disk usage from the server management page or via Portainer. PostgreSQL logs warnings when disk space is low.
- Clean up old data — Remove unused tables, run
VACUUM FULLto reclaim space from deleted rows, or archive old data. - Upgrade your server — If your database has outgrown a Starter server, consider upgrading to a Standard or Performance server for more storage and better I/O performance.
- Check WAL files — Write-ahead log files can accumulate if replication is misconfigured. Review and clean up old WAL segments if necessary.
Need Help?
Can't find what you're looking for? Check the full documentation or reach out.