Skip to main content
Open console

PostgreSQL

The other relational database

2 min read

The other relational database, chosen instead of MariaDB, never beside it: a stack runs one database.

Choose it when your application is written for it, as plenty of Laravel, Symfony, Node, Go, Python, Rails and Rust 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: 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, postgresql://…

DATABASE_URL starts postgresql://, which every client takes: psycopg, SQLAlchemy, pgx, node-postgres, Doctrine. DB_DRIVER stays pgsql, PHP's name for it.

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, vallic tunnel <env> db opens it on 127.0.0.1:5432 for a desktop client or a browser. See Tunnels.

Versions

Version Status
18.6 Supported, and the default

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.

Need a hand?

Open a ticket from Support in the console. We answer on the ticket.

Open the console How support works