Database service
Services/PostgreSQL (PostGIS)

PostgreSQL (PostGIS) service

Self-hosted PostgreSQL database service with PostGIS extensions for geospatial data and spatial queries inside the stack.

Use it in stacks that need repeatable data workflows, scheduled backups, and realistic environment refreshes without rebuilding those steps manually.

On Wodby

How PostgreSQL (PostGIS) runs on Wodby

What Wodby and the image set up for this database service. Check it before creating databases, roles or extensions by hand, or adding connection settings to an application.

Database, user and passwords

Wodby manages the database and its user; the application does not create them.

  • One database and one user are created for the environment, both named after the application and the environment. The database is UTF8 with the en_US.utf8 locale.
  • The user's password and the password of the administrator postgres are generated once per environment (tokens password and root_password).
  • Further databases and users are added on Wodby, which runs the same create and grant actions. A role created by hand with a name Wodby later needs, but another password, makes the create action fail rather than replace it.

Ownership inside a database

Each managed database is owned by its own role named <database>:owner, which cannot log in. Granting a user access makes it a member of that role, and the user's sessions in that database act as that role. What follows from it:

  • Objects are created in the public schema and belong to the owner role, whichever user created them. All users granted access to the database share its data.
  • In such a session current_user is the owner role; session_user is the user that logged in. Code that compares current_user with the login name sees the owner role instead.
  • Only users granted access can connect to the database.
  • A backup carries no role names and no grants, so it can be imported into a database with another name and other users.

How a linked service reaches it

  • Host: the name of this app service inside the environment. Port: 5432.
  • A service linked to this one receives the host, port, database name, user name and password as environment variables defined by its own link (for example DB_HOST, DB_PORT, DB_NAME, DB_USERNAME, DB_PASSWORD on the PHP service). Read those in the application; do not hardcode them and do not connect as postgres from the application.

Extensions

Wodby creates extensions as the administrator. POSTGRES_DB_EXTENSIONS on this service is a comma-separated list of extensions created in a database when Wodby creates it. pgvector is bundled in the image but not enabled: add vector to that list. The label pgvector on the service means the library is present, not that the extension exists in the database.

Server configuration

The container writes /etc/postgresql/postgresql.conf on every start from a template and environment variables. Two ways to change settings, neither of them editing the generated file:

  • Set a variable on this service: POSTGRES_MAX_CONNECTIONS, POSTGRES_SHARED_BUFFERS, POSTGRES_WORK_MEM, POSTGRES_MAINTENANCE_WORK_MEM, POSTGRES_EFFECTIVE_CACHE_SIZE, POSTGRES_MAX_WAL_SIZE, POSTGRES_TIMEZONE, POSTGRES_SHARED_PRELOAD_LIBRARIES.
  • Override the service's config file config ("PostgreSQL config"), which replaces the template, for a setting no variable covers.

A change applies with the next deployment of the service. The service runs a single instance.

Data, backups and imports

  • Data is on the data volume.
  • The backup is a gzipped SQL dump of the environment's database. Tables matching its "excluded table contents" option keep their definition and lose their rows.
  • The database import replaces the data volume: the dump is loaded while a new, empty data directory is initialized, and the imported objects are handed to the database's owner role. It accepts .gz, .tar.gz, .tgz and .zip. Roles a dump names that this server does not have exist only while the dump is loaded.

Check the result

In the database container:

  • PGPASSWORD="$POSTGRES_PASSWORD" psql -h localhost -U postgres -c '\l' lists the databases and their owner roles.
  • PGPASSWORD="$POSTGRES_PASSWORD" psql -h localhost -U postgres -d <database> -c '\dx' lists the extensions in a database.

PostgreSQL (PostGIS) on Wodby

What this service adds to the PostgreSQL service it is based on.

  • The image bundles PostGIS, and POSTGRES_DB_EXTENSIONS has a default: postgis, postgis_raster, postgis_sfcgal, fuzzystrmatch, address_standardizer, address_standardizer_data_us, postgis_tiger_geocoder and postgis_topology. These extensions are created in a database when Wodby creates it; the application does not run CREATE EXTENSION postgis.
  • Setting POSTGRES_DB_EXTENSIONS on this service replaces the whole default list. To add an extension such as vector, repeat the PostGIS extensions that are needed and append it.

Everything else, including the database, user, ownership, configuration, backups and imports, is as in the PostgreSQL service.

Check the result

In the database container, PGPASSWORD="$POSTGRES_PASSWORD" psql -h localhost -U postgres -d <database> -c 'SELECT postgis_full_version();' shows the PostGIS version in a database.

Overview

Technical profile and packaging

This page shows how PostgreSQL (PostGIS) is packaged and versioned as a Wodby service, what it exposes at runtime, and which source artifacts it builds on.

Service type

Database service

Versions

18, 17

Ports and protocols

5432/TCP

Labels

postgis, postgres, postgresql, pgvector, postgres, postgresql

Persistent volumes

Data

Stacks

Use it inside ready-made stacks or your own

These public stacks already include PostgreSQL (PostGIS) as part of their default service model. You can start there and customize the stack, or compose your own stack around the same building block.

Data workflows

Keep recovery points ready and move data between environments

PostgreSQL (PostGIS) supports backup and import workflows, so teams can keep recovery points available, refresh staging, and create realistic working copies for testing or onboarding.

Attach backups to the service model

Keep scheduled backup behavior with the same versioned service definition instead of rebuilding it environment by environment.

Refresh staging and development with working data

Import archives into another environment when teams need realistic copies for testing, review, or onboarding.

Upload archives to cloud storage

Send backup archives to external storage providers instead of keeping them only inside the platform.

Runtime wiring

Reuse connectivity, storage, and runtime defaults

This service can expose ports, connect to other services, attach persistent storage, and define runtime defaults that become reusable inside stacks rather than being rebuilt case by case.

Endpoints

5432/TCP

Volumes

Data

Configs

2 configs can be versioned with the service.

Database workflows

Explore the database-specific view for this service family

Database services also have a dedicated database page that focuses on deployment, managed database alternatives, backups, and other database-specific workflows.