2022-04-26 12:10:50 -05:00
|
|
|
# Workspaces
|
|
|
|
|
|
|
|
|
|
Workspaces contain the IDEs, dependencies, and configuration information needed
|
|
|
|
|
for software development.
|
|
|
|
|
|
|
|
|
|
## Create workspaces
|
|
|
|
|
|
2023-08-23 12:27:57 +03:00
|
|
|
Each Coder user has their own workspaces created from
|
|
|
|
|
[shared templates](./templates/index.md):
|
2022-04-26 12:10:50 -05:00
|
|
|
|
2023-08-23 12:27:57 +03:00
|
|
|
```shell
|
2022-04-26 12:10:50 -05:00
|
|
|
# create a workspace from the template; specify any variables
|
2022-07-14 14:31:01 -04:00
|
|
|
coder create --template="<templateName>" <workspaceName>
|
2022-04-26 12:10:50 -05:00
|
|
|
|
2022-05-19 08:01:19 -05:00
|
|
|
# show the resources behind the workspace and how to connect
|
2022-05-02 11:08:52 -05:00
|
|
|
coder show <workspace-name>
|
2022-04-26 12:10:50 -05:00
|
|
|
```
|
|
|
|
|
|
2022-06-16 11:22:14 -05:00
|
|
|
## IDEs
|
2022-04-26 12:10:50 -05:00
|
|
|
|
2023-04-14 19:11:51 +03:00
|
|
|
Coder [supports multiple IDEs](./ides.md) for use with your workspaces.
|
2022-04-26 12:10:50 -05:00
|
|
|
|
|
|
|
|
## Workspace lifecycle
|
|
|
|
|
|
|
|
|
|
Workspaces in Coder are started and stopped, often based on whether there was
|
2023-08-23 12:27:57 +03:00
|
|
|
any activity or if there was a
|
|
|
|
|
[template update](./templates/index.md#Start/stop) available.
|
2022-04-26 12:10:50 -05:00
|
|
|
|
|
|
|
|
Resources are often destroyed and re-created when a workspace is restarted,
|
2023-08-23 12:27:57 +03:00
|
|
|
though the exact behavior depends on the template. For more information, see
|
|
|
|
|
[Resource Persistence](./templates/resource-persistence.md).
|
2022-04-26 12:10:50 -05:00
|
|
|
|
|
|
|
|
> ⚠️ To avoid data loss, refer to your template documentation for information on
|
|
|
|
|
> where to store files, install software, etc., so that they persist. Default
|
2023-08-23 12:27:57 +03:00
|
|
|
> templates are documented in
|
|
|
|
|
> [../examples/templates](https://github.com/coder/coder/tree/c6b1daabc5a7aa67bfbb6c89966d728919ba7f80/examples/templates).
|
2022-04-26 12:10:50 -05:00
|
|
|
>
|
2022-05-19 08:01:19 -05:00
|
|
|
> You can use `coder show <workspace-name>` to see which resources are
|
2022-04-26 12:10:50 -05:00
|
|
|
> persistent and which are ephemeral.
|
|
|
|
|
|
|
|
|
|
When a workspace is deleted, all of the workspace's resources are deleted.
|
|
|
|
|
|
2022-10-24 15:32:05 -04:00
|
|
|
## Workspace scheduling
|
|
|
|
|
|
2023-08-23 12:27:57 +03:00
|
|
|
By default, workspaces are manually turned on/off by the user. However, a
|
|
|
|
|
schedule can be defined on a per-workspace basis to automate the workspace
|
|
|
|
|
start/stop.
|
2022-10-24 15:32:05 -04:00
|
|
|
|
|
|
|
|

|
|
|
|
|
|
2023-04-04 22:48:35 +10:00
|
|
|
### Autostart
|
2022-10-24 15:32:05 -04:00
|
|
|
|
2023-08-23 12:27:57 +03:00
|
|
|
The autostart feature automates the workspace build at a user-specified time and
|
|
|
|
|
day(s) of the week. In addition, users can select their preferred timezone.
|
2022-10-24 15:32:05 -04:00
|
|
|
|
2023-04-04 22:48:35 +10:00
|
|
|

|
2022-10-24 15:32:05 -04:00
|
|
|
|
2023-04-04 22:48:35 +10:00
|
|
|
### Autostop
|
2022-10-24 15:32:05 -04:00
|
|
|
|
2023-08-23 12:27:57 +03:00
|
|
|
The autostop feature shuts off workspaces after given number of hours in the
|
|
|
|
|
"on" state. If Coder detects workspace connection activity, the autostop timer
|
|
|
|
|
is bumped up one hour. IDE, SSH, Port Forwarding, and coder_app activity trigger
|
|
|
|
|
this bump.
|
2022-10-24 15:32:05 -04:00
|
|
|
|
2023-04-04 22:48:35 +10:00
|
|
|

|
2022-10-24 15:32:05 -04:00
|
|
|
|
2023-06-23 18:51:42 -04:00
|
|
|
### Max lifetime
|
|
|
|
|
|
|
|
|
|
Max lifetime is a template-level setting that determines the number of hours a
|
2023-08-23 12:27:57 +03:00
|
|
|
workspace can run before it is automatically shutdown, regardless of any active
|
|
|
|
|
connections. This setting ensures workspaces do not run in perpetuity when
|
|
|
|
|
connections are left open inadvertently.
|
2023-06-23 18:51:42 -04:00
|
|
|
|
2022-04-26 12:10:50 -05:00
|
|
|
## Updating workspaces
|
|
|
|
|
|
|
|
|
|
Use the following command to update a workspace to the latest template version.
|
|
|
|
|
The workspace will be stopped and started:
|
|
|
|
|
|
2023-08-23 12:27:57 +03:00
|
|
|
```shell
|
2022-05-02 11:08:52 -05:00
|
|
|
coder update <workspace-name>
|
2022-04-26 12:10:50 -05:00
|
|
|
```
|
2022-06-16 18:09:40 -05:00
|
|
|
|
2022-11-02 18:56:24 -05:00
|
|
|
## Repairing workspaces
|
|
|
|
|
|
2023-08-23 12:27:57 +03:00
|
|
|
Use the following command to re-enter template input variables in an existing
|
|
|
|
|
workspace. This command is useful when a workspace fails to build because its
|
|
|
|
|
state is out of sync with the template.
|
2022-11-02 18:56:24 -05:00
|
|
|
|
2023-08-23 12:27:57 +03:00
|
|
|
```shell
|
2022-11-02 18:56:24 -05:00
|
|
|
coder update <your workspace name> --always-prompt
|
|
|
|
|
```
|
|
|
|
|
|
2022-07-31 16:06:05 -04:00
|
|
|
## Logging
|
|
|
|
|
|
2022-08-11 20:22:06 -05:00
|
|
|
Coder stores macOS and Linux logs at the following locations:
|
2022-07-31 16:06:05 -04:00
|
|
|
|
2023-03-06 21:34:00 +02:00
|
|
|
| Service | Location |
|
|
|
|
|
| ----------------- | -------------------------------- |
|
|
|
|
|
| `startup_script` | `/tmp/coder-startup-script.log` |
|
|
|
|
|
| `shutdown_script` | `/tmp/coder-shutdown-script.log` |
|
|
|
|
|
| Agent | `/tmp/coder-agent.log` |
|
2022-07-31 16:06:05 -04:00
|
|
|
|
2023-06-02 15:36:43 -04:00
|
|
|
> Note: Logs are truncated once they reach 5MB in size.
|
|
|
|
|
|
2023-06-06 12:12:10 -03:00
|
|
|
## Workspace filtering
|
|
|
|
|
|
2023-08-23 12:27:57 +03:00
|
|
|
In the Coder UI, you can filter your workspaces using pre-defined filters or
|
|
|
|
|
employing the Coder's filter query. Take a look at the following examples to
|
|
|
|
|
understand how to use the Coder's filter query:
|
2023-06-06 12:12:10 -03:00
|
|
|
|
|
|
|
|
- To find the workspaces that you own, use the filter `owner:me`.
|
2023-08-23 12:27:57 +03:00
|
|
|
- To find workspaces that are currently running, use the filter
|
|
|
|
|
`status:running`.
|
2023-06-06 12:12:10 -03:00
|
|
|
|
|
|
|
|
The following filters are supported:
|
|
|
|
|
|
2023-08-23 12:27:57 +03:00
|
|
|
- `owner` - Represents the `username` of the owner. You can also use `me` as a
|
|
|
|
|
convenient alias for the logged-in user.
|
2023-06-06 12:12:10 -03:00
|
|
|
- `template` - Specifies the name of the template.
|
2023-08-23 12:27:57 +03:00
|
|
|
- `status` - Indicates the status of the workspace. For a list of supported
|
|
|
|
|
statuses, please refer to the
|
|
|
|
|
[WorkspaceStatus documentation](https://pkg.go.dev/github.com/coder/coder/v2/codersdk#WorkspaceStatus).
|
2023-06-06 12:12:10 -03:00
|
|
|
|
2023-02-01 17:05:45 -03:00
|
|
|
---
|
|
|
|
|
|
2022-06-16 18:48:18 -05:00
|
|
|
## Up next
|
2022-12-05 12:21:09 +01:00
|
|
|
|
2022-06-16 18:48:18 -05:00
|
|
|
- Learn about how to personalize your workspace with [Dotfiles](./dotfiles.md)
|
|
|
|
|
- Learn about using [IDEs](./ides.md)
|