NewOut Plane raises funding, backed by Maza VenturesRead the announcement
Databases

PostgreSQL

Overview

Deploy a managed PostgreSQL instance on Out Plane with automated daily backups, point-in-time recovery, and connection pooling. PostgreSQL is the most advanced open-source relational database with full ACID compliance, complex queries, JSON support, full-text search, and the pgvector extension for AI embedding storage and similarity search.

Out Plane provisions your PostgreSQL instance with optimized configurations for your workload, automated backups with 30-day retention, monitoring dashboards, and secure networking. Connection pooling is included to handle high-concurrency workloads efficiently. Upgrade and scale vertically without downtime.

Ideal for web applications, SaaS backends, financial systems, geospatial applications with PostGIS, AI/ML workloads using pgvector, and any production workload that needs a reliable, ACID-compliant relational database.

Deployment guide

Read the full PostgreSQL deployment tutorial

PostgreSQL Docker Guide: Run Postgres 18 With a Volume

Updated

PostgreSQL is an open source relational database. The official PostgreSQL Docker image, postgres on Docker Hub, runs on Out Plane as an ordinary application: deploy postgres:18.6, attach a volume at /var/lib/postgresql, set POSTGRES_PASSWORD, and keep TCP port 5432 private. Other apps in your team then reach it at pgmain:5432.

Below: where the image keeps its data, which variables work only on first boot, memory tuning, and safe upgrades. Out Plane also offers managed PostgreSQL, compared near the end.

What You Need

  • An instance size. op-20 (0.5 vCPU, 512 MB) fits a small database on PostgreSQL's default 128 MB of shared buffers. Move to op-34 (1 vCPU, 2 GB) when real traffic arrives.
  • A volume. 10 to 50 GB, chosen once. There is no resize, so a bigger disk later means a dump and restore.
  • One instance. An app with a volume runs a single instance, like any single Postgres server.
  • A strong password. openssl rand -hex 24 gives one that is safe inside a connection URL.

Deploy PostgreSQL on Out Plane

  1. Select Deploy PostgreSQL on the template page. It opens the console's Applications page. Nothing is created or filled in yet.
  2. Create an application and choose the Image source. Enter postgres:18.6. The postgres:16 shortcut there fills in only the image and a private port, with no volume, so type the reference yourself.
  3. Name the app pgmain. Names use letters and numbers, 5 to 45 characters, and are permanent. A few infrastructure names, such as database, are refused.
  4. Under Ports, add 5432 with protocol TCP and leave Public TCP access unchecked.
  5. Under Environment variables, add POSTGRES_USER=app, POSTGRES_DB=appdb and POSTGRES_PASSWORD with your generated value.
  6. Under Volumes, select Create volume, give it 10 GB or more, and set the mount path to /var/lib/postgresql.
  7. Under Compute, pick op-20 or op-34, keep the count at 1, and select Deploy app.

The first boot runs initdb before the server accepts connections. With the outplane CLI:

bash
outplane volume create pgdata --size 10 --json --fields id
outplane app create pgmain --image postgres:18.6 --port 5432:tcp --size op-20 \
  --env POSTGRES_USER=app --env POSTGRES_DB=appdb \
  --env POSTGRES_PASSWORD=<your-password> \
  --volume <VOLUME_ID>:/var/lib/postgresql
outplane app get pgmain   # attaching is best effort, confirm the mount

--port 5432:tcp stays private because it does not say public.

Connect Your App to Postgres

Other apps in your team reach every port at its internal address, {app}:{port} (see the networking docs). Give your app the URL and redeploy it:

bash
outplane env set DATABASE_URL=postgresql://app:<your-password>@pgmain:5432/appdb --app <your-app> --deploy

For a SQL prompt, open the Shell tab on pgmain and set the command to psql -U app -d appdb. The image trusts local socket connections, so psql does not ask for the password there.

PostgreSQL Docker Environment Variables

From the official image docs:

VariableWhat it does
POSTGRES_PASSWORDRequired. Password of the superuser. Must not be empty.
POSTGRES_USERSuperuser name, postgres if unset.
POSTGRES_DBName of the first database. Defaults to the user name.
POSTGRES_INITDB_ARGSExtra flags for initdb, such as a locale.
POSTGRES_HOST_AUTH_METHODLeave unset to keep scram-sha-256 passwords. Never set it to trust.
PGDATAData directory. On 18 it is /var/lib/postgresql/18/docker.

The POSTGRES_* variables act only when the data directory is empty. Changing POSTGRES_PASSWORD later and redeploying does nothing. Run ALTER USER app WITH PASSWORD '...'; in psql instead, then update DATABASE_URL in every app that uses it. Out Plane keeps these values masked under Settings → Environment, and changes apply on the next deployment.

On PostgreSQL 17 or older, the image keeps data in /var/lib/postgresql/data. Mount the volume there and set PGDATA=/var/lib/postgresql/data/pgdata, because PostgreSQL's own docs advise against using a disk's mount point as the data directory.

Tune Memory With the Start Command

