|
| 1 | +--- |
| 2 | +title: Storage |
| 3 | +description: Learn about storage in workspaces. |
| 4 | +--- |
| 5 | + |
| 6 | +Coder differentiates between system-installed files and user-installed files. |
| 7 | +System-installed files are stored in `/user/`, while user-installed files are |
| 8 | +located in the root directory `~`. |
| 9 | + |
| 10 | +Conventionally, Coder places anything installed with `apt` or `yum` or similar |
| 11 | +with the system-installed files. This is considered ephemeral storage in Coder |
| 12 | +workspaces, and we recommend that you install these using `docker build` and |
| 13 | +have them in your image. |
| 14 | + |
| 15 | +Conversely, things installed via `npm`, Java dependencies, Ruby bundles, or |
| 16 | +similar, belong in the project folder (which is the `~`) so that it persists in |
| 17 | +Coder workspaces. |
| 18 | + |
| 19 | +## Storage allocation for workspaces |
| 20 | + |
| 21 | +Coder allows users to choose how much storage to allocate to their workspace. |
| 22 | + |
| 23 | +Ephemeral storage (where system-installed files are located) is available to |
| 24 | +you, but we don't recommend that you use this too often. Kubernetes enforces |
| 25 | +some limits on using this storage, and exceeding certain bounds could |
| 26 | +potentially lead to eviction in some clusters. |
| 27 | + |
| 28 | +Instead, we recommend installing everything a user needs in the image, including |
| 29 | +build steps, so that they can be shared across workspaces. For example, if you |
| 30 | +have multiple users start base images and install the same five things |
| 31 | +(e.g., Node.js, CLIs, etc.), these things get placed in ephemeral storage, and |
| 32 | +none of it is shared across workspaces. |
| 33 | + |
| 34 | +However, if you share some of the items and install them during `docker |
| 35 | +build`, the image cache layers have the apps in them, and they can be shared |
| 36 | +across workspaces. This also has the benefit of speeding up the workspace build |
| 37 | +process. |
| 38 | + |
| 39 | +The only things we recommend placing in your workspace storage are the contents |
| 40 | +of your Git repos and any generated artifacts. |
| 41 | + |
| 42 | +If you're using Node.js or Go, you'll see that these install many items in your |
| 43 | +persistent user directory to make capabilities like `npx` persist (though these |
| 44 | +are project-specific items). |
0 commit comments