PostGIS

Definition

A PostGIS Resource is defined in convox.yml and linked to one or more Services. PostGIS extends PostgreSQL with spatial and geographic data types, functions, and indexes.

resources:
  geodatabase:
    type: postgis
services:
  web:
    resources:
      - geodatabase

Containerized Options

Convox runs PostGIS as a container inside your Rack using the postgis/postgis Docker image. PostGIS is containerized-only. There is no managed RDS equivalent.

For AWS RDS managed PostGIS, use the rds-postgres resource type with PostGIS extensions enabled at the RDS level. See the PostgreSQL resource documentation for RDS configuration options.

resources:
  geodatabase:
    type: postgis
    options:
      version: "16-3.6"
      storage: 20
Attribute Type Default Description
version string 16-3.6 The PostGIS image tag (format: postgres_version-postgis_version). The default applies when the Resource is created
storage int 10 The amount of persistent storage (in GB)
cpu int CPU request and limit for the container, in millicores
mem int Memory request and limit for the container, in MiB

On Rack version 3.26.0 or later, a new Resource without version runs 16-3.6. An existing Resource keeps the version it runs, which is 10-3.2 for a Resource created with the earlier default. See Containerized Versions to move to a newer version.

  • postgis/postgis publishes no arm64 image. On a Rack whose workload nodes can be arm64, the Resource can stay Pending with an image pull error (no match for platform in manifest).
  • postgis/postgis publishes no tag that pins the Debian base, so a later upstream base change under 16-3.6 can make an existing database log collation version mismatch. REINDEX and ALTER DATABASE ... REFRESH COLLATION VERSION clear it.
  • New Resources use scram-sha-256 password authentication, where 10-3.2 used md5. Client libraries too old to support SCRAM cannot connect.
  • A Postgres major version above 16 runs, but convox resources export cannot dump it: the Rack runs pg_dump 16, which refuses a newer server. convox resources console and convox resources import still work.

Command Line Interface

Listing Resources

$ convox resources -a myapp
NAME         TYPE     URL
geodatabase  postgis  postgres://username:password@host.name:port/geodatabase

Getting Information about a Resource

$ convox resources info geodatabase -a myapp
Name  geodatabase
Type  postgis
URL   postgres://username:password@host.name:port/geodatabase

Getting the URL for a Resource

$ convox resources url geodatabase -a myapp
postgres://username:password@host.name:port/geodatabase

Launching a Console

$ convox resources console geodatabase -a myapp
psql (16.2, server 16.2 (Debian 16.2-1+b1))
Type "help" for help.
geodatabase=#

Starting a Proxy to a Resource

$ convox resources proxy geodatabase -a myapp
Proxying localhost:5432 to host.name:port

Proxying allows you to connect tools on your local machine to Resources running inside the Rack.

Exporting Data from a Resource

$ convox resources export geodatabase -f /tmp/db.sql
Exporting resource data... OK

Importing Data to a Resource

$ convox resources import geodatabase -f /tmp/db.sql
Importing resource data... OK