Citrix Secure Developer Spaces™

How to Maintain Persistent Changes in Your Workspace

Overview

This article outlines best practices for making workspace changes, such as installing packages, software, and libraries—persist across workspace restarts.

In a cloud development environment (CDE), only the developer’s home directory (/home/developer) is stored persistently by default. Here, we explain how to preserve changes made to the workspace image—including modifications outside the developer folder—so the development environment remains consistent across restarts.

If you’d like to create a new container image instead of updating an existing one, e.g. to share the same environment across users or to speed up the boot time of an image with a large start-up script, see: How to Update an Existing Container Image

Key rule: In an SDS workspace, the only persistent directory is /home/developer.

If a tool is installed outside /home/developer (for example via system package paths), it will not persist across restarts. Use the options below to keep environments consistent.

  1. Use a workspace image with most of the tools you use to minimize start-up time (by keeping the start-up script as short as possible)
  2. Prefer user-space package managers for developer tooling (npm, pipx, etc) so installations live under /home/developer (for example ~/.local)`.
  3. Use a workspace startup script for tools that cannot be installed in /home/developer installation commands split between pre-start and post-start when applicable.

Example: persistent user-space installations (npm)

Install global Node tooling into ~/.local so it persists under /home/developer:

mkdir -p ~/.local 
npm config set prefix ~/.local 
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc 
npm i -g yarn pnpm 
<!--NeedCopy-->

Startup scripts (pre-start vs post-start)

Startup scripts automate configuration on workspace launch. SDS supports running the script either pre-startup or post-startup depending on your requirements.

  • Use pre-startup when the workspace must wait for setup to complete (critical prerequisites).
  • Use post-startup for larger installations so developers can start working sooner while setup continues.

Points of consideration

  • Keep long software and package installation sequences as part of the workspace base image definition (i.e. docker file). This will minimize the workspace start-up time.
  • Avoid storing secrets in images or scripts; use platform-managed mechanisms for secrets and access control.
  • If you do use startup scripts, put large installations in post-start to keep time-to-first-code low.

References

How to Maintain Persistent Changes in Your Workspace