Skip to content

Commit 65e4527

Browse files
Oxyjunthomasgauvin
authored andcommitted
[Hyperdrive] Improving Hyperdrive <> Tunnel tutorial to use steps and details components (#24126)
* Improving page to use steps and details components * Removing toggling on default to make both options more visible
1 parent be1341f commit 65e4527

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

src/content/docs/hyperdrive/configuration/connect-to-private-database.mdx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar:
77
text: Beta
88
---
99

10-
import { TabItem, Tabs, Render } from "~/components";
10+
import { TabItem, Tabs, Render, Steps, Details } from "~/components";
1111

1212
Hyperdrive can securely connect to your private databases using [Cloudflare Tunnel](/cloudflare-one/connections/connect-networks/) and [Cloudflare Access](/cloudflare-one/policies/access/).
1313

@@ -48,11 +48,13 @@ First, create a [Cloudflare Tunnel](/cloudflare-one/connections/connect-networks
4848

4949
Your tunnel must be configured to use a public hostname so that Hyperdrive can route requests to it. If you don't have a hostname on Cloudflare yet, you will need to [register a new hostname](/registrar/get-started/register-domain/) or [add a zone](/dns/zone-setups/) to Cloudflare to proceed.
5050

51+
<Steps>
5152
1. In the **Public Hostnames** tab, choose a **Domain** and specify any subdomain or path information. This will be used in your Hyperdrive configuration to route to this tunnel.
5253

5354
2. In the **Service** section, specify **Type** `TCP` and the URL and configured port of your database, such as `localhost:5432` or `my-database-host.database-provider.com:5432`. This address will be used by the tunnel to route requests to your database.
5455

5556
3. Select **Save tunnel**.
57+
</Steps>
5658

5759
:::note
5860
If you are setting up the tunnel through the CLI instead ([locally-managed tunnel](/cloudflare-one/connections/connect-networks/do-more-with-tunnels/local-management/)), you will have to complete these steps manually. Follow the Cloudflare Zero Trust documentation to [add a public hostname to your tunnel](/cloudflare-one/connections/connect-networks/routing-to-tunnel/dns/) and [configure the public hostname to route to the address of your database](/cloudflare-one/connections/connect-networks/do-more-with-tunnels/local-management/configuration-file/).
@@ -64,26 +66,29 @@ To restrict access to the Cloudflare Tunnel to Hyperdrive, a [Cloudflare Access
6466

6567
The Cloudflare dashboard can automatically create and configure the underlying [Cloudflare Access application](/cloudflare-one/applications/), [Service Auth token](/cloudflare-one/policies/access/#service-auth), and [Policy](/cloudflare-one/policies/) on your behalf. Alternatively, you can manually create the Access application and configure the Policies.
6668

67-
<Tabs> <TabItem label="Automatic creation">
69+
<Details header="Automatic creation">
6870

69-
### 2.1 Create a Hyperdrive configuration in the Cloudflare dashboard
71+
### 2.1. (Automatic) Create a Hyperdrive configuration in the Cloudflare dashboard
7072

7173
Create a Hyperdrive configuration in the Cloudflare dashboard to automatically configure Hyperdrive to connect to your Cloudflare Tunnel.
7274

75+
<Steps>
7376
1. In the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/workers/hyperdrive), navigate to **Storage & Databases > Hyperdrive** and click **Create configuration**.
7477
2. Select **Private database**.
7578
3. In the **Networking details** section, select the tunnel you are connecting to.
7679
4. In the **Networking details** section, select the hostname associated to the tunnel. If there is no hostname for your database, return to step [1.2. Connect your database using a public hostname](/hyperdrive/configuration/connect-to-private-database/#12-connect-your-database-using-a-public-hostname).
7780
5. In the **Access Service Authentication Token** section, select **Create new (automatic)**.
7881
6. In the **Access Application** section, select **Create new (automatic)**.
7982
7. In the **Database connection details** section, enter the database **name**, **user**, and **password**.
83+
</Steps>
84+
</Details>
8085

81-
</TabItem>
82-
<TabItem label="Manual creation">
83-
### 2.1 Create a service token
86+
<Details header="Manual creation">
87+
### 2.1. (Manual) Create a service token
8488

8589
The service token will be used to restrict requests to the tunnel, and is needed for the next step.
8690

91+
<Steps>
8792
1. In [Zero Trust](https://one.dash.cloudflare.com), go to **Access** > **Service auth** > **Service Tokens**.
8893

8994
2. Select **Create Service Token**.
@@ -99,11 +104,13 @@ The service token will be used to restrict requests to the tunnel, and is needed
99104
:::caution
100105
This is the only time Cloudflare Access will display the Client Secret. If you lose the Client Secret, you must regenerate the service token.
101106
:::
107+
</Steps>
102108

103-
### 2.2 Create an Access application to secure the tunnel
109+
### 2.2. (Manual) Create an Access application to secure the tunnel
104110

105111
[Cloudflare Access](/cloudflare-one/policies/access/) will be used to verify that requests to the tunnel originate from Hyperdrive using the service token created above.
106112

113+
<Steps>
107114
1. In [Zero Trust](https://one.dash.cloudflare.com), go to **Access** > **Applications**.
108115

109116
2. Select **Add an application**.
@@ -137,8 +144,9 @@ The service token will be used to restrict requests to the tunnel, and is needed
137144
16. Select **Next**.
138145

139146
17. Save the application.
147+
</Steps>
140148

141-
### 2.3 Create a Hyperdrive configuration
149+
### 2.3. (Manual) Create a Hyperdrive configuration
142150

143151
To create a Hyperdrive configuration for your private database, you'll need to specify the Access application and Cloudflare Tunnel information upon creation.
144152

@@ -180,17 +188,17 @@ In addition, it will also set the Access Client ID and the Access Client Secret
180188
When creating the Hyperdrive configuration for the private database, you must enter the `access-client-id` and the `access-client-id`, and omit the `port`. Hyperdrive will route database messages to the public hostname of the tunnel, and the tunnel will rely on its service configuration (as configured in [1.2. Connect your database using a public hostname](#12-connect-your-database-using-a-public-hostname)) to route requests to the database within your private network.
181189
:::
182190

183-
</TabItem> </Tabs>
191+
</Details>
184192

185193
## 3. Query your Hyperdrive configuration from a Worker (optional)
186194

187195
To test your Hyperdrive configuration to the database using Cloudflare Tunnel and Access, use the Hyperdrive configuration ID in your Worker and deploy it.
188196

189-
### Create a Hyperdrive binding
197+
### 3.1. Create a Hyperdrive binding
190198

191199
<Render file="create-hyperdrive-binding" product="hyperdrive" />
192200

193-
### Query your database
201+
### 3.2. Query your database
194202

195203
Validate that you can connect to your database from Workers and make queries.
196204

src/content/partials/cloudflare-one/tunnel/create-tunnel.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
---
55

6+
import { Steps } from "~/components";
7+
8+
<Steps>
69
1. Log in to [Zero Trust](https://one.dash.cloudflare.com) and go to **Networks** > **Tunnels**.
710

811
2. Select **Create a tunnel**.
@@ -20,3 +23,4 @@
2023
![Connector appearing in the UI after cloudflared has run](~/assets/images/cloudflare-one/connections/connect-apps/connector.png)
2124

2225
8. Select **Next**.
26+
</Steps>

0 commit comments

Comments
 (0)