2015-09-01 20:55:39 +03:00
|
|
|
# Triton
|
2015-08-26 23:09:40 +03:00
|
|
|
|
2015-09-06 02:43:40 +03:00
|
|
|
![logo](https://www.joyent.com/content/01-home/triton-logo.svg)
|
|
|
|
|
2015-09-01 20:55:39 +03:00
|
|
|
`triton` is a CLI tool for Joyent's Triton (a.k.a. SmartDataCenter), either for
|
|
|
|
on-premises installations of Triton or Joyent's Public Cloud
|
|
|
|
(<https://my.joyent.com>, <http://www.joyent.com/products/compute-service>).
|
2014-02-07 23:21:24 +02:00
|
|
|
|
2015-09-06 02:43:40 +03:00
|
|
|
**This project aims to replace
|
|
|
|
[node-smartdc](https://github.com/joyent/node-smartdc) as both the API
|
|
|
|
client library for triton ([cloudapi](https://apidocs.joyent.com/cloudapi/))
|
|
|
|
and the command line tool**
|
2015-07-26 08:46:24 +03:00
|
|
|
|
2015-09-01 20:55:39 +03:00
|
|
|
## Installation
|
2014-02-07 23:21:24 +02:00
|
|
|
|
|
|
|
1. Install [node.js](http://nodejs.org/).
|
2015-08-25 21:49:46 +03:00
|
|
|
2. `npm install -g git://github.com/joyent/node-triton`
|
2014-02-07 23:21:24 +02:00
|
|
|
|
2015-09-06 02:43:40 +03:00
|
|
|
Verify it installed and is on your PATH:
|
2014-02-07 23:21:24 +02:00
|
|
|
|
2015-08-25 21:49:46 +03:00
|
|
|
$ triton --version
|
2015-09-06 02:43:40 +03:00
|
|
|
joyent-triton 1.0.0
|
|
|
|
|
|
|
|
## Setup
|
2014-02-07 23:21:24 +02:00
|
|
|
|
2015-09-06 02:43:40 +03:00
|
|
|
Before you can use the CLI you'll need a Joyent account, an SSH key uploaded
|
2015-08-25 21:49:46 +03:00
|
|
|
and `triton` configured with those account details.
|
2014-02-07 23:21:24 +02:00
|
|
|
|
2015-09-06 02:43:40 +03:00
|
|
|
1. Create a Joyent Public Cloud account here https://www.joyent.com/public-cloud
|
|
|
|
2. Upload an SSH key (instructions on the site above)
|
|
|
|
3. Set the proper environmental variables (instructions also above)
|
|
|
|
|
|
|
|
Example environmental variables
|
2014-02-07 23:21:24 +02:00
|
|
|
|
2015-09-06 02:43:40 +03:00
|
|
|
SDC_URL=https://us-east-3b.api.joyent.com
|
|
|
|
SDC_ACCOUNT=dave.eddy@joyent.com
|
|
|
|
SDC_KEY_ID=04:0c:22:25:c9:85:d8:e4:fa:27:0d:67:94:68:9e:e9
|
2014-02-07 23:21:24 +02:00
|
|
|
|
2015-09-01 20:55:39 +03:00
|
|
|
## Example
|
2014-02-07 23:21:24 +02:00
|
|
|
|
2015-09-06 02:43:40 +03:00
|
|
|
List instances
|
|
|
|
|
|
|
|
$ triton instances
|
|
|
|
SHORTID NAME IMG STATE PRIMARYIP AGO
|
|
|
|
|
|
|
|
We have no instances created yet, so let's create some. In order to create
|
|
|
|
an instance we need to specify two things: an image and a package. An image
|
|
|
|
represents what will be used as the root of the instances filesystem, and the
|
|
|
|
package represents the size of the instance, eg. ram, disk size, cpu shares,
|
|
|
|
etc. More information on images and packages below - for now we'll just use
|
|
|
|
a basic combo of SmartOS 64bit and a small 128M ram package.
|
|
|
|
|
|
|
|
|
|
|
|
### XXX 1. show create, 2. show instances again, 3. show ssh'ing in, 4. explain images and packages
|
|
|
|
|
2015-08-26 23:09:40 +03:00
|
|
|
Get a quick overview of your account
|
|
|
|
|
|
|
|
$ triton info
|
2015-09-06 02:43:40 +03:00
|
|
|
login: dave.eddy@joyent.com
|
|
|
|
name: Dave Eddy
|
|
|
|
email: dave.eddy@joyent.com
|
|
|
|
url: https://us-east-3b.api.joyent.com
|
|
|
|
totalDisk: 8.5 GiB
|
|
|
|
totalMemory: 366.2 MiB
|
|
|
|
instances: 3
|
|
|
|
running: 2
|
|
|
|
stopped: 1
|
2015-08-26 23:09:40 +03:00
|
|
|
|
|
|
|
See running instances
|
|
|
|
|
|
|
|
$ triton instances
|
|
|
|
ID NAME STATE TYPE IMG MEMORY DISK AGO
|
|
|
|
908a781b-e4c8-4291-dcf5-b0fcbcc0cb8a machine-1 stopped smartmachine 5c7d0d24-3475-11e5-8e67-27953a8b237e 128 3072 2h
|
|
|
|
7807f369-79eb-ebe9-85f6-db3017a75f0f machine-2 running smartmachine 5c7d0d24-3475-11e5-8e67-27953a8b237e 128 3072 2h
|
|
|
|
a2d537b4-feb1-c530-f1ff-e034eb73adaa machine-3 running smartmachine 5c7d0d24-3475-11e5-8e67-27953a8b237e 128 3072 2h
|
|
|
|
7db6c907-2693-42bc-ea9b-f38678f2554b machine-4 running smartmachine 5c7d0d24-3475-11e5-8e67-27953a8b237e 128 3072 2h
|
|
|
|
8892b12f-60e9-c4ba-f0f8-a4ca9714ea9c machine-5 running smartmachine 5c7d0d24-3475-11e5-8e67-27953a8b237e 128 3072 2h
|
2014-02-20 05:52:58 +02:00
|
|
|
|
2015-08-26 23:09:40 +03:00
|
|
|
Connect to an instance over SSH
|
2014-02-20 05:52:58 +02:00
|
|
|
|
2015-08-26 23:09:40 +03:00
|
|
|
$ triton ssh machine-4
|
|
|
|
Last login: Wed Aug 26 17:59:35 2015 from 208.184.5.170
|
|
|
|
__ . .
|
|
|
|
_| |_ | .-. . . .-. :--. |-
|
|
|
|
|_ _| ;| || |(.-' | | |
|
|
|
|
|__| `--' `-' `;-| `-' ' ' `-'
|
|
|
|
/ ; Instance (base-64 15.2.0)
|
|
|
|
`-' https://docs.joyent.com/images/smartos/base
|
|
|
|
|
|
|
|
[root@7db6c907-2693-42bc-ea9b-f38678f2554b ~]# uptime
|
|
|
|
20:08pm up 2:27, 0 users, load average: 0.00, 0.00, 0.01
|
|
|
|
[root@7db6c907-2693-42bc-ea9b-f38678f2554b ~]# logout
|
|
|
|
Connection to 165.225.169.63 closed.
|
|
|
|
|
|
|
|
Or non-interactively
|
|
|
|
|
|
|
|
$ triton ssh machine-4 uname -v
|
|
|
|
joyent_20150826T120743Z
|
|
|
|
|
|
|
|
|
2015-09-04 10:09:19 +03:00
|
|
|
## Bash completion
|
|
|
|
|
|
|
|
You can quickly source `triton` bash completions in your current
|
|
|
|
shell with:
|
|
|
|
|
|
|
|
source <(triton completion)
|
|
|
|
|
|
|
|
For a more permanent installation:
|
|
|
|
|
|
|
|
triton completion >> ~/.bashrc
|
|
|
|
|
|
|
|
# Or maybe:
|
|
|
|
triton completion > /usr/local/etc/bash_completion.d/triton
|
|
|
|
|
|
|
|
|
2015-09-01 20:55:39 +03:00
|
|
|
## node-triton differences with node-smartdc
|
2014-02-21 01:45:15 +02:00
|
|
|
|
2015-09-06 02:43:40 +03:00
|
|
|
- There is a single `triton` command instead of a number of `sdc-*` commands.
|
2014-02-21 01:45:15 +02:00
|
|
|
- The `SDC_USER` envvar is accepted in preference to `SDC_ACCOUNT`.
|
|
|
|
|
2014-02-20 05:52:58 +02:00
|
|
|
|
2015-09-01 20:55:39 +03:00
|
|
|
## cloudapi2.js differences with node-smartdc/lib/cloudapi.js
|
2014-02-20 05:52:58 +02:00
|
|
|
|
|
|
|
The old node-smartdc module included an lib for talking directly to the SDC
|
2015-09-06 02:43:40 +03:00
|
|
|
Cloud API (node-smartdc/lib/cloudapi.js). Part of this module (node-triton) is a
|
2014-02-20 05:52:58 +02:00
|
|
|
re-write of the Cloud API lib with some backward incompatibilities. The
|
|
|
|
differences and backward incompatibilities are discussed here.
|
|
|
|
|
|
|
|
- Currently no caching options in cloudapi2.js (this should be re-added in
|
|
|
|
some form). The `noCache` option to many of the cloudapi.js methods will not
|
|
|
|
be re-added, it was a wart.
|
|
|
|
- The leading `account` option to each cloudapi.js method has been dropped. It
|
|
|
|
was redundant for the constructor `account` option.
|
|
|
|
- "account" is now "user" in the CloudAPI constructor.
|
|
|
|
- All (all? at least at the time of this writing) methods in cloudapi2.js have
|
|
|
|
a signature of `function (options, callback)` instead of the sometimes
|
|
|
|
haphazard extra arguments.
|
2015-09-01 20:55:39 +03:00
|
|
|
|
|
|
|
|
|
|
|
## Development Hooks
|
|
|
|
|
|
|
|
Before commiting be sure to:
|
|
|
|
|
|
|
|
make check # lint and style checks
|
|
|
|
make test # run unit tests
|
|
|
|
|
|
|
|
A good way to do that is to install the stock pre-commit hook in your
|
|
|
|
clone via:
|
|
|
|
|
|
|
|
make git-hooks
|
|
|
|
|
2015-09-06 02:43:40 +03:00
|
|
|
## License
|
2015-09-01 20:55:39 +03:00
|
|
|
|
2015-09-06 02:43:40 +03:00
|
|
|
MPL 2.0
|