main
md 140 lines 3.54 KB
Rendered Raw
1 ---
2 title: Getting Started
3 description: Install Portal and expose your first local service to the internet.
4 ---
5
6 # Getting Started
7
8 This guide installs the `portal` CLI and exposes a local service through a
9 public relay.
10
11 ## Prerequisites
12
13 - macOS, Linux, or Windows
14 - Internet connectivity
15 - A local service to expose, such as a web app on port `3000`
16
17 ## Install The CLI
18
19 ### macOS / Linux
20
21 ```bash
22 curl -fsSL https://github.com/gosuda/portal-tunnel/releases/latest/download/install.sh | bash
23 ```
24
25 ### Windows PowerShell
26
27 ```powershell
28 $ProgressPreference = 'SilentlyContinue'
29 irm https://github.com/gosuda/portal-tunnel/releases/latest/download/install.ps1 | iex
30 ```
31
32 The installer downloads the `portal` binary and adds it to your `PATH`. It does
33 not create a config file. Portal works out of the box because relay discovery is
34 enabled by default.
35
36 ## Expose Your First App
37
38 Start your local app, then run:
39
40 ```bash
41 portal expose 3000
42 ```
43
44 Portal accepts:
45
46 | Input | Example | Meaning |
47 |-------|---------|---------|
48 | Bare port | `3000` | `127.0.0.1:3000` |
49 | Host and port | `localhost:8080` | that exact local address |
50 | URL host | `http://127.0.0.1:3000` | parsed as `127.0.0.1:3000` |
51
52 Portal prints a public HTTPS URL:
53
54 ```text
55 https://your-name.relay.example.com
56 ```
57
58 Open the URL in a browser. The relay routes the connection, but tenant TLS
59 terminates in the tunnel process running on your machine.
60
61 ## What Happened
62
63 When you ran `portal expose`:
64
65 1. Portal loaded or created a local identity at `identity.json`.
66 2. Portal selected relay URLs from the public registry and discovery.
67 3. The tunnel process registered a lease with one or more relays.
68 4. The tunnel process opened reverse sessions to those relays.
69 5. A public HTTPS hostname was assigned.
70 6. Incoming connections were routed by the relay and handled by your tunnel
71 process.
72
73 The relay provides routing and keyless certificate signing, but it does not
74 receive tenant TLS session keys on the default stream path.
75
76 ## Choose The Right Mode
77
78 Most web apps use the default stream mode:
79
80 ```bash
81 portal expose 3000 --name myapp
82 ```
83
84 Use routed HTTP mode when one public URL should mount multiple local HTTP
85 services:
86
87 ```bash
88 portal expose --name myapp \
89 --http-route /api=http://127.0.0.1:3001 \
90 --http-route /=http://127.0.0.1:5173
91 ```
92
93 Use dedicated raw TCP mode for non-HTTP servers such as Minecraft:
94
95 ```bash
96 portal expose localhost:25565 --name minecraft --tcp
97 ```
98
99 Use UDP mode for datagram services:
100
101 ```bash
102 portal expose localhost:8080 --udp --udp-addr localhost:19132 --name game
103 ```
104
105 ## Use A Specific Relay
106
107 ```bash
108 portal expose 3000 --relays https://portal.example.com --discovery=false
109 ```
110
111 `--discovery=false` limits the tunnel to the explicit relay URLs you supplied.
112
113 ## Keep A Stable Identity
114
115 By default, Portal writes `identity.json` in the current working directory. Use a
116 fixed path when you want stable identity across projects or restarts:
117
118 ```bash
119 portal expose 3000 \
120 --name myapp \
121 --identity-path ~/.config/portal/myapp.identity.json
122 ```
123
124 ## Update The CLI
125
126 ```bash
127 portal update
128 portal version
129 ```
130
131 `portal update` checks the latest GitHub release, downloads the matching asset,
132 verifies its SHA256 checksum, and replaces the current executable.
133
134 ## Next Steps
135
136 - [Concepts](/concepts): understand Portal's relay and transport model
137 - [Portal Agent](/portal-agent): keep multiple tunnels running from config
138 - [CLI Reference](/cli-reference): complete command and flag documentation
139 - [TCP and UDP Tunneling](/tcp-udp-tunneling): raw TCP and UDP examples
140 - [Deployment](/deployment): run your own public relay