- Notifications
You must be signed in to change notification settings - Fork1.1k
docs: add comprehensive Web Terminal documentation#20458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
7 commits Select commitHold shift + click to select a range
a445a0f docs: add comprehensive Web Terminal documentation
mtojek70f2c3f docs: remove mermaid diagram from web-terminal.md
mtojekc8abf58 docs: address review feedback
mtojek40cd86f docs: restore Display Issues section
mtojeka35eb3f docs: run make fmt to fix table formatting
mtojekf6d071f fix: new line
mtojekb52f332 docs: address review feedback
mtojekFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletionsdocs/manifest.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
11 changes: 8 additions & 3 deletionsdocs/user-guides/workspace-access/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
236 changes: 236 additions & 0 deletionsdocs/user-guides/workspace-access/web-terminal.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,236 @@ | ||
| # Web Terminal | ||
| The Web Terminal is a browser-based terminal interface that provides instant | ||
| access to your workspace's shell environment directly from the Coder dashboard. | ||
| It's automatically enabled for all workspaces and requires no additional | ||
| configuration. | ||
|  | ||
| ## Overview | ||
| The Web Terminal leverages [xterm.js](https://xtermjs.org/), an industry-standard | ||
| terminal emulator, combined with WebSocket technology to provide a responsive | ||
| and feature-rich terminal experience in your browser. | ||
| ### Key Features | ||
| - **Instant Access**: Click the terminal icon in your workspace to open a shell | ||
| session | ||
| - **Persistent Sessions**: Sessions are maintained using reconnection tokens, | ||
| allowing you to resume your terminal even after page refreshes or network | ||
| interruptions | ||
| - **Full Unicode Support**: Displays international characters and emojis | ||
| correctly | ||
| - **Clickable Links**: Automatically detects and makes URLs clickable | ||
| - **Copy/Paste Support**: Select text to automatically copy it to your clipboard | ||
| - **Multiple Rendering Options**: Choose between different rendering engines for | ||
| optimal performance | ||
| ## Accessing the Terminal | ||
| ### From the Dashboard | ||
| 1. Navigate to your workspace in the Coder dashboard | ||
| 2. Click the **Terminal** button or icon | ||
| 3. The terminal will open in a new browser tab or window | ||
| The terminal automatically connects to your workspace agent using an optimized | ||
| WebSocket connection. | ||
| ### Direct URL Access | ||
| You can also bookmark or share direct terminal URLs: | ||
| ```text | ||
| https://coder.example.com/@username/workspace-name/terminal | ||
| ``` | ||
| To access a specific agent in a multi-agent workspace: | ||
| ```text | ||
| https://coder.example.com/@username/workspace-name.agent-name/terminal | ||
| ``` | ||
| ## Architecture | ||
| ### How It Works | ||
| The Web Terminal creates a persistent connection between your browser and the | ||
| workspace: | ||
| 1. **Browser**: Renders the terminal using xterm.js | ||
| 2. **WebSocket**: Maintains a persistent, low-latency connection | ||
| 3. **Coder Server**: Routes traffic between browser and workspace | ||
| 4. **Workspace Agent**: Manages the pseudo-terminal (PTY) session | ||
| 5. **Shell Process**: Your actual bash/zsh/fish shell | ||
| The connection flow is: Browser ↔ WebSocket ↔ Coder Server ↔ Workspace Agent ↔ Shell Process | ||
| ### Reconnection & Persistence | ||
| The terminal uses reconnection tokens to maintain session state: | ||
| - Each terminal session has a unique UUID | ||
| - If the connection drops, the same token is used to reconnect | ||
| - The workspace agent buffers output during disconnections | ||
| - Your shell session continues running even when the browser is closed | ||
| ## Customization | ||
| ### Font Selection | ||
| You can customize the terminal font through your user settings: | ||
| 1. Click your avatar in the top-right corner | ||
| 2. Select **Settings** → **Appearance** | ||
| 3. Choose from available fonts: | ||
| - **IBM Plex Mono** (default) | ||
| - **Fira Code** (with ligatures) | ||
| - **JetBrains Mono** | ||
| - **Source Code Pro** | ||
| The font change applies immediately to all open terminal sessions. | ||
| ### Rendering Engine | ||
| Administrators can configure the terminal renderer for performance optimization: | ||
| ```yaml | ||
| # In your Coder deployment configuration | ||
| webTerminalRenderer: "canvas" # Options: canvas, webgl, dom | ||
| ``` | ||
| Or via environment variable: | ||
| ```bash | ||
| CODER_WEB_TERMINAL_RENDERER=canvas | ||
| ``` | ||
| **Renderer Options:** | ||
| - **`canvas`** (default): Best compatibility, good performance on most systems | ||
| - **`webgl`**: Hardware-accelerated, ideal for high-refresh terminals and | ||
| complex rendering | ||
| - **`dom`**: Fallback option, useful for accessibility tools or older browsers | ||
| > **Note:** The renderer setting is deployment-wide and requires a Coder server | ||
| > restart to take effect. | ||
mtojek marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| ## Keyboard Shortcuts | ||
| The Web Terminal supports standard terminal keybindings: | ||
| | Shortcut | Action | | ||
| |-------------------------------------|---------------------------| | ||
| | `Ctrl+Shift+C` (Mac: `Cmd+Shift+C`) | Copy selected text | | ||
| | `Ctrl+Shift+V` (Mac: `Cmd+Shift+V`) | Paste from clipboard | | ||
| | `Shift+Enter` | Insert literal newline | | ||
| | `Ctrl+C` | Send interrupt (SIGINT) | | ||
| | `Ctrl+D` | Send EOF / exit shell | | ||
| | `Ctrl+Z` | Suspend process (SIGTSTP) | | ||
| ### Copy/Paste Behavior | ||
| - **Auto-copy**: Selecting text automatically copies it to your clipboard | ||
| - **Paste**: Use the standard paste shortcut or middle-click (on Linux/X11) | ||
| - **Browser permissions**: First paste may prompt for clipboard access | ||
| ## URL Handling | ||
| The terminal automatically detects URLs and makes them clickable. When you click | ||
| a URL: | ||
| - **External URLs** (e.g., `https://example.com`) open in a new tab | ||
| - **Localhost URLs** (e.g., `http://localhost:3000`) are automatically | ||
| port-forwarded through Coder's [port forwarding](./port-forwarding.md) system | ||
| - **Port-forwarded URLs** use your configured workspace proxy | ||
| This makes it seamless to open development servers running in your workspace. | ||
| ## Advanced Usage | ||
| ### Custom Commands | ||
| You can open a terminal with a specific command by adding a query parameter: | ||
| ```text | ||
| https://coder.example.com/@user/workspace/terminal?command=htop | ||
| ``` | ||
| This will execute `htop` immediately when the terminal opens. | ||
| ### Container Selection | ||
| For workspaces with multiple Docker containers, specify which container to | ||
| connect to: | ||
| ```text | ||
| https://coder.example.com/@user/workspace/terminal?container=sidecar | ||
| ``` | ||
| You can also specify the container user: | ||
| ```text | ||
| https://coder.example.com/@user/workspace/terminal?container=app&container_user=node | ||
| ``` | ||
| > **Note:** This feature only works with Docker containers. | ||
| ### Debug Mode | ||
| Enable debug information to monitor connection latency: | ||
| ```text | ||
| https://coder.example.com/@user/workspace/terminal?debug | ||
| ``` | ||
| This displays the current latency to your selected workspace proxy in the | ||
| bottom-right corner. | ||
| ## Configuration File Support | ||
| The Web Terminal uses xterm.js under the hood, which is configured | ||
| programmatically rather than through a configuration file. However, you can | ||
| customize various aspects: | ||
| ### User-Side Customization | ||
| End-users can customize: | ||
| - **Font family** via Settings → Appearance | ||
| - **Shell environment** via dotfiles or shell rc files | ||
| - **TERM variable** is automatically set to `xterm-256color` | ||
| ### Shell Configuration | ||
| The terminal respects your shell's configuration files: | ||
| ```bash | ||
| # ~/.bashrc or ~/.zshrc | ||
| export PS1="\u@\h:\w\$ " # Custom prompt | ||
| alias ll="ls -lah" # Custom aliases | ||
| # Set terminal colors | ||
| export CTERM=xterm-256color | ||
| ``` | ||
| ## Troubleshooting | ||
| ### Connection Issues | ||
mtojek marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| If the terminal fails to connect: | ||
| 1. **Check workspace status**: Ensure your workspace is running | ||
| 2. **Verify agent health**: Look for agent connection warnings | ||
| 3. **Network issues**: Check if WebSockets are blocked by your firewall/proxy | ||
| 4. **Browser console**: Open DevTools to see WebSocket error messages | ||
| ### Display Issues | ||
| If characters or colors appear incorrect: | ||
| 1. **Unicode support**: Ensure your shell locale is set correctly (`locale -a`) | ||
| 2. **Terminal type**: The terminal sets `TERM=xterm-256color` automatically | ||
| 3. **Color schemes**: Some applications may not render correctly in dark mode | ||
| 4. **Font rendering**: Try switching terminal fonts in your appearance settings | ||
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.