Skip to content
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

Add detail to postgres/docker AWS RDS setup #115

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Changes from 1 commit
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
20 changes: 20 additions & 0 deletions resources/shuttle-aws-rds.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ async fn tide(#[shuttle_aws_rds::Postgres(
)] pool: PgPool) -> ShuttleTide<MyState> { ... }
```

The URI should be formatted according to the
[postgres documentation](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING),
beyarkay marked this conversation as resolved.
Show resolved Hide resolved
for example:

```
postgresql://
postgresql://localhost
postgresql://localhost:5432
postgresql://localhost/mydb
postgresql://user@localhost
postgresql://user:secret@localhost
postgresql://other@localhost/otherdb?connect_timeout=10&application_name=myapp
postgresql://localhost/mydb?user=other&password=secret
```
beyarkay marked this conversation as resolved.
Show resolved Hide resolved

If you do not specify a `local_uri`, then shuttle will attempt to spin up a docker instance and launch the database inside of it.
For this to succeed, you must have docker installed and you must also have started the docker engine. If you have not used docker
before, the easiest way is to [install the desktop app](https://docs.docker.com/get-docker/) and then launch it in order to start
the docker engine.

## Example
This snippet shows the main function of a tide app that uses the `shuttle_aws_rds::Postgres` attribute to provision an RDS Postgres database.
It gives you an authenticated [sqlx Pool](https://docs.rs/sqlx/latest/sqlx/pool/index.html), which you can use to interact with the database.
Expand Down