PostgREST Quickstart

This quickstart guide will help you get PostgREST up and running with Container Apps on Crunchy Bridge. We recommend you start with the Container Apps Quickstart to get a general understanding of Container Apps.

About PostgREST

From the project:

PostgREST is a standalone web server that turns your PostgreSQL database directly into a RESTful API. The structural constraints and permissions in the database determine the API endpoints and operations.

PostgREST with Postgres Container Apps Quickstart

First, make sure you have Container Apps enabled. As a user with superuser privileges, run CREATE EXTENSION pgpodman; to install the extension in the postgres database of the desired cluster.

Next, find your cluster's database URL to include as the DATABASE_URL parameter when you run the container. You can find the URL in the Connection section of the cluster dashboard (choose the application role), or by running cb uri --role application <cluster name> on the command line.

To start your PostgREST, run the following using your own value for PGRST_DB_URI:

SELECT run_container('-dt -p 5433:3000/tcp -e PGRST_DB_URI="your-host-URL" -e PGRST_DB_SCHEMA="public" -e PGRST_DB_ANON_ROLE="postgres" postgrest/postgrest');

Now you can visit your running PostgREST at your-host-URL:5433. You can find your Host URL in the Overview section of your cluster dashboard, or by running cb info <cluster name>.