Clusters
Manage Cluster Templates
You can explore Templates managed by Tensor One and Community Templates in the Explore section of the Web interface.
You can explore Templates managed by you or your team in the Templates section of the Web interface.
Learn to create your own Template in the following section.
Creating a Template
Templates are used to launch images as a Cluster: within a template, you define the required container disk size, volume, volume path, and ports needed.
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
Environment variables in Tensor One templates are key-value pairs that are accessible within your Cluster. Define a variable by setting a name with the key
and then what it should contain with the value
.
Use environment variables to pass configuration settings and secrets to your container. For example, environment variables can store the path to a database or API keys used by your application.
Tensor One also provides a set of predefined environment variables that provide information about the Cluster, such as the unique identifier for your Cluster (TENSORONE_CLUSTER_ID
), the API key used to make Tensor One API calls to the specific Cluster (TENSORONE_API_KEY
), the name of the host server the Cluster is running on (TENSORONE_CLUSTER_HOSTNAME
), and more.