Clusters
Managing Cluster Templates
You can manage and explore Templates through the Tensor One Web Interface.
Exploring Templates
- Official and Community Templates:
- Navigate to the Explore section to view Templates maintained by Tensor One and the broader community.
- Private and Team Templates:
- Visit the Templates section to view Templates created by you or your team.
To create a custom Template, follow the steps below.
Creating a Template
Templates define how an image is launched as a Cluster, including:
- Container disk size
- Volume size and mount path
- Ports to expose
- Environment variables
Use the following GraphQL mutation via curl
to create a Template:
curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.tpu.one/graphql?api_key=${YOUR_API_KEY}' \
--data '{
"query": "mutation { saveTemplate(input: { containerDiskInGb: 5, dockerArgs: \"sleep infinity\", env: [ { key: \"key1\", value: \"value1\" }, { key: \"key2\", value: \"value2\" } ], imageName: \"ubuntu:latest\", name: \"Generated Template\", ports: \"8888/http,22/tcp\", readme: \"## Hello, World!\", volumeInGb: 15, volumeMountPath: \"/workspace\" }) { containerDiskInGb dockerArgs env { key value } id imageName name ports readme volumeInGb volumeMountPath } }"
}'
Environment Variables in Templates
Environment variables are key-value pairs available within your Cluster, used for configuration and secret management.
Examples of uses:
- Storing API keys
- Defining file paths
- Specifying service credentials
Predefined Variables by Tensor One:
TENSORONE_CLUSTER_ID
: Unique identifier of your ClusterTENSORONE_API_KEY
: API key for making calls within the ClusterTENSORONE_CLUSTER_HOSTNAME
: Hostname of the Cluster instance
Leverage environment variables to securely manage runtime configuration without hardcoding values into your application.