triton) uses CloudAPI to manage infrastructure in Triton data centers. Many of the tasks that you can perform through the portal are also possible with Triton CLI, including:
tritonusing Node Package Manager (
npm). In the following example, the
npminstall command sets a global flag (
-g) that makes
npmmodules accessible to all users. This flag is mandatory when installing
sudo. Remove it from the command to install
.bash_profile. On macOS, this file should be in your home directory.
tritonrequired environment variables that began with
SDC_ACCOUNT. As of January 2018, the SDC environment variables are still supported by
triton profile createcommand prompts you to answer a series of questions to configure your profile. The following example shows the steps for Triton user
triton infooutput above shows that myuser's account already has two instances running.
tritoncommands to make a copy of the
us-sw-1profile for each of the data center urls. Copy this snippet below to add the new profiles (in this case, based on a profile named 'env'):
triton profilesagain to check to see that it worked. We should have a new profile for each data center listed in
triton profile setcommand:
tritoninstalled and configured, we can jump right into provisioning instances. Here's an example of provisioning an infrastructure container running Ubuntu. Think of infrastructure containers like virtual machines, only faster and more efficient.
triton instance createand we'll talk about the pieces after:
triton sshto connect to it. This is an awesome addition to our tools because it means that we don't need to copy SSH keys or even lookup the IP address of the instance.
triton instance create -w --name=server-1 ubuntu-14.04 g4-highcpu-1G. That command has three parameters:
-wto wait the instance to be created
ubuntu-14.04as our image
g4-highcpu-1Gas our package
triton imagesto list the images and add
name=~ubuntuto do a substring search for Ubuntu. It's sorted by published date so usually we'll pick the most recent. Today we'll choose 14.04 because it has wider support.
g4-highcpu-<size>), general purpose (
g4-general-<size>), memory optimized (
g4-highram-<size>), and storage optimized (
k4-highcpu-<kvm|bhyve>-<size>), general purpose (
k4-general-<kvm|bhyve>-<size>), memory optimized (
k4-highram-<kvm|bhyve>-<size>), and storage optimized (
triton packageto search for a package with 1 gigabyte of RAM. We'll pick the
--scriptfile installs Couchbase, and the
cat /root/couchbase.txtto show the address of the Couchbase dashboard.
tritontool does not wait for tasks to finish. This is great because it means that your commands return control back to you very quickly. However sometimes you'll need to wait for a task to complete before you do the next one. When this happens you can wait by using either the
-wflags, or the
triton instance waitcommand. In the example above we used
--waitso that the instance would be ready by the time the
triton sshcommand ran.
user-scriptthat we ran is part of the metadata.
json KEYNAME. For example you could get the IP address of an instance like this:
triton instance deletecommand:
triton instance deletecommand removes all of your instances regardless of whether they running or stopped.
docker, note that this is equivalent to using
docker rm -f $(docker ps -aq)to force the deletion of all your containers. If you want to remove all of your instances, using
triton instance deletemight be faster since it deletes the instances in parallel.