Archives for January 2016

Joyent CLI basics

I’ve been trying different SmartOS images with Joyent for some time now, but always did everything from the Dashboard.

Joyent’s wonderful dashboard

Most users will never need anything else: the Joyent’s dashboard is incredible – simple yet powerful, providing vital views of your instances and your billing. Wish there was a tool like this for AWS!

Being a developer though, you’ll probably want to give Joyent’s CloudAPI a try. Since I’m not much of a developer, I settled on the NodeJS based CLI tools.

Install Joyent CLI

You need to get a nodejs installed in your environment, and on top of it get the Smart DataCenter module from Joyent:

npm install -g smartdc

There’s at least three variables to configure so that you can use the CLI, SDC_URL reflects the region (DC) you plan on using, that’s Amsterdam for me in Europe. SDC_ACCOUNT is your username, and SDC_KEY_ID is the key you’ll need to get from your Joyent Dashboard:

export SDC_ACCOUNT=greys
export SDC_KEY_ID="aa:bb:cc:dd:ee:ff:gg:hh:ii:jj:kk:ll:mm:nn:oo:pp"

 

List machines

sdc-listmachines is the command you’ll need to list machines.

And once you’re clear on which machine you’d like to inspect, you can use sdc-getmachine with its UUID to confirm all the necessary details about the machine: IPs and hardware configuration, state and access keys, etc.

Here’s how it should look:

greys$ sdc-getmachine d8288fe0-1d88-ef64-XXXX-YYYYYYYYYYYY
{
"id": "d8288fe0-1d88-ef64-XXXX-YYYYYYYYYYYY",
"name": "wp",
"type": "smartmachine",
"state": "stopped",
"image": "70f1b13e-0f85-XXXX-a009-YYYYYYYYYYYY",
"ips": [
"10.224.XXX.YYY",
"37.153.AAA.BBB"
],
"memory": 256,
"disk": 6144,
"metadata": {
"root_authorized_keys": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0lTV5song1ZXSFBdkhCH7brvVYzcV0HPuU/CpRiczLTc5Epox8a+mCza/UWwdCg69HTUGGUEk6CXXXXXXXXXXXXYYYYYYYYYYYYYYYYYYY greys@server.com\n"
},
"tags": {},
"created": "2015-10-09T18:58:18.264Z",
"updated": "2016-01-11T13:27:44.000Z",
"networks": [
"6f996828-b838-11e2-XXXX-YYYYYYYYYYYY",
"0f63aea2-83ee-4c50-XXXX-YYYYYYYYYYYY"
],
"dataset": "sdc:sdc:wordpress:15.1.1",
"primaryIp": "37.153.XXX.YYY",
"firewall_enabled": false,
"compute_node": "44454c4c-4e00-1031-XXXX-YYYYYYYYYYYY",
"package": "t4-standard-256M"
}

Start and stop a machine with Joyent

sdc-startmachine and sdc-stopmachine are the commands which take UUID, and you can use the sdc-getmachine to track progress.

IMPORTANT: if you jus stop your Joyent machine, billing will still be happening unless and until destroy the machine like this:

sdc-deletemachine d8288fe0-1d88-ef64-XXXX-YYYYYYYYYYYY