Skip to main content

PostgreSQL

The other relational database

The other relational database. Chosen instead of MariaDB, never beside it: a stack runs one database, and choosing PostgreSQL is what stands MariaDB aside.

Choose it when your application is written for it — plenty of Laravel, Symfony, Node and Go applications are — or when you need something only it has. Drupal runs on it too. It is chosen when the environment is configured; vallic.yaml cannot switch an environment's database, because moving from one to another means moving everything in it.

Connecting to it

The same names as every other database:

DB_HOST      the service name
DB_PORT      5432
DB_DRIVER    pgsql
DB_NAME
DB_USER
DB_PASSWORD
DATABASE_URL all of it as one connection string

DB_USER is the application's own user, not the superuser. The database, the user and the password are made for the environment and never change. See Variables for the full list.

From your own computer — a desktop client, a browser — vallic tunnel <env> db opens it on 127.0.0.1:5432. See Tunnels.

Versions

Version Status
18.6 Supported, and the default
18.4 Deprecated — still runs, but move to something newer
18.3 Deprecated — still runs, but move to something newer

A deprecated version still runs and is still what some sites are on. It is listed so you can move before it goes, rather than finding out on the morning a build stops resolving it.

Pin the version, not the build: name 18.6 and the platform matches it to the current build, so a security rebuild reaches you without anybody editing a repository.

The version you name is the one your environment runs from the next deploy. This service keeps data, and not every version can read another's — before you change it, read Changing a service's version.

What you can change

In vallic.yaml — what each one does is on Service settings:

services:
  - postgres:
      version: '18.6'
      environment:
        POSTGRES_MAX_CONNECTIONS: …
        POSTGRES_SHARED_BUFFERS: …
        POSTGRES_WORK_MEM: …

Anything not on this list refuses the deploy, naming the variable — rather than being accepted and quietly ignored.