Skip to content

Commit

Permalink
docs(examples): add suggested postgres setup
Browse files Browse the repository at this point in the history
Signed-off-by: Vaughn Dice <vaughn.dice@fermyon.com>
  • Loading branch information
vdice committed Dec 11, 2024
1 parent 217798e commit 24aab25
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion examples/postgres-v3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@

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

## Prerequisite: Postgres

This example assumes postgres is running and accessible locally via its standard 5432 port.

We suggest running the `postgres` Docker container which has the necessary postgres user permissions
already configured. For example:

```
docker run --rm -h 127.0.0.1 -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres
```

## Spin up

From example root:
Then, run the following from the root of this example:

```
export PGUSER=postgres PGHOST=localhost
createdb spin_dev
psql -d spin_dev -f db/testdata.sql
RUST_LOG=spin=trace spin build --up
Expand Down
14 changes: 13 additions & 1 deletion examples/postgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@

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

## Prerequisite: Postgres

This example assumes postgres is running and accessible locally via its standard 5432 port.

We suggest running the `postgres` Docker container which has the necessary postgres user permissions
already configured. For example:

```
docker run --rm -h 127.0.0.1 -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres
```

## Spin up

From example root:
Then, run the following from the root of this example:

```
export PGUSER=postgres PGHOST=localhost
createdb spin_dev
psql -d spin_dev -f db/testdata.sql
RUST_LOG=spin=trace spin build --up
Expand Down

0 comments on commit 24aab25

Please sign in to comment.