-
Notifications
You must be signed in to change notification settings - Fork 973
feat(docs): add docs for external workspaces #19437
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
kacpersaw
wants to merge
4
commits into
main
Choose a base branch
from
kacpersaw/external-workspaces-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+138
−0
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
131 changes: 131 additions & 0 deletions
131
docs/admin/templates/managing-templates/external-workspaces.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,131 @@ | ||
# External Workspaces | ||
|
||
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. | ||
|
||
## Prerequisites | ||
|
||
- Access to external compute resources that can run the Coder agent: | ||
- **Windows**: amd64 or arm64 architecture | ||
- **Linux**: amd64, arm64, or armv7 architecture | ||
- **macOS**: amd64 or arm64 architecture | ||
- **Examples**: VMs, bare-metal servers, Kubernetes nodes, or any machine meeting the above requirements. | ||
- Networking access to your Coder deployment. | ||
- A workspace template that includes a [`coder_external_agent`](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/external_agent) resource. | ||
|
||
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) | ||
|
||
## Benefits | ||
|
||
External workspaces offer flexibility and control in complex environments: | ||
|
||
- **Incremental adoption of Coder** | ||
|
||
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. | ||
|
||
- **Flexibility** | ||
|
||
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. | ||
|
||
- **Separation of concerns** | ||
|
||
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. | ||
|
||
## Known limitations | ||
|
||
- **Lifecycle control** | ||
|
||
Start/stop/restart actions in the Coder UI are disabled for external workspaces. | ||
- **No automatic deprovisioning** | ||
|
||
Deleting an external workspace in Coder removes the agent token and record, but does not delete the underlying compute resource. | ||
- **Manual agent management** | ||
|
||
Administrators are responsible for deploying and maintaining agents on external resources. | ||
- **Limited UI indicators** | ||
|
||
External workspaces are marked in the UI, but underlying infrastructure health is not monitored by Coder. | ||
|
||
## When to use it? | ||
|
||
Use external workspaces if: | ||
|
||
- You have compute resources provisioned outside of Coder’s Terraform flows. | ||
- You want to connect specialized or legacy systems to your Coder deployment. | ||
- You are migrating incrementally to Coder and need hybrid support. | ||
- You need finer control over how and where agents run, while still benefiting from Coder’s workspace experience. | ||
|
||
## How to use it? | ||
|
||
You can create and manage external workspaces using either the **CLI** or the **UI**. | ||
|
||
### CLI workflow | ||
|
||
#### 1. Create an external workspace | ||
|
||
```bash | ||
coder external-workspaces create hello-world \ | ||
--template=externally-managed-workspace -y | ||
``` | ||
|
||
- Validates that the template includes a `coder_external_agent` resource. | ||
- Once created, the workspace is registered in Coder but marked as requiring an external agent. | ||
|
||
--- | ||
|
||
#### 2. List external workspaces | ||
|
||
```bash | ||
coder external-workspaces list | ||
``` | ||
|
||
Example output: | ||
|
||
```bash | ||
WORKSPACE TEMPLATE STATUS HEALTHY LAST BUILT CURRENT VERSION OUTDATED | ||
hello-world externally-managed-workspace Started true 15m happy_mendel9 false | ||
``` | ||
|
||
--- | ||
|
||
#### 3. Retrieve agent connection instructions | ||
|
||
Use this command to query the script you must run on the external machine: | ||
|
||
```bash | ||
coder external-workspaces agent-instructions hello-world | ||
``` | ||
|
||
Example: | ||
|
||
```bash | ||
Please run the following command to attach external agent to the workspace hello-world: | ||
|
||
curl -fsSL "https://<DEPLOYMENT_URL>/api/v2/init-script/linux/amd64" | CODER_AGENT_TOKEN="<token>" sh | ||
``` | ||
|
||
You can also output JSON for automation: | ||
|
||
```bash | ||
coder external-workspaces agent-instructions hello-world --output=json | ||
``` | ||
|
||
```json | ||
{ | ||
"workspace_name": "hello-world", | ||
"agent_name": "main", | ||
"auth_type": "token", | ||
"auth_token": "<token>", | ||
"init_script": "curl -fsSL \"https://<DEPLOYMENT_URL>/api/v2/init-script/linux/arm64\" | CODER_AGENT_TOKEN=\"<token>\" sh" | ||
} | ||
``` | ||
|
||
### UI workflow | ||
|
||
1. Import the external workspace template (see prerequisites). | ||
2. In the Coder UI, go to **Workspaces → New workspace** and select the imported template. | ||
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. | ||
4. The workspace will appear in the dashboard, but with the following differences: | ||
- **Start**, **Stop**, and **Restart** actions are disabled. | ||
- Users are provided with instructions for launching the agent manually on the external machine. | ||
|
||
 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we drop a screenshot here?