Skip to content

Add docker-compose setup for local development #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Status: **Unstable**
- PostgreSQL >= 12
- PostgREST >= 7

### Local Postgrest Server
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
```

### Instructions

#### With Poetry (recommended)
Expand Down
28 changes: 28 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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 directory
# volumes:
# - "./pgdata:/var/lib/postgresql/data"
# - "./init.sql:/docker-entrypoint-initdb.d/init.sql"