You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/admin/workspaces/lifecycle.md
+23-9Lines changed: 23 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -5,17 +5,18 @@ Workspaces are flexible, reproducible, and isolated units of compute. Workspaces
5
5
6
6
This page covers how workspaces move through this lifecycle. To learn about automating workspace schedules for cost control, read the [workspace scheduling docs](./schedule.md).
7
7
8
-
## Resources and persistence
8
+
## Workspace ephemerality
9
9
10
10
In Coder, your workspaces are composed of resources which may be _ephemeral_ or _persistent_. Persistent resources stay provisioned when the workspace is stopped, where as ephemeral resources are destroyed and recreated on restart. All resources are destroyed when a workspace is deleted.
11
11
12
-
13
-
Ephemeral resources reduce the cost of stopped workspaces and ensure reproducibility of your environments.
14
-
15
12
A common example of their usage is to have a workspace whose only persistent resource is the home directory. This allows the developer to retain their work while ensuring the rest of their environment is consistently up-to-date on each workspace restart.
16
13
17
14
The persistence of resources in your workspace is determined by Terraform in your template. Read more from the official documentation on [Terraform resource behavior](https://developer.hashicorp.com/terraform/language/resources/behavior#how-terraform-applies-a-configuration) and how to configure it using the [lifecycle argument](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle).
Generally, there are 3 states that a workspace may fall into:
@@ -41,27 +42,40 @@ When a user creates a workspace, they're sending a build request to the control
41
42
The resources that run the agent are described as _computational resources_,
42
43
while those that don't are called _peripheral resources_. A workspace must contain some computational resource to run the Coder agent process.
43
44
44
-
The provisioned workspace's computational resources start the agent process, which opens connections to your workspace via SSH, the terminal, and IDES like [JetBrains](../../user-guides/workspace-access/jetbrains.md) or [VSCode](../../user-guides/workspace-access/vscode.md).
45
-
46
-
Once started, the Coder agent is responsible for running your workspace startup scripts. These may configure tools, service connections, or personalization like [dotfiles](../../user-guides/workspace-dotfiles.md).
47
-
45
+
The provisioned workspace's computational resources start the agent process, which opens connections to your workspace via SSH, the terminal, and IDES such as [JetBrains](../../user-guides/workspace-access/jetbrains.md) or [VSCode](../../user-guides/workspace-access/vscode.md).
48
46
47
+
Once started, the Coder agent is responsible for running your workspace startup scripts. These may configure tools, service connections, or personalization with [dotfiles](../../user-guides/workspace-dotfiles.md).
49
48
50
49
Once these steps have completed, your workspace will now be in the `Running` state. You can access it via any of the [supported methods](../../user-guides/workspace-access/README.md), stop it when you're away, or delete it once it's no longer in use.
51
50
52
51
## Stopping workspaces
53
52
54
53
Workspaces may be stopped manually by users and admins in the dashboard, CLI, or API. Workspaces may be automatically stopped by scheduling configuration to reduce the uptime of costly resources.
55
54
55
+
Once stopped, a workspace may resume running by starting it manually, or via user connection if automatic start is enabled.
56
56
57
+
<!-- TODO: Add "start on connect" docs link -->
57
58
58
59
## Deleting workspaces
59
60
61
+
Similarly to stopping, workspaces may be deleted manually or automatically by Coder through workspace dormancy.
62
+
63
+
A delete workspace build runs `terraform destroy`, destroying both persistent and ephemeral resources. This action can not be reverted.
64
+
65
+
When enabled on enterprise deployments, workspaces will become dormant after a specified duration of inactivity. Then, if left dormant, the workspaces will be queued for deletion. Learn about configuraing workspace dormancy in the template scheduling docs.
66
+
67
+
### Orphan resources
68
+
69
+
Typically, when a workspace is deleted, all of the workspace's resources are deleted along with it. Rarely, one may wish to delete a workspace without deleting its resources, e.g. a workspace in a broken state. Users with the Template Admin role have the option to do so both in the UI, and also in the CLI by running the delete command with the `--orphan` flag. This option should be considered cautiously as orphaning may lead to unaccounted cloud resources.
70
+
60
71
61
-
## Unhealthy and Failed workspaces
72
+
## Broken workspace states
62
73
74
+
During a workspace start or stop build, one of two errors may lead to a broken state. If the call to `terraform apply` fails to correctly provision resources, a workspace build has **failed**. If the computational resources fail to connect the agent, a workspace becomes **unhealthy**.
63
75
76
+
A failed workspace is most often caused by misalignment from the definition in your template's Terraform file and the target resources on your infrastructure. Unhealthy workspaces are usually caused by a misconfiguration in the agent or startup scripts it runs.
0 commit comments