Skip to content

Commit

Permalink
Merge branch 'main' into jharrell/guides-sidenav
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur-arch authored Feb 13, 2025
2 parents 813936d + dd1045c commit ccc260e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions content/250-postgres/600-tcp-tunnel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ password: <none>

This will start the tunnel on a randomly assigned TCP port. The proxy automatically handles authentication, so any database credentials are accepted. The tunnel also encrypts traffic, meaning clients should be set to not require SSL.

You can now connet to your Prisma Postgres editor using your favorite PostgreSQL client, e.g. `psql` or a GUI like [TablePlus](/postgres/tooling#2-connect-to-prisma-postgres-using-tableplus). To do so, you only need to provide the **`host`** and **`port`** from the output above. The TCP tunnel will handle authentication via the API key in your Prisma Postgres connection URL, so you can omit the values for **`username`** and **`password`**.
You can now connet to your Prisma Postgres editor using your favorite PostgreSQL client, e.g. `psql` or a GUI like [TablePlus](/postgres/tooling#2a-connect-to-prisma-postgres-using-tableplus) or [DataGrip](/postgres/tooling#2b-connect-to-prisma-postgres-using-datagrip). To do so, you only need to provide the **`host`** and **`port`** from the output above. The TCP tunnel will handle authentication via the API key in your Prisma Postgres connection URL, so you can omit the values for **`username`** and **`password`**.


### Customizing host and port
Expand All @@ -106,7 +106,7 @@ npx @prisma/ppg-tunnel --host 127.0.0.1 --port 5432

## Next steps

The local tunnel enables you to access Prisma Postgres from 3rd party database editors such as Postico, TablePlus and pgAdmin. Learn more in this [section](/postgres/tooling#2-connect-to-prisma-postgres-using-tableplus).
The local tunnel enables you to access Prisma Postgres from 3rd party database editors such as Postico, DataGrip, TablePlus and pgAdmin. Learn more in this [section](/postgres/tooling).

## Security considerations

Expand Down
21 changes: 19 additions & 2 deletions content/250-postgres/700-tooling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Copy the **`port`** from the output above, you will need it in the next step.

Keep this tunnel process running while you are using the database editor to maintain the connection.

### 2. Connect to Prisma Postgres using TablePlus
### 2a. Connect to Prisma Postgres using TablePlus

Based on the database editor you are using, you can connect to your Prisma Postgres instance using the details you obtained from the output of the `@prisma/ppg-tunnel` package. To add the connection string in TablePlus:

Expand All @@ -103,4 +103,21 @@ Based on the database editor you are using, you can connect to your Prisma Postg
- **Password**: This will be ignored due to the tunnel, you can provide any value here.
4. Click on **Connect** to connect to your Prisma Postgres instance.

![View of TablePlus connected to Prisma Postgres via tunnel](/img/ppg-tableplus.png)
![View of TablePlus connected to Prisma Postgres via tunnel](/img/ppg-tableplus.png)

### 2b. Connect to Prisma Postgres using DataGrip

Based on the database editor you are using, you can connect to your Prisma Postgres instance using the details you obtained from the output of the `@prisma/ppg-tunnel` package. To add the connection string in DataGrip:

1. Open DataGrip and click on the **+** icon and select "Datasource".
2. Select **PostgreSQL** as the database type.
3. Enter the following details:
- **Name**: Any name you want to give to your connection.
- **Host**: `127.0.0.1` in this case.
- **Port**: The **`port`** number you obtained from the output of the `@prisma/ppg-tunnel` package.
- **User**: This will be ignored due to the tunnel, you can keep this field empty.
- **Password**: This will be ignored due to the tunnel, you can keep this field empty.
- **URL**: In the URL append the following query parameter `?sslmode=disable` to the end of the URL.
4. Click on **Test Connection** to ensure that DataGrip can connect to your Prisma Postgres instance. Once successful, click **OK** to save the connection.

![View of DataGrip connected to Prisma Postgres via tunnel](/img/ppg-datagrip.png)
1 change: 1 addition & 0 deletions static/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@
/getting-started/setup-prisma/start-from-scratch/mongodb/next-steps-* /docs/getting-started/setup-prisma/start-from-scratch/mongodb/next-steps
/getting-started/setup-prisma/add-to-existing-project/relational-databases/next-steps-* /docs/getting-started/setup-prisma/add-to-existing-project/relational-databases/next-steps
/getting-started/setup-prisma/add-to-existing-project/mongodb/next-steps-* /docs/getting-started/setup-prisma/add-to-existing-project/mongodb/next-steps
/getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-prismaPostgres /docs/getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-postgresql

###
/orm/overview/databases/prisma-postgres /docs/postgres
Binary file added static/img/ppg-datagrip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ccc260e

Please sign in to comment.