Workspace Templates
A Workspace Template is designed to simplify the management of development environments, allowing you to predefine settings that can be easily applied to any new Workspace.
A Workspace Template contains all necessary properties to define and manage Workspaces within a Workspace. It stores information such as the repository URL, build configuration, and environment variables. This allows for easy reuse of previously set templates, ensuring a consistent and reproducible setup across multiple Workspaces.
A Workspace Template encapsulates all the essential elements for setting up a Workspace, including:
-
Repository URL
The URL of the Git repository associated with the Workspace.
-
Build Configuration
Automatic auto-detects the most appropriate Builder for your Workspace.
Devcontainer utilizes a predefined development container specified by a
devcontainer.json
file.Custom image builds the Workspace image by specifying a custom base container.
None builds a Workspace by using the default base image (
daytonaio/workspace-project
). -
Environment Variables
Environment variables are specified in the
KEY=VALUE
format. These variables are essential for the Workspace’s build and runtime environments. You can set the variables directly or pass them from the machine’s environment during execution. -
Workspace Template name
A unique identifier for the Workspace Template, which distinguishes it from other Template within the system.
With the daytona workspace-template
command, you can add, view, update, list, set as default, or delete Workspace Templates, giving you full control over the Template and reuse of your Workspace setups across different Workspaces.
Create a Workspace Template
Daytona provides an option to add a Workspace Template, enabling you to store and reuse Workspace properties across multiple Workspaces.
- Run the following command to add a Workspace Template:
- Select one of the two provided options available for creating a Workspace Template:
-
Enter a custom repository URL
An option to enter a custom repository URL manually if the repository is not listed under your Git Provider account or is from an external source.
-
Create from Sample
If you do not have a Git repository ready, you can create a Workspace Template from a Sample project provided by Daytona.
- Enter the repository URL of the Workspace you want to configure, or select to create a Workspace Template from a sample project.
- Enter a name for the Workspace Template.
- Select the build configuration for the Workspace.
- Enter the environment variables for the Workspace in the
KEY=VALUE
format.
Upon completion, Daytona will output a summary of the Workspace Template, enabling you to review the properties before saving it.
- Click
Create
to save the Workspace Template, orConfigure
to make changes to the Workspace Template.
List Workspace Templates
Daytona provides an option to list all Workspace Templates, providing you with an overview of the properties stored within each Template.
- Run the following command to list all Workspace Templates:
Upon running this command, Daytona will display a list of your Workspace Templates. You will be able to view the Workspace Template name, the repository URL it is connected to, the build configuration, and if it is set as a default Template.
Update Workspace Template
Daytona provides an option to update an existing Workspace Template, enabling you to modify the properties stored within it.
- Run the following command to update a Workspace Template:
- Select the Workspace Template you want to update.
Delete Workspace Template
Daytona provides an option to delete an existing Workspace Template, enabling you to remove properties that are no longer needed.
- Run the following command to delete a Workspace Template:
- Select the Workspace Template you want to delete.
Workspace Template Information
Daytona provides an option to view detailed information of a Workspace Template, providing you with an overview of the properties stored within it.
- Run the following command to view the details of a Workspace Template:
Upon running this command, Daytona will display a list of your Workspace Templates.
- Select the Workspace Template you want to view.
Upon selecting the Workspace Template, Daytona will display the details of the selected Template. You will be able to view the Workspace Template name, the repository URL it is linked to, the build configuration, and the Devcontainer path.
Set Default Workspace Template
Daytona provides an option to set a default Workspace Template, enabling you to define a Template that will be used by default when creating new Workspaces.
- Run the following command to set a default Workspace Template:
- Select the Workspace Template you want to set as the default.
Upon selecting the default Workspace Template, Daytona will set it as the default Template for new Workspaces.
- Update the properties of the Workspace Template.
Upon completion, Daytona will save the updated Workspace Template, allowing you to reuse it across Workspaces.
Import Workspace Template
Daytona provides an option to import a Workspace Template, enabling you to reuse existing Workspace properties across multiple Workspaces.
- Run the following command to import a Workspace Template:
- Enter the Workspace Template as a JSON object or an array of JSON objects.
- An empty example of the JSON object properties format:
Export Workspace Template
Daytona provides an option to export a Workspace Template, enabling you to save the properties of a Workspace Template as a JSON object.
- Run the following command to export a Workspace Template:
- Select the Workspace Template you want to export.
Upon selecting the Workspace Template you want to export, Daytona will output the properties of the selected Template as a JSON object.