update cli tools to use triton

This commit is contained in:
Marius Pana 2023-05-18 11:21:05 +03:00
parent f2bb54f247
commit 7d74b999aa
3 changed files with 102 additions and 105 deletions

View File

@ -1,104 +0,0 @@
# Spearhead Cloud CLI tool
> Last edit: Fri Oct 1 16:05:33 EEST 2021
The Spearhead Cloud CLI tool allows you to manage your Spearhead Cloud infrastructure. While the Cloud Portal is being developed this tool is the preferred method for managing your infrastructure.
> The Spearhead Cloud Portal will provide all of the functionality available via the spearhead cli tool.
The *spearhead* CLI tool can currently handle the following tasks:
* manage compute instances (containers and virtual machines)
* create, delete, resize, snapshot
* view Spearhead Cloud packages
* create, delete and manage Spearhead Cloud images
* view networks
* create and delete firewall rules
* view Spearhead Cloud Datacenter's
* management of your own account
* manage your SSH key(s)
## Install Spearhead Cloud CLI tool
The *spearhead* CLI tool can be installed via npm (Node Package Manager). This requires that you have a recent version of npm installed from [http://www.npmjs.org](http://www.npmjs.org).
Once you have npm installed just run the following command to configure the Spearhead Cloud CLI tool. Please note that on windows you need to use the global flag (-g).
> npm install -g spearhead
On some platforms you may be required to use sudo (sudo npm install ...).
## Environment Variables
On Windows, setting up these variables is required.
```
export SC_PROFILE="env"
export SC_URL="https://eu-ro-1.api.spearhead.cloud"
export SC_ACCOUNT="<SC_USERNAME>"
unset SC_USER
export SC_KEY_ID="$(ssh-keygen -l -f $HOME/.ssh/id_rsa.pub | awk '{print $2}')"
unset SC_TESTING
unset SC_PROFILE
```
These variables will configure the *spearhead* env profile for you.
## Spearhead Profiles
The *spearhead* CLI tool allows for the use of profiles to manage multiple Spearhead Cloud accounts. A profile contains your user details (username), a Spearhead Cloud Datacenter API URL and SSH key(s).
### Configure a Spearhead Cloud Profile
To configure a new Spearhead Cloud Profile have the name of the datacenter API endpoint ready and run the following command and answer the questions.
```
$ spearhead profile create
```
For more information about Profile, run ```spearhead profile --help``` command.
## Create an instance
Creating an instance is possible via the ```spearhead create``` command. You will first need to identify the image and package to assign to you new instance.
### Finding on image
To list all available images run ```spearhead imgs``` and you will be presented with a list of our available images.
### Finding a package
To list all available packages run ```spearhead pkgs``` and you will be presented with a list of our available packages.
Note that the names starting with **k** are KVM hardware virtual machines.
## Delete an instance
To remove an instance run ```spearhead delete <instance>``` command. Optionally you can use ```spearhead rm <instance>```. ```<instance>``` can be either an instance name, id or short id.
## Viewing instances
To view a list of all instances configured for your account run ```spearhead ls```.
```
$ spearhead ls
SHORTID NAME IMG STATE FLAGS AGE
c0fe5e19 code.alberta.internal ubuntu-16.04@20170403 running - 8w
f49f145e ns01 ubuntu-16.04@20170403 running - 7w
5940b249 agitated_turing 0227ae25 running D 2d
fb174b04 ncmysql ff8ecad5 running DF 2d
9adb0454 routeme ubuntu-16.04@20170403 running - 2d
64e8917b kubecon ubuntu-16.04@20170403 running - 2d
```
## Useful commands
#### wait
The ```spearhead``` tool does not wait for commands to finish, it will return control back to you quickly. There are situation where waiting for one thing to finish before starting another is useful. For such scenarios you can wait by using the ```--wait``` or ```-w``` flags or by using ```spearhead instance create wait``` command.
#### script
Another useful command is the ```--script``` flag which will run a user specified script at the end of provisioning.
Below is an example of using the ```--script``` flag.
```
spearhead instance create \
--name=some-instance \
7b5981c4 \
8b4fdd0b \
--wait \
--script=./myscrtip.sh
```
### instance details
To view all of your instance's details run ```spearhead instance get -j some-instance```. This will give you a full JSON blob of your instance details. You can optionally pipe the instance details output through the ```json``` command and parse or perform other operations.

101
en/docs/triton-cli.md Normal file
View File

@ -0,0 +1,101 @@
# Spearhead Cloud CLI tool
> Last edit: Fri Oct 1 16:05:33 EEST 2021
The primary method to manage your Spearhead Cloud infrastructure is by using the Triton CLI.
The *triton* CLI tool can currently handle the following tasks:
* manage compute instances (containers and virtual machines)
* create, delete, resize, snapshot
* view Spearhead Cloud packages
* create, delete and manage Spearhead Cloud images
* view networks
* create and delete firewall rules
* view Spearhead Cloud Datacenter's
* management of your own account
* manage your SSH key(s)
## Install Triton CLI tool
The *triton* CLI tool can be installed via npm (Node Package Manager). This requires that you have a recent version of npm installed from [http://www.npmjs.org](http://www.npmjs.org).
Once you have npm installed just run the following command to configure the Triton CLI tool. Please note that on windows you need to use the global flag (-g).
> npm install -g triton
On some platforms you may be required to use sudo (sudo npm install ...).
## Environment Variables
On Windows, setting up these variables is required.
```
export TRITON_PROFILE="env"
export SDC_URL="https://eu-ro-1.api.spearhead.cloud"
export SDC_ACCOUNT="<SDC_USERNAME>"
unset SDC_USER
export SCD_KEY_ID="$(ssh-keygen -l -f $HOME/.ssh/id_rsa.pub | awk '{print $2}')"
unset SDC_TESTING
```
These variables will configure the *triton* env profile for you.
## Spearhead Profiles
The *triton* CLI tool allows for the use of profiles to manage multiple Spearhead Cloud accounts. A profile contains your user details (username), a Spearhead Cloud Datacenter API URL and SSH key(s).
### Configure a Spearhead Cloud Profile
To configure a new Spearhead Cloud Profile have the name of the datacenter API endpoint ready and run the following command and answer the questions.
```
$ triton profile create
```
For more information about Profile, run ```triton profile --help``` command.
## Create an instance
Creating an instance is possible via the ```triton create``` command. You will first need to identify the image and package to assign to you new instance.
### Finding on image
To list all available images run ```triton imgs``` and you will be presented with a list of our available images.
### Finding a package
To list all available packages run ```triton pkgs``` and you will be presented with a list of our available packages.
Note that the names starting with **hvm** are KVM or byve hardware virtual machines while standard refers to Infrastructure Containers such as SmartOS Zones or LX Branded Zones.
## Delete an instance
To remove an instance run ```triton delete <instance>``` command. Optionally you can use ```triton rm <instance>```. ```<instance>``` can be either an instance name, id or short id.
## Viewing instances
To view a list of all instances configured for your account run ```triton ls```.
```
$ triton ls
SHORTID NAME IMG STATE FLAGS AGE
c0fe5e19 code.alberta.internal ubuntu-16.04@20170403 running - 8w
f49f145e ns01 ubuntu-16.04@20170403 running - 7w
5940b249 agitated_turing 0227ae25 running D 2d
fb174b04 ncmysql ff8ecad5 running DF 2d
9adb0454 routeme ubuntu-16.04@20170403 running - 2d
64e8917b kubecon ubuntu-16.04@20170403 running - 2d
```
## Useful commands
#### wait
The ```triton``` tool does not wait for commands to finish, it will return control back to you quickly. There are situation where waiting for one thing to finish before starting another is useful. For such scenarios you can wait by using the ```--wait``` or ```-w``` flags or by using ```triton instance create wait``` command.
#### script
Another useful command is the ```--script``` flag which will run a user specified script at the end of provisioning.
Below is an example of using the ```--script``` flag.
```
triton instance create \
--name=some-instance \
7b5981c4 \
8b4fdd0b \
--wait \
--script=./myscrtip.sh
```
### instance details
To view all of your instance's details run ```triton instance get -j some-instance```. This will give you a full JSON blob of your instance details. You can optionally pipe the instance details output through the ```json``` command and parse or perform other operations.

View File

@ -16,7 +16,7 @@ nav:
- Connecting to your instances: connecting.md - Connecting to your instances: connecting.md
- Spearhead Cloud Tools: - Spearhead Cloud Tools:
- Cloud Portal: cloud-portal.md - Cloud Portal: cloud-portal.md
- Spearhead CLI: spearhead-cli.md - Spearhead CLI: triton-cli.md
- Spearhead Docker CLI: docker/spearhead-docker-cli.md - Spearhead Docker CLI: docker/spearhead-docker-cli.md
- Docker: - Docker:
- Docker Remote API implementation for Spearhead Cloud: docker/docker-remote-api.md - Docker Remote API implementation for Spearhead Cloud: docker/docker-remote-api.md