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
- Go to Applications β your app β Environment.
- Click Add New β Add service β Database β Postgres.
- Give the service a clear name (youβll use it in reference variables).
- Click Create Service, open the service, then click Deploy.
- 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:
- Open the app or Docker service β Variables tab.
- Click the { } button next to a value.
- 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
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.