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.

Tip: PostgreSQL on Dublyo runs in a Docker container with a persistent volume, so your data survives container restarts and redeployments.

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 TypeRAMBest For
Starter (minimum)4 GBSmall-medium databases, development, side projects
Standard (recommended)8 GBProduction workloads, moderate query complexity
Performance16 GBLarge 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.

Tip: PostgreSQL uses persistent Docker volumes for data safety. Your data is stored directly on the server's disk and persists across container restarts, redeployments, and upgrades.

Deploy PostgreSQL

Deploying PostgreSQL on Dublyo takes just a few clicks. Follow these steps to get your database up and running.

1

Go to the Deploy page

Click Deploy in the sidebar navigation to open the template catalog.

2

Search for "PostgreSQL"

Use the search bar at the top to find the PostgreSQL template quickly.

3

Click the PostgreSQL template

Select the PostgreSQL card to open the deployment configuration view.

4

Set your app name

Give your PostgreSQL instance a descriptive name (e.g., my-app-db or production-postgres).

5

Set POSTGRES_PASSWORD

Enter a strong password for the database superuser. This is required and cannot be changed easily after deployment.

6

Optionally set POSTGRES_DB and POSTGRES_USER

Customize the default database name and username if needed. These default to postgres if left blank.

7

Select your server

Choose which server to deploy PostgreSQL on. You can run it alongside other apps on the same server.

8

Click Deploy

Hit the Deploy button. PostgreSQL will be pulled, configured, and running within a minute or two.

Important: Use a strong, unique password for 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

VariableDefaultRequiredDescription
POSTGRES_PASSWORDYesSuperuser password for the PostgreSQL instance
POSTGRES_USERpostgresNoName of the default superuser account
POSTGRES_DBpostgresNoName 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.

Tip: You can update environment variables after deployment from the app management page. However, changing 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/postgres

External 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.

Security: If you expose port 5432 to the internet, always use a strong password and consider restricting access to specific IP addresses. For production databases, prefer connecting from apps on the same server via the internal Docker network.

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
Tip: You can deploy pgAdmin as a separate template on Dublyo and connect it to your PostgreSQL instance for a fully self-hosted database management experience.

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.

Important: Always maintain regular backups of your PostgreSQL data. Hardware failures, accidental deletions, and application bugs can all lead to data loss. A backup strategy is not optional for production databases.

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.sql

For compressed backups that save disk space:

pg_dump -h server-ip -U postgres -Fc -d dbname > backup.dump

Automated 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.dump

Volume-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.

Tip: Combine logical backups (pg_dump) for day-to-day recovery with volume snapshots for full disaster recovery. Store backups in a separate location from your server for maximum safety.

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_USER and POSTGRES_PASSWORD environment variables you set during deployment.
  • Check the database name — Ensure you're connecting to the correct database. The default is postgres unless you specified a custom POSTGRES_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 FULL to 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.
Tip: Check the container logs from the app management page for detailed error messages. PostgreSQL's log output is usually very descriptive and will point you to the exact issue.

Need Help?

Can't find what you're looking for? Check the full documentation or reach out.