The start command replaces the image's entrypoint, so begin it with docker-entrypoint.sh. Without it, the image's setup script never runs and the server exits. On op-34, set it under Settings → Build to:

bash
docker-entrypoint.sh postgres -c shared_buffers=512MB -c max_connections=100

PostgreSQL's resource docs suggest 25% of memory for shared_buffers on machines with 1 GB or more. On op-20, keep the default.

From a Postgres Docker Compose File to Out Plane

Out Plane does not read compose files. Each service becomes its own app. A typical PostgreSQL Docker Compose service:

yaml
services:
  db:
    image: postgres:18.6
    environment:
      POSTGRES_USER: app
      POSTGRES_PASSWORD: change-me
      POSTGRES_DB: appdb
    volumes:
      - pgdata:/var/lib/postgresql
    ports:
      - "5432:5432"
    shm_size: 128mb
volumes:
  pgdata:
  • image, environment and volumes become the Image field, environment variables (paste them as KEY=value lines) and a volume at /var/lib/postgresql.
  • ports becomes a private TCP port 5432. Other apps call pgmain:5432 instead of db:5432.
  • shm_size has no Out Plane field. If a large parallel query fails with could not resize shared memory segment, add -c max_parallel_workers_per_gather=0 to the start command.

Custom Domain and HTTPS

Custom domains with automatic HTTPS attach only to HTTP or H2C ports, so a Postgres TCP port cannot take one. Keep it private. For access from your laptop, link an IP access profile with your ranges, then check Public TCP access under Settings → Network and select Save & deploy to get an assigned host and port. Uncheck it and deploy again afterwards. PostgreSQL's ssl setting defaults to off, so that link is unencrypted unless you add certificates.

Updates and Backups

Image apps never deploy on their own. For a minor release, open Deployments → Deploy and enter the new reference, or run this once 18.7 is published:

bash
outplane deploy create pgmain --image postgres:18.7 --wait

Minor releases never change the storage format, so this is safe. A major version is not. Do not change 18 to 19 in place: the newer image looks in /var/lib/postgresql/19/docker, finds nothing, and starts an empty cluster beside your data. Instead, create a second app such as pgnew on the new major, with its own volume and the same user and password. Stop writes to pgmain so the dump misses nothing, then run this in the Shell tab of pgnew:

sh
PGPASSWORD="$POSTGRES_PASSWORD" pg_dumpall -h pgmain -U app -f /var/lib/postgresql/all.sql
psql -U app -d appdb -f /var/lib/postgresql/all.sql

Errors that role app and database appdb already exist are expected. Point DATABASE_URL at pgnew:5432, redeploy your apps, then remove the old app and volume.

Out Plane does not snapshot volumes, and a deleted volume leaves no copy, so your dumps are your backups. Before any risky change, run pg_dump -U app -Fc -f /var/lib/postgresql/appdb.dump appdb in the Shell tab. That file sits on the same disk, so also copy dumps elsewhere, such as an Out Plane bucket. The PostgreSQL backup guide covers schedules and restore drills.

What PostgreSQL Costs on Out Plane

Compute is billed per instance-minute. Volumes cost $0.30 per GB per month while they exist.

  • Small: op-20 at $0.0000694 per minute ($3.00 for a 30-day month) plus 10 GB ($3.00) is $6.00 of usage. Starter costs $9 a month and includes $9 of usage, so the bill stays $9. On Pro it is $29.
  • Busier: op-34 at $0.0004167 per minute ($18.00) plus 20 GB ($6.00) is $24.00. Starter comes to $24. Pro includes $15 of usage, so it comes to $38.

Starter and Pro both start with a 14 day free trial. Full rates are on the pricing page.

Postgres Hosting: Container or Managed Database?

Out Plane's managed PostgreSQL costs $6.00 per database per month, offers versions 14 to 18 in 8 regions including Frankfurt, requires SSL on every connection, and includes automated backups and monitoring. Compute is fixed between 0.25 and 1 CU during the preview. Create one under Create → Database and paste its connection string into your app, as the databases docs show.

Pick the container for full control of postgresql.conf, your own init scripts, or a database on the private network next to your apps. Pick managed for backups you do not have to script. The PostgreSQL production guide goes deeper on pooling and tuning.

FAQ

Is it safe to run PostgreSQL in Docker in production?

Yes, if the data directory lives on a persistent volume, the tag is pinned to a full version, and you test restores from your dumps. The usual failures are a wrong mount path, which loses data on the next deploy, and an in-place major upgrade.

Where does the PostgreSQL Docker image store data?

From version 18 the data lives in /var/lib/postgresql/18/docker, so you mount the volume at /var/lib/postgresql. Up to version 17 it lives in /var/lib/postgresql/data.

What is the default username and password of the postgres image?

The default user is postgres. There is no default password: POSTGRES_PASSWORD is required, and the container will not initialize without it unless POSTGRES_HOST_AUTH_METHOD=trust is set, which you should avoid.



Start deploying in minutes

Connect your GitHub repository and deploy your first application today. Start with a 14-day free trial.

Start 14-day free trial