Skip to content

Commit 1cb42a1

Browse files
authored
Add docker-compose setup for local development (#22)
1 parent 3632d75 commit 1cb42a1

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Status: **Unstable**
1616
- PostgreSQL >= 12
1717
- PostgREST >= 7
1818

19+
### Local Postgrest Server
20+
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
21+
```sh
22+
docker-compose up
23+
```
24+
1925
### Instructions
2026

2127
#### With Poetry (recommended)

docker-compose.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '3'
2+
services:
3+
server:
4+
image: postgrest/postgrest
5+
ports:
6+
- "3000:3000"
7+
environment:
8+
PGRST_DB_URI: postgres://app_user:password@db:5432/app_db
9+
PGRST_DB_SCHEMA: public
10+
PGRST_DB_ANON_ROLE: app_user #In production this role should not be the same as the one used for the connection
11+
PGRST_OPENAPI_SERVER_PROXY_URI: "http://127.0.0.1:3000"
12+
depends_on:
13+
- db
14+
db:
15+
image: postgres
16+
ports:
17+
- "5432:5432"
18+
environment:
19+
POSTGRES_DB: app_db
20+
POSTGRES_USER: app_user
21+
POSTGRES_PASSWORD: password
22+
# Uncomment this if you want to persist the data.
23+
# create your boostrap sql file in root directory
24+
# volumes:
25+
# - "./pgdata:/var/lib/postgresql/data"
26+
# - "./init.sql:/docker-entrypoint-initdb.d/init.sql"
27+
28+

0 commit comments

Comments
 (0)