Skip to content

Commit 24aab25

Browse files
committed
docs(examples): add suggested postgres setup
Signed-off-by: Vaughn Dice <[email protected]>
1 parent 217798e commit 24aab25

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

examples/postgres-v3/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22

33
This example shows how to access a PostgreSQL database from Spin component.
44

5+
## Prerequisite: Postgres
6+
7+
This example assumes postgres is running and accessible locally via its standard 5432 port.
8+
9+
We suggest running the `postgres` Docker container which has the necessary postgres user permissions
10+
already configured. For example:
11+
12+
```
13+
docker run --rm -h 127.0.0.1 -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres
14+
```
15+
516
## Spin up
617

7-
From example root:
18+
Then, run the following from the root of this example:
819

920
```
21+
export PGUSER=postgres PGHOST=localhost
1022
createdb spin_dev
1123
psql -d spin_dev -f db/testdata.sql
1224
RUST_LOG=spin=trace spin build --up

examples/postgres/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22

33
This example shows how to access a PostgreSQL database from Spin component.
44

5+
## Prerequisite: Postgres
6+
7+
This example assumes postgres is running and accessible locally via its standard 5432 port.
8+
9+
We suggest running the `postgres` Docker container which has the necessary postgres user permissions
10+
already configured. For example:
11+
12+
```
13+
docker run --rm -h 127.0.0.1 -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres
14+
```
15+
516
## Spin up
617

7-
From example root:
18+
Then, run the following from the root of this example:
819

920
```
21+
export PGUSER=postgres PGHOST=localhost
1022
createdb spin_dev
1123
psql -d spin_dev -f db/testdata.sql
1224
RUST_LOG=spin=trace spin build --up

0 commit comments

Comments
 (0)