Introducing pkgcloud – OpenStack SDK for node.js



Introducing pkgcloud – OpenStack SDK for node.js

1 0


introducing-pkgcloud-for-openstack

Introducting pkgcloud - node.js SDK for OpenStack

On Github kenperkins / introducing-pkgcloud-for-openstack

Introducing pkgcloud

OpenStack SDK for node.js

Ken Perkins | Rackspace | @kenperkinsPhani Raj | HP Cloud | @phanirajuyn

node.js

Platform built on Chrome's V8 JavaScript runtime.

...uses an event-driven, non-blocking I/O model that makes it lightweight and efficient...

node strengths

Asynchronous workloads, coordination,integrating multiple systems, provisioning.

node weaknesses

CPU intensive workloads, Maths, non-intuitive patterns

Hello World in node.js

var http = require('http');

var handler = function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}

var server = http.createServer(handler);

server.listen(1337, '127.0.0.1');

console.log('Server running at http://127.0.0.1:1337/');

single-threaded pitfalls

var handler = function(req, res) {

  req.records.forEach(function(record) {
      // iterating this array will block until done
  });

  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Success!\n');

};

single-threaded with helpers

var async = require('async');

var handler = function(req, res) {

  async.each(req.records, function(record, next) {
    // when you're done with your processing, invoke next to continue
    next();
  }, function() {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Success!\n');
  });

};

A look to the past

Created by nodejitsu December 2011initially compute & storage on Rackspace.

Vision: support for multiple providers and a generalized interface.

pkgcloud <= v0.6

  • Compute (Amazon, Rackspace, Azure, Joyent, limited Openstack)
  • Storage (Amazon, Rackspace, Azure)
  • Limited Database support (poorly defined)

Enter Rackspace

Committing to an existing multi-cloud library was better.

Examples: Apache jclouds, fog, and Apache Libcloud.

Enter HP

Originally offered hpcloud-js.

hpcloud-js is now deprecated in favor of pkgcloud

Stamp of Approval

pkgcloud endorsed on developer.openstack.org as the node.js SDK for openstack

pkgcloud today (v1.0.x)

OpenStack in pkgcloud

pkgcloud client semantics

var pkgcloud = require('pkgcloud');

var client = pkgcloud.compute.createClient({
  provider: 'openstack',
  username: 'my-user-name',
  password: 'my-password',
  authUrl: 'http://my-auth-endpoint'
});

pkgcloud client alternative

var pkgcloud = require('pkgcloud');

var client = pkgcloud.providers.openstack.compute.createClient({
  username: 'my-user-name',
  password: 'my-password',
  authUrl: 'http://my-auth-endpoint'
});

compute provider

  • Server
  • Flavor
  • Image

Demo

storage provider

  • Container
  • File

Demo

practical examples

Demo

The Future?

Where does pkgcloud go from here?

  • More providers (Google)
  • Broader service support
  • Modular architecture
  • More comprehensive tests
  • Logo, website?

Contributing!

Or we need your help...

#pkgcloud on Freenode IRC, github.com/pkgcloud/pkgcloud on Github

Not yet implmented

  • Load Balancers
  • Images
  • Full Identity
  • Telemetry
  • Something you care about...

Thanks & Q & A!

this deck | github

@kenperkins

@phanirajuyn