Skip to content

Hosted PostgreSQL

Some providers of PostgreSQL databases require additional configuration to work with Martin. We try to provide a guide for each provider, but we may not cover all of them.

Using with DigitalOcean PostgreSQL

You can use Martin with Managed PostgreSQL from DigitalOcean with PostGIS extension

First, you need to download the CA certificate and get your cluster connection string from the dashboard. After that, you can use the connection string and the CA certificate to connect to the database

martin --ca-root-file ./ca-certificate.crt \
       postgres://user:password@host:port/db?sslmode=require

Using with Heroku PostgreSQL

You can use Martin with Managed PostgreSQL from Heroku with the PostGIS extension

heroku pg:psql -a APP_NAME -c 'create extension postgis'

Set the environment variables Heroku suggests for psql and pass them to Martin on the command line.

export DATABASE_URL=$(heroku config:get DATABASE_URL -a APP_NAME)
export PGSSLCERT=DIRECTORY/PREFIXpostgresql.crt
export PGSSLKEY=DIRECTORY/PREFIXpostgresql.key
export PGSSLROOTCERT=DIRECTORY/PREFIXroot.crt

martin --ssl-cert "$PGSSLCERT" --ssl-key "$PGSSLKEY" --ca-root-file "$PGSSLROOTCERT" "$DATABASE_URL"

You may also be able to validate SSL certificate with an explicit sslmode, e.g.

export DATABASE_URL="$(heroku config:get DATABASE_URL -a APP_NAME)?sslmode=verify-ca"