PostgreSQL

Postgres setup, internal and public credentials, POSTGRES reference variables, and dashboard actions.

Written By Zoro

Last updated 28 days ago

Postgres (PostgreSQL)

Postgres (PostgreSQL) is a reliable, full-featured SQL database, great for most apps that need tables, joins, and strong consistency. In dFlow the picker label is Postgres; behavior is the same as PostgreSQL you know elsewhere.

New to databases in dFlow? Start with the Databases overview for the big picture.

On this page

  • When Postgres is a good fit
  • Creating and deploying Postgres in the dashboard
  • Where your URL and password appear
  • Connecting your app without pasting secrets
  • Optional internet access (Expose)
  • Restart and stop

When to choose Postgres

Choose Postgres when you want a general-purpose relational database: structured data, SQL reporting, transactions, and extensions. If you specifically need MySQL compatibility, consider MariaDB or MySQL instead.

Set up Postgres in dFlow

  1. Go to Applications β†’ your app β†’ Environment.
  2. Click Add New β†’ Add service β†’ Database β†’ Postgres.
  3. Give the service a clear name (you’ll use it in reference variables).
  4. Click Create Service, open the service, then click Deploy.
  5. Wait until Deploy finishes successfully. dFlow sets up whatever the server needs automatically. You don’t install anything by hand.

Your connection details

On the database Overview, after deploy succeeds:

  • Connection URL: a full postgres://… link you can paste into tools that accept a URL.
  • Username, password, hostname, port, database name: same information broken out for drivers that want separate fields.

Use these internal values for apps and services in the same environment.

Public URL, host, and port only appear after you click Expose (see below). If you exposed the database, click Unexpose before Stop.

Link your app with reference variables

Instead of copying the password into an env field by hand, use Reference variables in your app or Docker service:

  1. Open the app or Docker service β†’ Variables tab.
  2. Click the { } button next to a value.
  3. Pick your Postgres service and the field you need.

Tokens use your database service name and the word POSTGRES in the middle. For example, if the service is named orders-db:

{{ orders-db.POSTGRES_URI }}

Suffix β€” What it fills in

_URIFull internal connection URL
_NAMEDatabase name
_USERNAMEUser name
_PASSWORDPassword
_HOSTInternal host
_PORTInternal port
_PUBLIC_HOST, _PUBLIC_PORT, _PUBLIC_URIOnly after Expose

Options with PUBLIC in the name stay disabled until the database is deployed and exposed.

Internet access (Expose)

Use Expose when something outside dFlow must connect (CI, local tools, another network). dFlow opens one public port for Postgres and shows Public credentials on Overview.

Use Unexpose to close public access. You must Unexpose before Stop if the database was exposed.

Day-to-day management

Use Overview, Logs, Deployments, or Settings for Restart, Stop, and Expose / Unexpose. Restart and Stop run as queued jobs on your compute. Stop is blocked until you Unexpose if the database is public.

After one successful Deploy, the Deploy button is hidden for databases (no in-app Redeploy flow like apps). See Where things live in the dashboard for the full tab and action list.

Useful links