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 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
10 changes: 10 additions & 0 deletions resources/shuttle-aws-rds.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ async fn tide(#[shuttle_aws_rds::Postgres(
)] pool: PgPool) -> ShuttleTide<MyState> { ... }
```

The URI should be formatted according to the
[Postgres](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING) or
[MySql and MariaDB](https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri)
documentation, depending on which one you're using.

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