Joyent hybrid cloud: Triton Compute Service and Triton DataCenter integration

Modified: 05 Jan 2018 21:24 UTC

The software that powers the Triton Compute Service is available for on-premises private cloud installations. This fact makes deployment of hybrid cloud solutions extremely easy as customers are able to utilize the same API, packages, and images for both Triton Compute Service and Triton DataCenter. This capability makes it simple to deploy applications to meet a variety of technical and business requirements such as:

This page describes describes how to integrate private clouds powered by Triton DataCenter with Joyent's Triton Compute Service and includes the following topics:

CloudAPI - switching between clouds

CloudAPI is the API you use to interact with the Triton data centers. Using CloudAPI, you can:

CloudAPI is implemented as a REST API, and you can be accessed in several different ways:

CloudAPI's node.js SDK and REST API simplify the programming required to interact with both the Triton Compute Service and your own private cloud powered by Triton DataCenter. Of course, the CLI lets you use command line tools to perform every action available in the SDK and in the REST API.

Setup requirements

If you have not done so already, you should install and test the CloudAPI CLI tools by following the steps outlined in the CloudAPI Getting Started Guide.

ClouadAPI connection variables

There are three variables used by CloudAPI that can either be set in the environment or passed through on the command line. Please note that passing a variable on the command line will override a variable set in the environment.

Env Variable Flag Value Example
SDC_ACCOUNT --account The username of the account to use when connecting to Triton. jay.schmidt
SDC_KEY_ID --keyId The ssh fingerprint of the ssh key to use for authentication against Triton. 6a:95:13:1d:d1:6e:52:69:11:16:1a:46:4a:8d:c1:7e
SDC_URL --url The url for the API endpoint for the Triton installation you are using. https://us-east-1.api.joyent.com

CloudAPI examples

In the examples below, the "jay.schmidt" user has an account in Triton Compute Service as well as an account in a Triton DataCenter-powered private cloud running locally. Both accounts have the same username and are using the same SSH key.

Using the CloudAPI tools, it's very easy to switch between the two Cloud Environments by merely changing the URL provided on the command line.

Viewing datacenters - Joyent public cloud and private cloud

In the two examples below, note the only change to go between the Joyent public cloud and the Private Cloud is the adjustment of the --url flag on the command line.

Note: In the event that SSH keys or Account Names differ between the Joyent public cloud and the private cloud, one merely has to adjust the --account and --keyId flags as required.

joymac$ sdc-listdatacenters --account jay.schmidt --keyId 6b:95:03:3d:d3:6e:52:69:01:96:1a:46:4a:8d:c1:7e --url https://us-west-1.api.joyent.com
{
  "eu-ams-1": "https://eu-ams-1.api.joyent.com",
  "us-west-1": "https://us-west-1.api.joyent.com",
  "us-sw-1": "https://us-sw-1.api.joyent.com",
  "us-east-1": "https://us-east-1.api.joyent.com"
}
joymac$ sdc-listdatacenters --account jay.schmidt --keyId 6b:95:03:3d:d3:6e:52:69:01:96:1a:46:4a:8d:c1:7e --url https://192.168.212.103
{
  "cak-1": "https://cloudapi.cak-1.sdc.joyent.us"
}
Parsing CloudAPI data

The CloudAPI tools return JSON, which can be parsed via the node utility json formerly jsontool. For example, to list just the UUID and the instance alias for all instances / virtualmachines that the "jay.schmidt" user currently owns in the Joyent US-WEST-1 Data Center and in the Private Cloud we can set the --url flag appropriately and then pipe the output to json to parse out just the information we are interested in.

