From c145e375cb17f128073bd2d0e648d5f44cf7d012 Mon Sep 17 00:00:00 2001 From: DSK Date: Tue, 14 Sep 2021 21:24:57 +0530 Subject: [PATCH 1/2] added docker-compose setup for local development --- README.md | 6 ++++++ docker-compose.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 docker-compose.yaml diff --git a/README.md b/README.md index 45ed661e..39662cc6 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,12 @@ Status: **Unstable** - PostgreSQL >= 12 - PostgREST >= 7 +### Local Postgrest Server +If you want to use local postgrest server use docker-compose to start one. +```sh +docker-compose up +``` + ### Instructions #### With Poetry (recommended) diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..6d3bd78d --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,26 @@ +version: '3' +services: + server: + image: postgrest/postgrest + ports: + - "3000:3000" + environment: + PGRST_DB_URI: postgres://app_user:password@db:5432/app_db + PGRST_DB_SCHEMA: public + PGRST_DB_ANON_ROLE: app_user #In production this role should not be the same as the one used for the connection + PGRST_OPENAPI_SERVER_PROXY_URI: "http://127.0.0.1:3000" + depends_on: + - db + db: + image: postgres + ports: + - "5432:5432" + environment: + POSTGRES_DB: app_db + POSTGRES_USER: app_user + POSTGRES_PASSWORD: password +# Uncomment this if you want to persist the data. +# create your boostrap sql file in root direct +# volumes: +# - "./pgdata:/var/lib/postgresql/data" + From 71e1e3cab2017981abd43dce7077c8bb5c0ae5f6 Mon Sep 17 00:00:00 2001 From: DSK Date: Tue, 14 Sep 2021 21:28:03 +0530 Subject: [PATCH 2/2] updated docker-compose setup instructions --- README.md | 2 +- docker-compose.yaml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 39662cc6..fe3ebe28 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Status: **Unstable** - PostgREST >= 7 ### Local Postgrest Server -If you want to use local postgrest server use docker-compose to start one. +If you want to use local postgrest server for development use docker-compose to start local server. Once docker-compose process started, postgrest is accessible at http://localhost:3000 ```sh docker-compose up ``` diff --git a/docker-compose.yaml b/docker-compose.yaml index 6d3bd78d..c07dd9ea 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -20,7 +20,9 @@ services: POSTGRES_USER: app_user POSTGRES_PASSWORD: password # Uncomment this if you want to persist the data. -# create your boostrap sql file in root direct +# create your boostrap sql file in root directory # volumes: # - "./pgdata:/var/lib/postgresql/data" +# - "./init.sql:/docker-entrypoint-initdb.d/init.sql" +