The Control Plane CLI offers developers the ability to containerize their code and push the resulting image to their Org's private image registry. The image registry is scoped to the Org and available for use by all Workloads within the Org. Along with the console, the CLI can be used to deploy the image to the cloud by configuring a GVC and Workload.
This quick start will demonstrate how to:
Decompression helper commands:
|macOS||gunzip cpln_app.tgz && open cpln_app.tar|
|Linux & Windows 10||tar -xvf cpln_app.tgz|
cpln_appdirectory to containerize the application:
copycpln image build --name quick-start-4:0.1 --push --org ORG_NAME
This command will containerize the application locally using Docker and push the image to your Org's private image registry.
The image name will be
quick-start-4 and the tag is
0.1. You can build and push multiple versions with the same name and
different tags (e.g., 0.2, 0.3, etc.).
Notice that the application doesn't contain a
cpln image build command uses Buildpacks
to scan the application and automatically build the image. If your application has an existing
the command will use that file to containerize the application.
Review the Push an Image guide for additional details.
Execute the following command to create a new GVC mapped to two different cloud providers/locations:
copycpln gvc create --name quick-start-4 --location aws-us-west-2 --location gcp-us-east1 --org ORG_NAME
To view the list of available locations, execute the command:
cpln location get --org ORG_NAME.
Review the Create a GVC guide for additional details.
In this step, you will configure a new Workload for the application.
Execute the following command to create a new Workload.
--name flag, choose an appropriate name for the workload. It will be used when generating the endpoint URL.
--port flag, use port 8080 which is the port the application exposes.
copycpln workload create --name show-env-variables --image //image/quick-start-4:0.1 --port8080 --public --gvc quick-start-4 --org ORG_NAME
The output from this command will show the new Workload name and the endpoint URL. The endpoint is using the domain name that is set on the GVC. Notice that the URL is HTTPS. A TLS certificate was generated and configured for the endpoint. The platform automatically performs TLS termination and port translation from 443 to 8080.
Allow a few minutes for the workload to deploy, then copy the endpoint URL and paste it into a browser. The output will display the
environment variables for the running process. The variables that are prefixed with
CPLN_ are added by Control Plane and can be
used by your application.
For example, the variable
CPLN_LOCATION will be the location where the Workload was served from. Since we configured the GVC with two
locations, this variable can change depending on the location of the caller since the endpoint URL is DNS geo-routed to the nearest
For more details on the built-in variables, visit the Workload Environment Variables reference page.
This quick start demonstrated how to deploy an application, from code to a deployed Workload, in just a couple of steps. The sample application targeted Node.js, but you can deploy any language that can be containerized (e.g., Java, .NET, Go, etc.).
In the previous quick start, you used the console to deploy an application, here you exercised the CLI to perform similar actions. All Control Plane resources, such as GVCs and Workloads, can be created/modified either using the console or the CLI.