Back to all templates
PostgreSQL logo

PostgreSQL

Database256MB+ RAM

PostgreSQL database with persistent storage

databasesqlrelationalpostgresopen-source

Deploy PostgreSQL in 3 Steps

1

Connect Your VPS

Add your server credentials to Server Compass

2

Select PostgreSQL

Choose from our template library

3

Deploy & Configure

Fill in settings and click Deploy

No Docker knowledge required
Step-by-step deployment guide

Deploy PostgreSQL on a VPS with Server Compass

Use the PostgreSQL template in Server Compass to deploy a persistent PostgreSQL database on your VPS, then verify it from the app detail and DB Admin view.

About 5 minutesBrowser verified
1
Step 1

Open the server Apps tab

Select your VPS, open the Apps tab, and start a new app deployment. Keep sensitive server details hidden before capturing or sharing screenshots.

Server Compass Apps tab before creating a PostgreSQL app
2
Step 2

Choose an app template

Click New App and choose the template deployment path so Server Compass can load the built-in catalog.

Choosing to deploy an app from a Server Compass template
3
Step 3

Search for PostgreSQL

Use the template picker search to find PostgreSQL in the Server Compass template catalog.

Searching for PostgreSQL in the Server Compass template picker
4
Step 4

Select the PostgreSQL template

Choose the PostgreSQL template. Server Compass fills the Docker image, persistent volume, default database name, and generated credentials.

PostgreSQL template selected in Server Compass
5
Step 5

Review the generated database settings

Confirm the app name, host port, database name, username, and generated password. In the pilot run, the app was named postgresql-demo and the host port was changed to 15432 to avoid conflicts.

Reviewing PostgreSQL deployment settings and generated credentials
6
Step 6

Deploy PostgreSQL

Review the final settings, click Deploy Now, and let Server Compass create the PostgreSQL container and volume on the VPS.

Reviewing PostgreSQL settings before clicking Deploy Now
7
Step 7

Confirm the database is running

After deployment finishes, return to the Apps tab and confirm the PostgreSQL app is marked Running with its database connection section available.

PostgreSQL template running in the Server Compass Apps tab
8
Step 8

Open DB Admin to verify access

Open the PostgreSQL app details and switch to DB Admin. Seeing the DB Admin screen load confirms Server Compass can reach the deployed database service without exposing the generated password.

PostgreSQL DB Admin page showing the deployed database is available

After PostgreSQL Opens

  • Copy the masked external connection string only when you are ready to connect from a trusted client.
  • Use DB Admin, psql, or your application container to create schemas and tables.
  • Keep the generated password in Server Compass and avoid pasting it into screenshots or docs.
  • Restrict external access later if the database only needs to be reachable from Docker apps on the same server.

Verified Result

Server Compass showed one running PostgreSQL container, port 15432 mapped to 5432, and the DB Admin table view loaded for the app database.

PostgreSQL deployment questions

What does the PostgreSQL template deploy?

It deploys the official PostgreSQL Docker image with persistent storage and generated database credentials.

Which port did the pilot use?

The pilot used host port 15432 mapped to PostgreSQL port 5432 to avoid conflicts with any existing PostgreSQL service.

Should this become a blog post?

No. The deployment guide should live on the PostgreSQL template detail page and be linked from the reusable template deployment docs page.

Terminal Deployment

PostgreSQL CLI Deployment

Deploy PostgreSQL the traditional way with SSH and Docker Compose.

1

SSH into Your Server

Launch your preferred terminal and connect to your VPS using SSH.

terminal
# Log into your server
ssh root@<your-server-ip>

# If using key-based auth
ssh -i ~/.ssh/my-key root@<your-server-ip>

First time? Docker not installed? Run: curl -fsSL https://get.docker.com | sh

2

Create Working Directory

Prepare a directory for your application files and configuration.

terminal
# Create and navigate to project directory
mkdir -p ~/apps/postgresql
cd ~/apps/postgresql
3

Configure Your Containers

Create the Docker Compose configuration file with these contents:

docker-compose.yml
services:
  postgres:
    image: postgres:16-alpine
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=<your-postgres-password>
      - POSTGRES_DB=app
    volumes:
      - postgres_data:/var/lib/postgresql/data
    restart: unless-stopped
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d app"]
      interval: 10s
      timeout: 5s
      retries: 5

volumes:
  postgres_data:
Deployment Settings
PORTHost port to expose(default: 5432)
POSTGRES_USERDatabase username(default: postgres)
POSTGRES_PASSWORDDatabase password
POSTGRES_DBDatabase name(default: app)
4

Deploy with Docker Compose

Launch the application stack using Docker Compose.

terminal
# Deploy the application
docker compose up -d

# Check container health
docker compose ps

# Monitor logs
docker compose logs -f --tail=100
5

Open Required Ports

Enable external access by opening the necessary port.

terminal
# Allow the application port through firewall
sudo ufw allow 5432/tcp
sudo ufw reload

# Access your app at:
# http://your-server-ip:5432
Skip the Terminal

There's an easier way. Meet Server Compass.

Server Compass makes deploying PostgreSQL effortless. Visual setup, one-click deploy, done.

  • Intuitive dashboard
  • Deploy in 3 minutes
  • Free SSL included
  • Blue-green deploys
  • Real-time logs
  • Version history
Download Server Compass$29 one-time • Lifetime license

After Deployment

After deploying PostgreSQL with Server Compass, complete these steps to finish setup

1

Test the database connection

2

Create additional users if needed

3

Configure backup schedules

4

Set up monitoring and alerts

5

Review and optimize PostgreSQL configuration for your workload

6

Consider setting up replication for high availability

Need help? Check out our documentation for detailed guides.

PostgreSQL FAQ

Common questions about self-hosting PostgreSQL

How do I deploy PostgreSQL with Server Compass?

Simply download Server Compass, connect to your VPS, and select PostgreSQL from the templates list. Fill in the required configuration and click Deploy. The entire process takes under 3 minutes.

What are the system requirements for PostgreSQL?

PostgreSQL requires a minimum of 256MB RAM. We recommend a VPS with at least 1024MB RAM for optimal performance. Any modern Linux server with Docker support will work.

Can I migrate my existing PostgreSQL data?

Yes! Server Compass provides volume mapping that allows you to import existing data. You can also use standard PostgreSQL backup and restore procedures.

How do I update PostgreSQL to the latest version?

Server Compass makes updates easy. Simply click the Update button in your deployment dashboard, and the latest PostgreSQL image will be pulled and deployed with zero downtime.

Is PostgreSQL free to self-host?

PostgreSQL is open-source software. You only pay for your VPS hosting (typically $5-20/month) and optionally Server Compass ($29 one-time). No subscription fees or per-seat pricing.

Ready to Self-Host PostgreSQL?

Download Server Compass and deploy PostgreSQL to your VPS in under 3 minutes. No Docker expertise required.

Download Server Compass