Triton CLI Basic Tutorial
Created by Admin at 20-05-2020 14:49:23 +0200In this Triton CLI Basic Tutorial we will go over the setup and installation of Triton CLI, Triton profiles, Triton container creation and -container management. You can even use a Cloud Container with the Ubuntu image, created on our website, to follow this tutorial.
Note: every line that has a '~#' at the start is a command that you need to execute in Linux.
Triton CLI setup
In the following steps we will update the system, install Node.js and update npm in order for Triton CLI to be used correctly.
Execute the given commands below for a general update:
~# sudo apt-get update ~# sudo apt-get dist-upgrade ~# sudo apt-get install -y build-essential
Install Node.js to run Javascript programs. Node.js is a run-time environment which include everything you need to execute a program written in Javascript. Almost all Javascript programs require Node.js, including Triton CLI:
DOWNLOAD NODE/NPM: ~# curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - INSTALL NODE/NPM: ~# sudo apt-get install -y nodejs CHECK NODE/NPM VERSION: ~# node -v UPDATE NPM: ~# npm update CHECK NPM VERSION: ~# npm -v
Install Triton CLI:
INSTALL TRITON CLI: ~# sudo npm install --unsafe-perm -g triton CHECK TRITON CLI VERSION: ~# triton --version
It's recommended to keep Ubuntu, Node.js, NPM & Triton CLI up to date.
Triton profiles
Triton profiles are used to create and 'manage' containers. Your triton profile has a Triton account, which contains the containers. If you delete your Triton profile, you will not lose any containers, you can simply create a new Triton profile and use your Triton account to access your containers.
Prerequisites for a working connection:
1. Cloudcontainers account: A cloudcontainers account is needed for storing your Triton account information, billing information and SSH key distribution among Initworks' data centers.
2. SSH key: in order for Triton to connect to your account, you need an SSH key linked to your account. You can add an SSH key on your cloudcontainers website account under 'Hello, [name]' -> 'settings'. Give the key a name and paste the entire public key in the 'Key value' field, like so:
For more information on the use of SSH keys with Cloudcontainers, see the tutorial on How to use SSH authentication keys on Cloud Containers.
Create a new profile
CREATING A NEW PROFILE: ~# triton profile create You'll be prompted the following information: Input name: Your profile name, this can be anything to your linking. CloudAPI endpoint URL: This URL will be provided by Cloudcontainers on this page. Account login name: Your username used on your Cloudcontainers account. KeyId: The KeyId of the SSH key linked to your Cloudcontainers account. Continue?: N. No for now, this is only for people who are going to use docker containers. |
Different profile
GET A LIST OF ALL CREATED PROFILES: ~# triton profile list SELECTING NEW PROFILE: ~# triton profile set [PROFILE NAME] |
Delete a profile
Deleting a profile will not result in the loss of data. Containers are linked to your Triton account, not to your Triton profiles.
DELETE A PROFILE: ~# triton profile delete [PROFILE NAME] You'll be asked for confirmation: y |
Triton containers
Containers are the main topic of this tutorial and many other tutorials on blog.cloudcontainers.net. If you wish to learn more on the subject of Cloudcontainers, more information can be found here.
Creating containers with Triton CLI
CREATING A NEW CONTAINER WITH TRITON COMMAND: ~# triton instance create -w --name=[CONTAINER NAME] [IMAGE] [PACKAGE] Option -w let's you wait for the creation of the container to complete and show its status Option --name let's you name the container, not passing it will generate a name serverside. Argument image is the container's image Argument package is your hosting package, learn more about different packages and pricing here. LIST ALL POSSIBLE IMAGES: ~# triton image list LIST ALL POSSIBLE PACKAGES: ~# triton package list or with filtering: ~# triton package list -o [FILTERS] EXAMPLE CONTAINER CREATION COMMAND: ~# triton instance create -w --name=my_container ubuntu-16.04_120@1.2.0 nrm_2g_30g |
Starting your container
The 'start' container command is not necessary after creating a container, but manually starting a container can be done by the following command:
STARTING A CONTAINER: ~# triton instance start -w [CONTAINER NAME] Option -w let's you wait until the command is completed and update you on its status. |
Stopping your container
Stopping your container can be done with the following command and will result in the remote host cancelling all active connections:
STOPPING A CONTAINER: ~# triton instance stop -w [CONTAINER NAME] Option -w let's you wait until the command is completed and update you on its status. |
Rebooting your container
If you would like to reboot your container, this can be done with the following command:
REBOOTING A CONTAINER ~# triton instance -w reboot [CONTAINER NAME] Option -w let's you wait until the command is completed and update you on its status.Note that any connection to the container will be closed by the remote host if a reboot is executed |
Deleting/Destroying your container
Running containers which are not being used may result in unwanted costs, thus you may want to destroy a container. It is advised that you make absolutely sure that no operations are dependent on the functionality of the container you wish to destroy. If you are sure that the container can be destroyed, then a container can be destroyed with the following command:
Warning: On older Triton versions there's no confirmation after the command and your container will be destroyed immediately.
DESTROYING A CONTAINER: ~# triton instance delete -w [CONTAINER NAME] Option -w let's you wait until the command is completed and update you on its status. You'll be asked for confirmation: y |
Function Help
If you want some more information concerning a function, simply type the 'help' tag before your function of choice, like so:
SOME EXAMPLES FOR USING A HELP TAG: ~# triton help instance ~# triton instance help rename ~# triton instance help resize |
Find out more about using containers on the Triton CLI Advanced Tutorial.
Comments are turned off.