Manage Runtime Settings#
Overview#
- This guide covers how to manage runtime settings like environment variables and mounts.
Runtime settings are loaded when you start the container. They are not built into the image.
Key Concepts#
- Environment Variable
A key-value pair passed into the container at runtime to configure software behavior.
- Sensitive Variable
An environment variable whose value is stored locally and not versioned with the project.
- Host Mount
Makes files or directories on the host available at a specific location inside the container, and vice versa. Has a source directory on the host and a target directory in the container.
An example is a project, where the project repository on the host is the source and the /project/ folder in the container is the target.
- Volume Mount
Persistent storage attached to the container that is not subject to the read/write layer. Managed by the container runtime and not accessible from the host. Only has a target directory.
- Target Directory
Directory in the container file system for a host mount or a volume mount. The absolute path in the container where mounted files appear.
- Source Directory
Directory on the host for a host mount. The absolute path on the host to the directory.
Environment Variables#
Create Variable#
- Step One: Add a new environment.
Select Project Tab > Project Container > Environment Variables > Add.
Enter the environment variable name (key), e.g.
HUGGINGFACE_HUB_CACHEEnter the environment variable value, e.g. /mnt/cache.
For sensitive variables (API keys, passwords), check the Sensitive checkbox
Select Add
Restart the container to load the new variable
- Step Two: Commit the change.
Select Project Tab > Commit
Sensitive variable values are not written anywhere in the project repository or versioned.
Sensitive environment variables are key-value pairs. The key is entered into the .project/spec.yaml as a secret, but the value is not.
Instead, the value is kept on the host in the project’s runtime folder. AI Workbench reads the sensitive value from there and loads it into the container at runtime.
Update Variable#
- You can update an environment variable, but only the value.
Environment variables are key-value pairs The key is the name. You can only update the value. You cannot update the key.
- Step One: Update the environment variable.
Go to Project Tab > Project Container > Environment Variables
Select Option Dots (RHS) > Edit Environment Variable
Enter the new value.
Select Save
Restart the container to load the variable
- Step Two: Commit the change.
Select Project Tab > Commit
Delete Variable#
- Step One: Delete the environment variable.
Go to Project Tab > Project Container > Environment Variables
Select Option Dots (RHS) > Remove Environment Variable
Confirm the deletion
Restart the container to eliminate the variable
- Step Two: Commit the change.
Select Project Tab > Commit
Set Sensitive Variable on Clone#
- If you clone a project with sensitive environment variables, you must set them for that host.
The key for the secret is written to the .project/spec.yaml file, but the value is not saved in the repository. You must add it on that host.
- AI Workbench will notify you that there are environments variables to configure.
The Project Tab will show an Unconfigured Environment Variable Banner. You will also be prompted to configure the variables when you start an application or the container.
- Step One: Set the variable in one of various ways in the Project Tab.
Select Unconfigured Environment Variable > Resolve Now, enter the value, select Continue
OR, select Environment > Project Container > Variables > Configure, enter the value, select Save
OR, launch an app in Application Launcher, enter the value, select Continue
- Step Two: Commit the change.
Select Project Tab > Commit
Configure Host Mounts#
Add Host Mount#
- You can add a host mount to a project container already on the host.
You just need a source directory on the host.
- Step One: Select or create a source directory on the host.
The source directory must exist on the host before you create the mount.
- Step Two: Have an intended target directory in the container.
The target directory does not need to exist before creating the mount. The feature will create it if it does not yet exist.
- Step Three: Create the host mount in the Project Tab.
Select Project Tab > Project Container > Mounts > Add
Select Host Mount
Enter the absolute path to the target directory in the container
Enter the absolute path to the source directory on the host
(optional) Enter a description
Select Add
Restart the container to add the mount
- Step Four: Commit the change.
Select Project Tab > Commit
Do not set mount targets into versioned directories or other targets, i.e. /project/.
This will cause unexpected behavior.
Clone Project with Host Mount#
- If you clone a project with a host mount set, you will be prompted to enter a source directory.
The target directory for a host mount is added to the .project/spec.yaml file and is versioned.
However, the source directory is not versioned in the project. It must be set everytime the project is cloned to a new host.
- The source directory must exist on the host before you configure it.
While AI Workbench will create the target directory in the container, it cannot create a source directory on the host. It must exist before it can be mounted.
- Step One: Set source directory in one of various ways in the Project Tab.
Select Unconfigured Environment Variable > Resolve Now, enter the value, select Continue
OR, select Environment > Project Container > Mounts > Configure, enter the value, select Save
OR, launch an app in Application Launcher, enter the value, select Continue
- Step Two: Commit the change.
Select Project Tab > Commit
Cloning to a remote location may require you to SSH to the host create the source.
AI Workbench automatically configures SSH into any remote location added to the Desktop App. SSH to the remote and create the directory with the commands:
ssh <remote-location-name>
mkdir <path-to-source-folder>
Edit Host Mount#
- You cannot edit the target directory for a host mount, but you can edit the source directory.
The target directory is set for the mount until you delete the mount entirely.
- Step One: Edit the source directory for an existing host mount.
Select Project Tab > Project Container > Mounts
Select host mount to edit > Option Dots > Edit Mount
Enter the new source directory
Select Save
Restart the container for changes to take effect
- Step Two: Commit the change.
Select Project Tab > Commit
Remove Host Mount#
- Step One: Remove the host mount.
Select Project Tab > Project Container > Mounts
Select host mount to delete > Option Dots > Remove Host Mount
Select Remove.
Restart the container for the changes to take effect
- Step Two: Commit the change.
Select Project Tab > Commit
Configure Volume Mounts#
- Volume mounts only have target directories.
The storage volume is managed by the container runtime. It is not available in the host file system, so there is no source directory to set.
- The target directory for a volume mount is versioned in the project.
The target directory for a host mount is added to the .project/spec.yaml file and is versioned.
- The files in the volume mount are not versioned and do not travel with the project repository.
Volume mounts provide persistent storage within the container on a specific host. The contents of the mount are not written into the container image, and they do not travel to another host.
Add Volume Mount#
- Step One: Have an intended target directory in the container.
The target directory does not need to exist before creating the mount. The feature will create it if it does not yet exist.
However, you can use an existing directory in the container file system.
- Step Two: Create the volume mount in the Project Tab.
Select Project Tab > Project Container > Mounts > Add
Select Volume Mount
Enter the absolute path to the target directory in the container
(optional) Enter a description
Select Add
Restart the container to add the mount
- Step Four: Commit the change.
Select Project Tab > Commit