Skip to content

Commit 33509f2

Browse files
kacpersawmatifali
andauthored
feat(docs): add docs for external workspaces (coder#19437)
## Description This PR introduces documentation for recently merged feature: external workspaces. coder#19285 coder#19286 coder#19287 coder#19288 --------- Co-authored-by: Atif Ali <atif@coder.com>
1 parent be40b8c commit 33509f2

File tree

4 files changed

+138
-0
lines changed

4 files changed

+138
-0
lines changed

docs/admin/templates/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,6 @@ needs of different teams.
6161
changes are reviewed and tested.
6262
- [Permissions and Policies](./template-permissions.md): Control who may access
6363
and modify your template.
64+
- [External Workspaces](./managing-templates/external-workspaces.md): Learn how to connect your existing infrastructure to Coder workspaces.
6465

6566
<children></children>
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# External Workspaces
2+
3+
External workspaces allow you to seamlessly connect externally managed infrastructure as Coder workspaces. This enables you to integrate existing servers, on-premises systems, or any capable machine with the Coder environment, ensuring a smooth and efficient development workflow without requiring Coder to provision additional compute resources.
4+
5+
## Prerequisites
6+
7+
- Access to external compute resources that can run the Coder agent:
8+
- **Windows**: amd64 or arm64 architecture
9+
- **Linux**: amd64, arm64, or armv7 architecture
10+
- **macOS**: amd64 or arm64 architecture
11+
- **Examples**: VMs, bare-metal servers, Kubernetes nodes, or any machine meeting the above requirements.
12+
- Networking access to your Coder deployment.
13+
- A workspace template that includes a [`coder_external_agent`](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/external_agent) resource.
14+
15+
We provide an example template on how to set up external workspaces in the [Coder Registry](https://registry.coder.com/templates/coder-labs/externally-managed-workspace)
16+
17+
## Benefits
18+
19+
External workspaces offer flexibility and control in complex environments:
20+
21+
- **Incremental adoption of Coder**
22+
23+
Integrate with existing infrastructure gradually without needing to migrate everything at once. This is particularly useful when gradually migrating worklods to Coder without refactoring current infrastructure.
24+
25+
- **Flexibility**
26+
27+
Attach cloud, hybrid, or on-premises machines as developer workspaces. This enables connecting existing on-premises GPU servers for ML development or bringing manually provisioned VMs in restricted networks under Coder's workspace management.
28+
29+
- **Separation of concerns**
30+
31+
Provision compute resources externally (using your existing IaC or manual processes) while managing workspace configuration (apps, scripts) with Terraform. This approach is ideal for running agents in CI pipelines to provision short-lived, externally managed workspaces for testing or build automation.
32+
33+
## Known limitations
34+
35+
- **Lifecycle control**
36+
37+
Start/stop/restart actions in the Coder UI are disabled for external workspaces.
38+
- **No automatic deprovisioning**
39+
40+
Deleting an external workspace in Coder removes the agent token and record, but does not delete the underlying compute resource.
41+
- **Manual agent management**
42+
43+
Administrators are responsible for deploying and maintaining agents on external resources.
44+
- **Limited UI indicators**
45+
46+
External workspaces are marked in the UI, but underlying infrastructure health is not monitored by Coder.
47+
48+
## When to use it?
49+
50+
Use external workspaces if:
51+
52+
- You have compute resources provisioned outside of Coder’s Terraform flows.
53+
- You want to connect specialized or legacy systems to your Coder deployment.
54+
- You are migrating incrementally to Coder and need hybrid support.
55+
- You need finer control over how and where agents run, while still benefiting from Coder’s workspace experience.
56+
57+
## How to use it?
58+
59+
You can create and manage external workspaces using either the **CLI** or the **UI**.
60+
61+
<div class="tabs">
62+
63+
## CLI
64+
65+
1. **Create an external workspace**
66+
67+
```bash
68+
coder external-workspaces create hello-world \
69+
--template=externally-managed-workspace -y
70+
```
71+
72+
- Validates that the template includes a `coder_external_agent` resource.
73+
- Once created, the workspace is registered in Coder but marked as requiring an external agent.
74+
75+
2. **List external workspaces**
76+
77+
```bash
78+
coder external-workspaces list
79+
```
80+
81+
Example output:
82+
83+
```bash
84+
WORKSPACE TEMPLATE STATUS HEALTHY LAST BUILT CURRENT VERSION OUTDATED
85+
hello-world externally-managed-workspace Started true 15m happy_mendel9 false
86+
```
87+
88+
3. **Retrieve agent connection instructions**
89+
90+
Use this command to query the script you must run on the external machine:
91+
92+
```bash
93+
coder external-workspaces agent-instructions hello-world
94+
```
95+
96+
Example:
97+
98+
```bash
99+
Please run the following command to attach external agent to the workspace hello-world:
100+
101+
curl -fsSL "https://<DEPLOYMENT_URL>/api/v2/init-script/linux/amd64" | CODER_AGENT_TOKEN="<token>" sh
102+
```
103+
104+
You can also output JSON for automation:
105+
106+
```bash
107+
coder external-workspaces agent-instructions hello-world --output=json
108+
```
109+
110+
```json
111+
{
112+
"workspace_name": "hello-world",
113+
"agent_name": "main",
114+
"auth_type": "token",
115+
"auth_token": "<token>",
116+
"init_script": "curl -fsSL \"https://<DEPLOYMENT_URL>/api/v2/init-script/linux/arm64\" | CODER_AGENT_TOKEN=\"<token>\" sh"
117+
}
118+
```
119+
120+
## UI
121+
122+
1. Import the external workspace template (see prerequisites).
123+
2. In the Coder UI, go to **Workspaces → New workspace** and select the imported template.
124+
3. Once the workspace is created, Coder will display **connection details** with the command users need to run on the external machine to start the agent.
125+
4. The workspace will appear in the dashboard, but with the following differences:
126+
- **Start**, **Stop**, and **Restart** actions are disabled.
127+
- Users are provided with instructions for launching the agent manually on the external machine.
128+
129+
![External Workspace View](../../../images/admin/templates/external-workspace.png)
130+
131+
</div>
52.5 KB
Loading

docs/manifest.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,12 @@
537537
"title": "Workspace Scheduling",
538538
"description": "Learn how to control how workspaces are started and stopped",
539539
"path": "./admin/templates/managing-templates/schedule.md"
540+
},
541+
{
542+
"title": "External Workspaces",
543+
"description": "Learn how to manage external workspaces",
544+
"path": "./admin/templates/managing-templates/external-workspaces.md",
545+
"state": ["early access"]
540546
}
541547
]
542548
},

0 commit comments

Comments
 (0)