joymac$ sdc-listmachines --account jay.schmidt --keyId 6b:95:03:3d:d3:6e:52:69:01:96:1a:46:4a:8d:c1:7e --url https://us-west-1.api.joyent.com | json -ag id name
b4bea5b1-6d14-480b-b90a-fb703faa2e2a jasmysql01
8a02db82-bce1-e189-bb8d-9c062abaa112 slb-ssc
d29527e9-28ce-ea0c-e391-8d9e58284c77 jasdevtier
baad8d1a-0eba-cc0d-ddf9-f61830cf4d81 testjas
joymac$ sdc-listmachines --account jay.schmidt --keyId 6b:95:03:3d:d3:6e:52:69:01:96:1a:46:4a:8d:c1:7e --url https://192.168.212.103 | json -ag id name
3ba2d253-6a5b-66af-aca7-f7083bf370d3 salt
1c052404-8ff1-ca48-df0b-c79a63395137 win-kvm-01
51feb7ac-cf74-ce58-9218-c81b074a11d3 win2003
0aad7771-bb2d-c30b-9d1f-e966763d82ac blue
2fb2a957-ed48-c852-abee-b4205200caf6 periwinkle
70140821-b30f-4f97-ea63-ef633f837561 paprika
ea5e2e5b-ee3f-c5f6-a87d-e8f11444b16c wordpress
f1c715c0-877e-4e80-bfe7-81cf7007d655 pineapples
e6243179-9729-4208-fcec-8be9e75c2566 duncan
b52bbd74-966f-687a-ed3b-9e01effcba50 banquo
Building applications on CloudAPI

The ease by which you can switch between managing your public cloud-based instances and your Triton DataCenter-based instances lends itself to the creation of applications that enable users to seamlessly manage their infrastructure no matter where it is physically located.

Applications - no matter if they are written against the REST API, using the node.js SDK, scripted with the CLI tools, or written using a combination of all three - can provision, manage, and report on either environment with a simple change of environment variables or flags.

CloudAPI next steps

It is highly recommended you read through the complete documentation on CloudAPI. This can be found at Joyent CloudAPI Documentation. The documentation covers the CLI tools, the REST API, and the node.js SDK. Additionally, source code (including a test suite) can be forked and browsed at the following link node-smartdc on Github.

Questions or issues for Triton customers should be raised via the support channel at help.joyent.com

Docker - switching between clouds

It's possible to setup docker profiles for both Triton Compute Service and your Triton DataCenter-powered private cloud. This requires configuring the triton CLI tool profiles for all the data centers you wish to connect to, including Triton Compute Service data centers and your Triton DataCenter-powered private cloud data centers.

Each Triton CLI profile includes all the connection details for a specific user connecting to a specific data center. Once the profiles are set, configuring Docker to use that profile is as simple as:

# Set environment variables for the current Triton profile:
eval $(triton env)

# Set environment variables for a specified Triton profile:
eval $(triton env <profile name>)

For example:

I have a profile named private-cak-1 to connect to a Triton DataCenter private data center I operate:

eval $(triton env private-cak-1)

And I also have a profile named public-us-east-1 to connect to Joyent's Triton Compute Service US-East-1 data center:

eval $(triton env public-us-east-1)

Test against my private cloud, the private-cak-1 profile:

laptop$ eval $(triton env private-cak-1)
laptop$ docker info
Containers: 23
Images: 33
Storage Driver: sdc
 SDCAccount: jay.schmidt
Execution Driver: sdc-0.3.0
Kernel Version: 3.12.0-1-amd64
Operating System: SmartDataCenter
Name: cak-1
ID: 29e15ccd-e90b-4ceb-8680-d30421f420b5

Now switch to US-EAST-1:

laptop$ eval $(triton env public-us-east-1)
laptop$ docker info
Containers: 1
Images: 35
Storage Driver: sdc
 SDCAccount: jay.schmidt
Execution Driver: sdc-0.3.0
Kernel Version: 3.12.0-1-amd64
Operating System: SmartDataCenter
Name: us-east-1
ID: 92b0cf3a-82c8-4bf2-8b74-836d1dd61003

Image management - transferring images from Triton Compute Service to a private cloud

Custom Images created in Triton Compute Service via the procedure described in the creating custom images document can be exported from Triton Compute Service and imported into your Triton DataCenter-powered private cloud. This provides you with the ability to use the same image with your customizations (such as software, directory layout, etc) in both your private cloud as in Triton Compute Service.

For more information on this, including the necessary steps to follow please see using Triton Compute Service custom images in a private cloud.