Skip to content

Commit 5eaaefd

Browse files
authored
Adding dashboard instructions for PostgreSQL db examples (#24483)
1 parent 543f874 commit 5eaaefd

File tree

2 files changed

+45
-22
lines changed

2 files changed

+45
-22
lines changed

src/content/docs/hyperdrive/examples/connect-to-postgres/postgres-database-providers/digital-ocean.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar:
88
description: Connect Hyperdrive to a Digital Ocean Postgres database instance.
99
---
1010

11-
import { Render } from "~/components";
11+
import { Render, Steps } from "~/components";
1212

1313
This example shows you how to connect Hyperdrive to a Digital Ocean database instance.
1414

@@ -18,11 +18,13 @@ To allow Hyperdrive to connect to your database, you will need to ensure that Hy
1818

1919
### DigitalOcean Dashboard
2020

21+
<Steps>
2122
1. Go to the DigitalOcean dashboard and select the database you wish to connect to.
2223
2. Go to the **Overview** tab.
2324
3. Under the **Connection Details** panel, select **Public network**.
2425
4. On the dropdown menu, select **Connection string** > **show-password**.
2526
5. Copy the connection string.
27+
</Steps>
2628

2729
With the connection string, you can now create a Hyperdrive database configuration.
2830

src/content/partials/hyperdrive/create-hyperdrive-config.mdx

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{}
33
---
44

5-
import { WranglerConfig, Render } from "~/components";
5+
import { WranglerConfig, Render, Tabs, TabItem, Steps } from "~/components";
66

77
To configure Hyperdrive, you will need:
88

@@ -19,35 +19,56 @@ postgres://USERNAME:PASSWORD@HOSTNAME_OR_IP_ADDRESS:PORT/database_name
1919

2020
Most database providers will provide a connection string you can directly copy-and-paste directly into Hyperdrive.
2121

22-
To create a Hyperdrive configuration with the [Wrangler CLI](/workers/wrangler/install-and-update/), open your terminal and run the following command. Replace \<NAME_OF_HYPERDRIVE_CONFIG> with a name for your Hyperdrive configuration and paste the connection string provided from your database host, or replace `user`, `password`, `HOSTNAME_OR_IP_ADDRESS`, `port`, and `database_name` placeholders with those specific to your database:
22+
<Tabs>
2323

24-
```sh
25-
npx wrangler hyperdrive create <NAME_OF_HYPERDRIVE_CONFIG> --connection-string="postgres://user:password@HOSTNAME_OR_IP_ADDRESS:PORT/database_name"
26-
```
24+
<TabItem label="Dashboard">
2725

28-
:::note
26+
To create a Hyperdrive configuration with the Cloudflare dashboard:
2927

30-
Hyperdrive will attempt to connect to your database with the provided credentials to verify they are correct before creating a configuration. If you encounter an error when attempting to connect, refer to Hyperdrive's [troubleshooting documentation](/hyperdrive/observability/troubleshooting/) to debug possible causes.
28+
<Steps>
29+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login).
30+
2. Go to **Storage & Databases** > **Hyperdrive**.
31+
3. Select **Create Configuration**.
32+
4. Fill out the form, including the connection string.
33+
5. Select **Create**.
34+
</Steps>
3135

32-
:::
36+
</TabItem>
37+
<TabItem label="Wrangler CLI">
3338

34-
This command outputs a binding for the [Wrangler configuration file](/workers/wrangler/configuration/):
39+
To create a Hyperdrive configuration with the [Wrangler CLI](/workers/wrangler/install-and-update/):
40+
<Steps>
41+
1. Open your terminal and run the following command. Replace `<NAME_OF_HYPERDRIVE_CONFIG>` with a name for your Hyperdrive configuration and paste the connection string provided from your database host, or replace `user`, `password`, `HOSTNAME_OR_IP_ADDRESS`, `port`, and `database_name` placeholders with those specific to your database:
3542

36-
<WranglerConfig>
43+
```sh
44+
npx wrangler hyperdrive create <NAME_OF_HYPERDRIVE_CONFIG> --connection-string="postgres://user:password@HOSTNAME_OR_IP_ADDRESS:PORT/database_name"
45+
```
3746

38-
```toml
39-
name = "hyperdrive-example"
40-
main = "src/index.ts"
41-
compatibility_date = "2024-08-21"
42-
compatibility_flags = ["nodejs_compat"]
47+
2. This command outputs a binding for the [Wrangler configuration file](/workers/wrangler/configuration/):
4348

44-
# Pasted from the output of `wrangler hyperdrive create <NAME_OF_HYPERDRIVE_CONFIG> --connection-string=[...]` above.
45-
[[hyperdrive]]
46-
binding = "HYPERDRIVE"
47-
id = "<ID OF THE CREATED HYPERDRIVE CONFIGURATION>"
48-
```
49+
<WranglerConfig>
50+
51+
```toml
52+
name = "hyperdrive-example"
53+
main = "src/index.ts"
54+
compatibility_date = "2024-08-21"
55+
compatibility_flags = ["nodejs_compat"]
4956

50-
</WranglerConfig>
57+
# Pasted from the output of `wrangler hyperdrive create <NAME_OF_HYPERDRIVE_CONFIG> --connection-string=[...]` above.
58+
[[hyperdrive]]
59+
binding = "HYPERDRIVE"
60+
id = "<ID OF THE CREATED HYPERDRIVE CONFIGURATION>"
61+
```
62+
63+
</WranglerConfig>
64+
</Steps>
65+
</TabItem>
66+
67+
</Tabs>
68+
69+
:::note
70+
Hyperdrive will attempt to connect to your database with the provided credentials to verify they are correct before creating a configuration. If you encounter an error when attempting to connect, refer to Hyperdrive's [troubleshooting documentation](/hyperdrive/observability/troubleshooting/) to debug possible causes.
71+
:::
5172

5273
## 3. Use Hyperdrive from your Worker
5374

0 commit comments

Comments
 (0)