README.md

(Note: Current releases and the #master branch of this are for SmartDataCenter
(SDC) version 7. It is not 100% backward compatible with SDC 6.5. For 100%
compatility with SDC 6.5, you must install a "6.5.x" version of this module.)

Installation

To use the CLI tools (a number of sdc-* commands) you may want to install
globally:

npm install -g smartdc

The CLI commands typical work with JSON content. We suggest you also install
the json tool for working with JSON on the
command line. The examples below use json heavily.

npm install -g json

CLI Setup and Authentication

There are CLI commands corresponding to almost every action available in the
SmartDataCenter API; see the Joyent CloudAPI
documentation for complete information.
Each command takes --url, --account, and --keyId flags to provide the
API endpoint URL and your credentials. However you'll probably want to set
the environment variable equivalents:

SDC_KEY_ID (--keyId | -k): The fingerprint of an SSH public key that has
been added to the account set in SDC_ACCOUNT. This is used for signing
requests. If you use an SSH agent, the fingerprint is shown in ssh-add -l
output. You can calculate the fingerprint like this:

If your client is connecting to a CloudAPI service that is using a self-signed
SSL certificate, you may need to set SDC_TESTING=1 in your client environent.
(Otherwise you'll get DEPTH_ZERO_SELF_SIGNED_CERT error).

Authenticating as account user

Starting with version 7.3, Role Based Access Control
lets you provide limited access to to your Joyent Cloud account and Manta
storage to other members of your organization.

In order to authenticate as a member of a given organization, SDC_ACCOUNT
will remain set to the login associated with the organization, and we'll use
the SDC_USER environment variable to identify ourselves as a member of such
organization. We can also use the --A | --user command line argument with
any of the sdc-* commands if we just want to operate as an account user for
just that command.

Remember that if the environment variable SDC_USER is set, sdc-* binaries
will remain trying to operate as the given user. If you've set this variable and
want to switch back to operate as the account owner, you should
unset SDC_USER.

The SmartDataCenter Cloud API uses
http-signature (IETF draft
spec) for
authentication. All requests to the API are signed using your RSA private key.
The server uses your (previously uploaded) public key to verify the signed
request. This avoids ever sending a password.

Once you have set the environment variables, check that it is working by
listing available images for provisioning:

CLI Usage

There are many many sdc-* commands. Typically one for each endpoint in
the API. A common one is for provisioning
a new machine (aka VM). Let's provision a new "base" (SmartOS) machine. First
find the id of the "base" image (version 13.3.0):

License

Bugs

Running the test suite

Note that this will execute tests against the Smart DC setup set into
ENV variable SDC_URL. Please, make sure it's OK to try to create new
machines into such Smart DC setup before running this test suite.

Running the test suite is as simple as:

make test

You may want to add a test user to your Smart DC setup. A sample user, with
sample ssh keys can be found at test/user.ldif and test/.ssh. Once you've
added this user, you can run your tests using: