Skip to content

Running PostgREST locally

Brian Peiris edited this page Jul 8, 2021 · 2 revisions

Postgrest is required to use some of the features of the Hubs admin console. Use these instructions to setup a local postgrest server against your existing local reticulum server.

  1. Install PostgREST (https://github.com/PostgREST/postgrest/releases)
  2. Create a jwk in an iex session on your local reticulum,
jwk = Application.get_env(:ret, Ret.PermsToken)[:perms_key] |> JOSE.JWK.from_pem(); JOSE.JWK.to_file("/path/to/reticulum/reticulum-jwk.json", jwk)

or copy it from the hubs-ops repo:

cp <hubs-ops-repo-path>/ansible/roles/postgrest/files/jwk.json.local <reticulum-repo>/reticulum-jwk.json
  1. Create a PostgREST config file (reticulum.conf):
# reticulum.conf
db-uri = "postgres://postgres:postgres@localhost:5432/ret_dev"
db-schema = "ret0_admin"
db-anon-role = "postgres_anonymous"
jwt-secret = "@reticulum-jwk.json"
jwt-aud = "ret_perms"
role-claim-key = ".postgrest_role"
  1. Run PostgREST with the config file.
postgrest reticulum.conf

Your local reticulum server should now proxy PostgREST requests from the admin console to this PostgREST server.

Clone this wiki locally