Skip to main content

Practical Examples

Welcome to the CLI Examples Section of the Ori Global Cloud Documentation! Here, you'll find a rich collection of real-world examples showcasing the versatility and power of the ogc command-line interface. These examples are designed to illustrate how to accomplish a variety of tasks efficiently and effectively using Ori's CLI.

Whether you're seeking guidance on resource management, application deployment, or automation workflows, this section provides hands-on demonstrations with step-by-step instructions and command snippets. Each example is crafted to help you grasp the core concepts and practical usage of ogc in different scenarios.

No matter your level of experience with command-line interfaces, our CLI Examples Section is your go-to resource for mastering ogc and making the most out of Ori's cloud platform. Let's dive into these examples and empower you to streamline your cloud operations with ease and confidence.

Listing Resources

The `list`` sub-command is a powerful tool for administrators to gain a comprehensive overview of all the resources that have been onboarded or created onto their organization within the Ori Global Cloud platform. By simply running this command, users can quickly retrieve a detailed list of Projects, Clusters, Packages, Deployments and other resources such as Applications and Containers, including essential information such as names, statuses, and relevant metadata. This capability simplifies the management og resources in OGC, allowing administrators to monitor the health and status of multiple resources at a glance. Whether you're overseeing a handful of resources or an extensive infrastructure, the ogc list command empowers you to maintain visibility and control over your entire cluster ecosystem with ease.

Let's look at a few example commands and their output.

Listing Clusters

user@MacBook-Pro ~ % ogc clusters list
ID                                   | Name          | Type | Status
de37aaaa-2fc8-481c-a33e-49077ed92741 | linode-JP     | BYOC | Up
09b5eeee-915e-48b9-beb1-09c4bb91a925 | gcp-cluster   | BYOC | Up
bd062222-efa2-41cb-8d7f-12a7780edfab | linode-EU     | BYOC | Up
80f41111-ca51-4f88-98fd-aa8b0cafe787 | aws-cluster-4 | CYOC | Up
94695555-f002-4373-9e8a-8271af346924 | gcp-gpu       | BYOC | Up

Listing Projects

user@MacBook-Pro ~ % ogc projects list
ID                                   | Name
3819cccc-22b9-41c8-94f1-e159ff8473d0 | Alpha
2ee02222-576d-4c19-9c27-bb9487289584 | Sigma
68ad2222-421c-45dd-8774-d9414062fa64 | Beta
c8251111-0b91-44cc-b4e5-f82dd329bbfd | Machine Learning
a5f41111-8579-4dd9-a9c2-5d0d52dca27b | Blockchain
5a257777-9e2c-44d5-a3a3-67c86393c277 | Banking
9739eeee-3a47-4f62-b387-572f8263d969 | Retail
ca276666-650b-4cb0-babd-d2d4b9733893 | Multi-cloud Apps

Listing Packages

To list Packages you need to specify the id of the project where your Packages are located.

user@MacBook-Pro ~ % ogc packages list -p ca276666-650b-4cb0-babd-d2d4b9733893
ID                                   | Name                                   | Project ID
f70eafec-69fc-4330-b2ba-697d296643e1 | Inventory Service (persistent storage)
1d9d82ee-4716-4d85-9df1-9e7670e44fb4 | Grafana - Prometheus (networking example)
77712a4a-f67b-4b86-96b3-7e13a94a1d74 | Financing Service (self-heal example)

Listing Applications & Containers

To list Applications and their Containers, you need to specify the Package which contains the Applications, or the Application to see its containers.

Here is an example on how to list Applications on a Package:

user@MacBook-Pro ~ % ogc applications list -p 1d9d82ee-4716-4d85-9df1-9e7670e44fb4 
ID                                   | Name          | Containers
9266d203-875e-46b4-bd8d-db96b715796d | Grafana FE    | grafana
8ccdc731-539d-4df1-9acd-809425bd2184 | Prometheus BE | prometheus

And if you need further details you can use the -x option in this case for json output.

user@MacBook-Pro ~ % ogc applications list -p 1d9d82ee-4716-4d85-9df1-9e7670e44fb4 -x json 
[
	{
		"id": "9266d203-875e-46b4-bd8d-db96b715796d",
		"displayName": "Grafana FE",
		"dnsName": "grafana-fe",
		"lastUpdated": "2023-09-06T09:00:51.223693Z",
		"packageId": "1d9d82ee-4716-4d85-9df1-9e7670e44fb4",
		"replicas": 1,
		"externalFqdn": "grafana-fe.example-package.multi-cloud-apps.sigma-robotics-ltd.dns.ori.cloud",
		"requiresRedeploy": false,
		"Containers": [
			{
				"id": "547bc871-1ee7-4071-8597-dcb0fd692ee2",
				"displayName": "grafana",
				"imageName": "docker.io/grafana/grafana-oss"
			}
		]
	},
	{
		"id": "8ccdc731-539d-4df1-9acd-809425bd2184",
		"displayName": "Prometheus BE",
		"dnsName": "prometheus-be",
		"lastUpdated": "2023-09-06T09:01:02.662388Z",
		"packageId": "1d9d82ee-4716-4d85-9df1-9e7670e44fb4",
		"replicas": 1,
		"internalFqdn": "prometheus-be.example-package.multi-cloud-apps.sigma-robotics-ltd.orinet.ori.cloud",
		"requiresRedeploy": false,
		"Containers": [
			{
				"id": "4dbb680e-7928-4d5a-ac34-cce082c771ed",
				"displayName": "prometheus",
				"imageName": "docker.io/prom/prometheus"
			}
		]
	}
]

For Containers it is similar:

user@MacBook-Pro ~ % ogc containers list -a 9266d203-875e-46b4-bd8d-db96b715796d 
ID                                   | Name    | Image Name                    | Image Tag
547bc871-1ee7-4071-8597-dcb0fd692ee2 | grafana | docker.io/grafana/grafana-oss | 

And with the -x option:

user@MacBook-Pro ~ % ogc containers list -a 9266d203-875e-46b4-bd8d-db96b715796d -x json
[
	{
		"id": "547bc871-1ee7-4071-8597-dcb0fd692ee2",
		"displayName": "grafana",
		"dnsName": "grafana",
		"imageName": "docker.io/grafana/grafana-oss",
		"imageTag": "",
		"imageRegistryId": "",
		"command": null,
		"args": null,
		"applicationId": "9266d203-875e-46b4-bd8d-db96b715796d",
		"lastUpdated": "2023-09-06T08:58:50.170787Z"
	}
]

Working with Packages and Deployments

You can get the details of a package by using the `get`` subcommand:

