Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
pkgcloud is a standard library for node.js that abstracts away differences among multiple cloud providers.
JavaScript

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
test
.gitignore
LICENSE
README.md
package.json

README.md

pkgcloud

Communicate across multiple cloud providers in an platform agnostic manner.

Motivation

Currently Nodejitsu maintains several API libraries for communicating with Cloud environments:

There are also some other decent libraries out there:

The main problem is that these libraries are not consistent in anyway.

pkgcloud is a consistent layer across multiple cloud providers.

Unified Vocabulary

When considering all IaaS providers as a whole their vocabulary is somewhat disjoint. pkgcloud attempts to overcome this through a unified vocabulary:

Compute

pkgcloud OpenStack Joyent Amazon
Server Server Machine Instance
Image Image Dataset AMI
Flavor Flavor Package InstanceType

System Breakdown

In order of priority the components and providers we need to implement are:

Components

  1. Compute
  2. Storage
  3. DNS
  4. CDN
  5. Load Balancers

Providers

  1. Rackspace
  2. Joyent
  3. Amazon

Components

Compute

Creating Compute Clients

The options to be passed to the pkgcloud.compute.Client object should be:

Rackspace

var rackspace = pkgcloud.compute.createClient(
  {
    provider : 'rackspace',
    username : 'nodejitsu',
    apiKey   : 'foobar'
  }
);

Amazon

var amazon = pkgcloud.compute.createClient(
  {
    provider    : 'amazon',
    accessKey   : 'asdfkjas;dkj43498aj3n',
    accessKeyId : '98kja34lkj'
  }
);

Joyent

var path = require('path'),
    fs   = require('fs');

// joyent needs a username/password or key/keyId combo.
// key/keyId should be registered in Joyent servers.
// check `test/helpers/index.js` for details on key/keyId works.
var joyent = pkgcloud.compute.createClient(
  {
    provider : 'joyent',
    account  : 'nodejitsu'
    keyId    : '/nodejitsu1/keys/dscape',
    key      : 
      fs.readFileSync(path.join(process.env.HOME, '.ssh/id_rsa'), 'ascii')
  }
);

Image

  • client.getImages(function (err, images) { })
    err: Error
    images: [Image]
  • client.getImage(imageId, function (err, image) { })
    imageId: Image|String
    err: Error
    image: Image
  • client.destroyImage(image, function (err, ok) { })
    image: Image|String
    err: Error
    ok: Object {"ok": deletedId}
  • client.createImage(options, function (err, image) { })
    options: Object {"name": "NameToGiveToImage", "server": "ServerOrServerIdToBaseImageUpon"}
    err: Error
    image: Image

Flavor

  • client.getFlavors(function (err, flavors) { })
    err: Error
    flavors: [Flavor]
  • client.getFlavor(flavorId, function (err, flavor) { })
    flavorId: Image|String
    err: Error
    flavor: Flavor

Storage

Creating Storage Clients

The options to be passed to the pkgcloud.storage.Client object should be:

Rackspace

  {
    provider: 'rackspace', // 'cloudservers'
    username: 'nodejitsu',
    apiKey: 'foobar'
  }

AWS

  {
    provider: 'amazon', // 'aws', 's3'
    accessKey: 'asdfkjas;dkj43498aj3n',
    accessKeyId: '98kja34lkj'
  }
  • pkgcloud.storage.create(options, callback)
  • new pkgcloud.storage.Client(options, callback)

Using Storage Clients

Most of this can be modeled off of the node.js core 'fs' module API although there needs to be some improvements for copying files and creating root directories (i.e. containers)

DNS

CDN

Load Balancers

NEXT STEPS

  1. Stub out an API which works well across providers
  2. Try implementing it for a couple of providers
  3. REPEAT

Author: Nodejitsu

License: CLOSED

Something went wrong with that request. Please try again.