Skip to content

Commit 7ad28cc

Browse files
Add docs for --tunnel (#2736)
Co-authored-by: Jo Franchetti <jofranchetti@gmail.com>
1 parent 6c612a6 commit 7ad28cc

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

deploy/reference/tunnel.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: Tunnel
3+
description: "Learn about Deno Deploy's local tunnel feature, which allows secure access to your local development server from the internet."
4+
---
5+
6+
Deno Deploy's tunnel feature allows you to securely expose your local
7+
development server to the internet. This is particularly useful for testing
8+
webhooks, sharing your work with collaborators, or accessing your local server
9+
from remote locations.
10+
11+
In addition to providing secure access to your local server, Deno Deploy's
12+
tunnel can also:
13+
14+
- Pull environment variables in the "Local" context from your Deno Deploy
15+
project to your local Deno process.
16+
- Push Open Telemetry traces, metrics, and logs from your local Deno process to
17+
your Deno Deploy app, where you can view them in the Deno Deploy dashboard.
18+
- Automatically connect to local development databases assigned to your Deno
19+
Deploy app.
20+
21+
## Getting started
22+
23+
To start using the tunnel feature, you'll need to have Deno installed on your
24+
local machine. You can then pass the `--tunnel` flag when running your Deno
25+
application locally, either with `deno task` or `deno run`. For example:
26+
27+
```sh
28+
deno run --tunnel -A main.ts
29+
```
30+
31+
The first time you run this command, you'll be prompted to authenticate with
32+
Deno Deploy and choose which Deno Deploy app you want to connect the tunnel to.
33+
Once authenticated, a secure tunnel will be established, and you'll receive a
34+
public URL that forwards traffic to your local server.
35+
36+
You can also specify `--tunnel` for `deno task` commands defined in your
37+
`deno.json` or `package.json` file:
38+
39+
```json
40+
{
41+
"tasks": {
42+
"dev": "astro dev"
43+
}
44+
}
45+
```
46+
47+
Then run the task with:
48+
49+
```bash
50+
deno task --tunnel dev
51+
```
52+
53+
## Using the tunnel
54+
55+
Once the tunnel is established, any requests made to the public URL will be
56+
forwarded to your local development server. You can use this URL to test
57+
webhooks, share your work with others, or access your local server from remote
58+
locations.
59+
60+
## Stopping the tunnel
61+
62+
To stop the tunnel, simply terminate the Deno process running your application.
63+
This will close the secure connection and stop forwarding traffic to your local
64+
server.
65+
66+
## View open tunnels
67+
68+
The "Tunnels" tab of your application dashboard on Deno Deploy shows all active
69+
tunnels connected to your application. From this tab, you can view details about
70+
each tunnel, including the public URL, the local address it's forwarding to, and
71+
the time it was established.
72+
73+
## Environment variables
74+
75+
When using the tunnel feature, the "Local" context environment variables from
76+
your Deno Deploy application are made available to your local Deno process. This
77+
allows you to use the same configuration locally as you do in your Deno Deploy
78+
application.
79+
80+
You can view and manage the environment variables for your Deno Deploy
81+
application in the "Environment Variables" tab of your application settings. See
82+
[the docs on adding, editing, and removing environment variables](/deploy/reference/env_vars_and_contexts/#adding%2C-editing-and-removing-environment-variables)
83+
for more information.
84+
85+
## Viewing traces and logs
86+
87+
When using the tunnel feature, Open Telemetry traces, metrics, and logs from
88+
your local Deno process are pushed to your Deno Deploy application. You can view
89+
these traces and logs in the "Observability" tab of your application dashboard
90+
on Deno Deploy.
91+
92+
You can filter to see only traces and logs from your local process by searching
93+
for `context:local` in the search bar.

0 commit comments

Comments
 (0)