user@MacBook-Pro ~ % ogc packages get 1d9d82ee-4716-4d85-9df1-9e7670e44fb4                                                 
{
	"id": "1d9d82ee-4716-4d85-9df1-9e7670e44fb4",
	"displayName": "Grafana - Prometheus (example)",
	"dnsName": "example-package",
	"projectId": "ca2767f9-650b-4cb0-babd-d2d4b9733893",
	"lastUpdated": "2023-09-11T09:33:54.819937Z"
}

To deploy this Package do the following:

user@MacBook-Pro ~ % ogc deployments create -p ca2767f9-650b-4cb0-babd-d2d4b9733893 -k 1d9d82ee-4716-4d85-9df1-9e7670e44fb4
Deployment created: d36309f5-a9dc-4b9e-b961-efbbee1eeb1d

After a few seconds the package will be deployed and running. You can list all the Running deployments on the project with the following command:

user@MacBook-Pro ~ % ogc deployments list -p ca2767f9-650b-4cb0-babd-d2d4b9733893 | grep Running
d36309f5-a9dc-4b9e-b961-efbbee1eeb1d | Running | 1d9d82ee-4716-4d85-9df1-9e7670e44fb4 | ca2767f9-650b-4cb0-babd-d2d4b9733893
81bc1e5f-569a-4d38-ab5a-cbc5850ed668 | Running | 77712a4a-f67b-4b86-96b3-7e13a94a1d74 | ca2767f9-650b-4cb0-babd-d2d4b9733893

And you can Stop the deployment with:

user@MacBook-Pro ~ % ogc deployments stop d36309f5-a9dc-4b9e-b961-efbbee1eeb1d -p ca2767f9-650b-4cb0-babd-d2d4b9733893 -k 1d9d82ee-4716-4d85-9df1-9e7670e44fb4

And check its status with:

user@MacBook-Pro ~ % ogc deployments list -p ca2767f9-650b-4cb0-babd-d2d4b9733893 | grep d36309f5-a9dc-4b9e-b961-efbbee1eeb1d 
d36309f5-a9dc-4b9e-b961-efbbee1eeb1d | Stopped | 1d9d82ee-4716-4d85-9df1-9e7670e44fb4 | ca2767f9-650b-4cb0-babd-d2d4b9733893