Skip to content

Commit fc0dbec

Browse files
feat: persistent user home documentation (#2822)
* feat: persistent user home documentation Signed-off-by: dkwon17 <dakwon@redhat.com> * Update modules/administration-guide/pages/about-persistent-user-home.adoc Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com> * Update modules/administration-guide/pages/about-persistent-user-home.adoc Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com> * Update modules/administration-guide/pages/about-persistent-user-home.adoc Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com> * Update modules/administration-guide/pages/about-persistent-user-home.adoc Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com> * Update modules/administration-guide/pages/about-persistent-user-home.adoc Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com> * Update modules/administration-guide/pages/about-persistent-user-home.adoc Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com> * Update based on PR feedback Signed-off-by: dkwon17 <dakwon@redhat.com> * Update stow version Signed-off-by: dkwon17 <dakwon@redhat.com> * Update PR typo Signed-off-by: dkwon17 <dakwon@redhat.com> --------- Signed-off-by: dkwon17 <dakwon@redhat.com> Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com>
1 parent 9bc90d9 commit fc0dbec

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed
99.2 KB
Loading

modules/administration-guide/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
*** xref:configuring-storage-classes.adoc[]
8383
*** xref:configuring-the-storage-strategy.adoc[]
8484
*** xref:configuring-storage-sizes.adoc[]
85+
*** xref:about-persistent-user-home.adoc[]
8586
** xref:configuring-dashboard.adoc[]
8687
*** xref:configuring-getting-started-samples.adoc[]
8788
*** xref:configuring-editors-definitions.adoc[]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
:_content-type: CONCEPT
2+
:description: About persistent user home
3+
:keywords: administration guide, about, {prod-id-short}, persistent, user, home
4+
:navtitle: Persistent user home
5+
:page-aliases:
6+
7+
[id="about-persistent-user-home"]
8+
= Persistent user home
9+
10+
11+
{prod} provides a persistent home directory feature that allows each non-ephemeral workspace to have their `/home/user` directory be persisted across workspace restarts.
12+
You can enable this feature in the CheCluster by setting `spec.devEnvironments.persistUserHome.enabled` to `true`.
13+
14+
For newly started workspaces, this feature creates a PVC mounted to the `/home/user` path of the tools container.
15+
In this documentation, a "tools container" will be used to refer to the first container in the devfile.
16+
This container is the container that includes the project source code by default.
17+
18+
When the PVC is mounted for the first time, the persistent volume's content are empty and therefore must be populated with the `/home/user` directory content.
19+
20+
By default, the `persistUserHome` feature creates an init container for each new workspace pod named `init-persistent-home`.
21+
This init container is created with the tools container image and is responsible for running a `stow` command to create symbolic links
22+
in the persistent volume to populate the `/home/user` directory.
23+
24+
NOTE: For files that cannot be symbolically linked to the `/home/user` directory such as the `.viminfo` and `.bashrc` file, `cp` is used instead of `stow`.
25+
26+
The primary function of the `stow` command is to run:
27+
[subs="+quotes,attributes"]
28+
----
29+
stow -t /home/user/ -d /home/tooling/ --no-folding
30+
----
31+
32+
The command above creates symbolic links in `/home/user` for files and directories located in /home/tooling. This populates the persistent volume with symbolic links to the content in `/home/tooling`. As a result, it the `persistentUserHome` feature expects the tooling image to have its `/home/user/` content within `/home/tooling`.
33+
34+
For example, if the tools container image contains files in the `home/tooling` directory such as `.config` and `.config-folder/another-file`, stow will create symbolic links in the persistent volume in the following manner:
35+
36+
.Tools container with `persistUserHome` enabled
37+
image::persistent-user-home/tools-container-example.png[Persistent user home example scenario]
38+
39+
The init container writes the output of the `stow` command to `/home/user/.stow.log` and will only run `stow` the first time the persistent volume is mounted to the workspace.
40+
41+
Using the `stow` command to populate `/home/user` content in the persistent volume provides two main advantages:
42+
43+
. Creating symbolic links is faster and consumes less storage than creating copies of the `/home/user` directory content in the persistent volume. To put it differently, the persistent volume in this case contains symbolic links and not the actual files themselves.
44+
. If the tools image is updated with newer versions of existing binaries, configs, and files, the init container does not need to `stow` the new versions, as the existing symbolic links will link to the newer versions in `/home/tooling` already.
45+
46+
NOTE: If the tooling image is updated with additional binaries or files, they won't be symbolically linked to the `/home/user` directory since the `stow` command won't be run again. In this case, the user must delete the `/home/user/.stow_completed` file and restart the workspace to rerun `stow`.
47+
48+
.`persistUserHome` tools image requirements
49+
50+
The `persistUserHome` depends on the tools image used for the workspace. By default {prod-short} uses the Universal Developer Image (UDI) for sample workspaces, which supports `persistUserHome` out of the box.
51+
52+
If you are using a custom image, there are three requirements that should be met to support the `persistUserHome` feature.
53+
54+
. The tools image should contain `stow` version >= 2.4.0.
55+
. The `$HOME` environment variable is set to `/home/user`.
56+
. In the tools image, the directory that is intended to contain the `/home/user` content is `/home/tooling`.
57+
58+
Due to requirement three, the default UDI image for example adds the `/home/user` content to `/home/tooling` instead, and runs:
59+
60+
[subs="+quotes,attributes"]
61+
----
62+
RUN stow -t /home/user/ -d /home/tooling/ --no-folding
63+
----
64+
65+
in the Dockerfile so that files in `/home/tooling` are accessible from `/home/user` even when not using the `persistUserHome` feature.

modules/administration-guide/pages/configuring-storage.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414

1515
* xref:configuring-storage-classes.adoc[]
1616
* xref:configuring-the-storage-strategy.adoc[]
17-
* xref:configuring-storage-sizes.adoc[]
17+
* xref:configuring-storage-sizes.adoc[]
18+
* xref:about-persistent-user-home.adoc[]

0 commit comments

Comments
 (0)