aulneau / postgrest

Postgrest on Render

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Postgrest on Render

Deploy

Deploy to Render

Click this button to deploy Postgrest to Render's free web service and database plans.

Example Configuration

The following steps are derived from Step 4 of the Postgrest's Tutorial 0

  1. Grab the external connection string for the database you just created on Render.

  2. Locally, run psql <connectionstring>, where <connectionstring> is the connection string from the previous step.

  3. Create an example table:

    create table todos (
      id serial primary key,
      done boolean not null default false,
      task text not null,
      due timestamptz
    );
  4. Insert some rows into the table:

    insert into todos (task) values
      ('finish tutorial 0'), ('pat self on back');
  5. Exit psql with \q

  6. Open the URL of the Postgrest web service you just deployed. It is on the top of the Render dashboard page for the service. You should see the OpenAPI documentation for your new API.

  7. Now add /todos to the end of the URL to use the API endpoint that was automatically created from the todos table. It should return the two rows of data you added to the table.

Caveats

  • This deploy makes the PostgreSQL database accessible to the public internet. This can be changed by updating the ipAllowList in the repo's render.yaml or by making similar changes in the Render Dashboard. Deleting all access control rules will make the database accessible only from other services in your Render account, including the Postgrest web service you just deployed.
  • This deploy also uses the PostgreSQL admin user for all database queries. The Postgrest project recommends creating a new named schema and role for database objects which will be exposed in the API. See Step 4. Create Database for API for an example of how to do this. Review Postgrest's documentation on auth to understand how it manages authentication and authorization.

About

Postgrest on Render


Languages

Language:Dockerfile 100.0%