general-purpose runtime class, which runs standard container images without changes, and the public docker.io/traefik/whoami image, which replies to each request with details about the request.
Compute is in preview, and the
v1alpha API can change. Your project needs approved access to Compute before you can deploy, and Datum reviews access requests manually.Before you begin
- Create a Datum Cloud account, an organization, and a project. For more information, see Account setup.
- Install
datumctland rundatumctl login. For more information, see the datumctl quickstart. - Make sure that you have permission to create compute and networking resources in the project, for example, through the Compute Admin and Network Admin roles.
- Install
curlto test the URL.
Set up your project
Complete these steps once for each project that runs Compute workloads. Other Compute guides assume that you’ve completed them.1
Select your project
Compute commands run against a project. To make your project the active context, run the following command:Replace the following:
ORG_ID: the ID of your organization.PROJECT_ID: the ID of your project.
datumctl ctx use with no arguments.2
Install the compute plugin
The For more information about plugins, see Using plugins.
compute commands come from a plugin in the official Datum catalog. To install the plugin, run the following command:3
Request access to Compute
To request access for your project and wait for a decision, run the following command:Datum approves requests manually, so the wait can outlast the command’s default 30-minute timeout. If the command times out, run
datumctl compute access to check the state of your request. Continue when the status is Active.Deploy and publish a workload
1
Deploy the workload
To deploy the image to Dallas (The flags do the following:The rollout table adds a row each time the location’s progress changes, so your rows can differ.
us-central-1) and publish it on a public URL, run the following command:--image: the container image to run. Compute requires the registry host in the image reference, such asdocker.io.--runtime-class=general-purpose: runs the image as a standard container in a lightweight virtual machine. Without this flag, Datum uses theunikernelclass, which needs a specially packaged image.--location=us-central-1: runs one Instance in Dallas.--http-port=80: attaches Datum’s ALB to the workload and publishes port80of the container on it.
- The first time you deploy in a project, the command asks whether to create a network named
default. Entery. - The command prints a plan and asks
Apply? (Y/n). Entery.
DURATION is how long the rollout took.The last line is the hostname of the ALB that --http-port attached to the workload. Your hostname is different. The command also saves the workload definition to workload.yaml in the current directory.2
Send a request
To call your workload, run the following command:Replace If
WORKLOAD_URL with the URL from the last line of the deploy output, such as https://stark-raven-b7k2m.datumproxy.net.The response lists the Instance’s hostname and IP addresses, followed by the request that the Instance received. The request section is similar to the following:curl reports that it can’t resolve the host, wait a minute and try again. A new hostname can take a few minutes to resolve.3
See your workload and Instances
To list the workloads in your project, run the following command:The output is similar to the following:To list the workload’s Instances, run the following command:The output is similar to the following:The
INTERNAL IP column shows the Instance’s private IPv6 address on the default network.Clean up
To avoid using your project’s compute quota, delete the resources that you created by following these steps:-
To delete the workload, its Instance, and its ALB, run the following command:
- Review the summary that the command prints.
-
Enter
yto confirm. The command printsworkload/hello deleted. -
Optional: If you don’t plan to deploy more workloads, delete the
defaultnetwork:
What’s next
- To learn what else you can set on a container workload, see Run a container image.
- To package your own app as a fast-starting unikernel, see Build and deploy a unikernel.
- To run in more locations or with more Instances, see Placement and scaling.
- To serve the workload on your own domain, see Publish a workload.