1 | # pkgcloud [![Build Status](https://secure.travis-ci.org/pkgcloud/pkgcloud.png?branch=master)](http://travis-ci.org/pkgcloud/pkgcloud) [![NPM version](https://badge.fury.io/js/pkgcloud.png)](http://badge.fury.io/js/pkgcloud)
|
2 |
|
3 | pkgcloud is a standard library for node.js that abstracts away differences among multiple cloud providers.
|
4 |
|
5 | * [Getting started](#getting-started)
|
6 | * [Basic APIs](#basic-apis)
|
7 | * [Unified Vocabulary](#unified-vocabulary)
|
8 | * [Supported APIs](#supported-apis)
|
9 | * [Compute](#compute)
|
10 | * [Storage](#storage)
|
11 | * [Uploading Files](#uploading)
|
12 | * [Downloading Files](#downloading)
|
13 | * [Database](#databases)
|
14 | * [DNS](#dns----beta) *(beta)*
|
15 | * [Block Storage](#block-storage----beta) *(beta)*
|
16 | * [Load Balancers](#load-balancers----beta) *(beta)*
|
17 | * [Network](#network----beta) *(beta)*
|
18 | * _Fine Print_
|
19 | * [Installation](#installation)
|
20 | * [Tests](#tests)
|
21 | * [Logging](#logging)
|
22 | * [Code Coverage](#code-coverage)
|
23 | * [Contribute!](#contributing)
|
24 | * [Roadmap](#roadmap)
|
25 |
|
26 | <a name="getting-started"></a>
|
27 | ## Getting Started
|
28 |
|
29 | You can install `pkgcloud` via `npm` or add to it to [dependencies](https://npmjs.org/doc/json.html#dependencies) in your `package.json` file:
|
30 |
|
31 | ```
|
32 | npm install pkgcloud
|
33 | ```
|
34 |
|
35 | Currently there are six service types which are handled by pkgcloud:
|
36 |
|
37 | * [Compute](#compute)
|
38 | * [Storage](#storage)
|
39 | * [Database](#databases)
|
40 | * [DNS](#dns----beta) *(beta)*
|
41 | * [Block Storage](#block-storage----beta) *(beta)*
|
42 | * [Load Balancers](#load-balancers----beta) *(beta)*
|
43 | * [Network](#network----beta) *(beta)*
|
44 |
|
45 | In our [Roadmap](#roadmap), we plan to add support for more services, such as Queueing, Monitoring, and more. Additionally, we plan to implement more providers for the *beta* services, thus moving them out of *beta*.
|
46 |
|
47 | <a name="basic-apis"></a>
|
48 | ### Basic APIs for pkgcloud
|
49 |
|
50 | Services provided by `pkgcloud` are exposed in two ways:
|
51 |
|
52 | * **By service type:** For example, if you wanted to create an API client to communicate with a compute service you could simply:
|
53 |
|
54 | ``` js
|
55 | var client = require('pkgcloud').compute.createClient({
|
56 | //
|
57 | // The name of the provider (e.g. "joyent")
|
58 | //
|
59 | provider: 'provider-name',
|
60 |
|
61 | //
|
62 | // ... Provider specific credentials
|
63 | //
|
64 | });
|
65 | ```
|
66 |
|
67 | * **By provider name:** For example, if you knew the name of the provider you wished to communicate with you could do so directly:
|
68 |
|
69 | ``` js
|
70 | var client = require('pkgcloud').providers.joyent.compute.createClient({
|
71 | //
|
72 | // ... Provider specific credentials
|
73 | //
|
74 | });
|
75 | ```
|
76 |
|
77 | All API clients exposed by `pkgcloud` can be instantiated through `pkgcloud[serviceType].createClient({ ... })` or `pkcloud.providers[provider][serviceType].createClient({ ... })`.
|
78 |
|
79 | <a name="unified-vocabulary"></a>
|
80 | ### Unified Vocabulary
|
81 |
|
82 | Due to the differences between the vocabulary for each service provider, **[pkgcloud uses its own unified vocabulary](docs/vocabulary.md).**
|
83 |
|
84 | * **Compute:** [Server](#server), [Image](#image), [Flavor](#flavor)
|
85 | * **Storage:** [Container](#container), [File](#file)
|
86 | * **DNS:** [Zone](#zone), [Record](#record)
|
87 |
|
88 | **Note:** Unified vocabularies may not yet be defined for *beta* services.
|
89 |
|
90 | <a name="supported-apis"></a>
|
91 | ### Supported APIs
|
92 |
|
93 | Supporting every API for every cloud service provider in Node.js is a huge undertaking, but _that is the long-term goal of `pkgcloud`_. **Special attention has been made to ensure that each service type has enough providers for a critical mass of portability between providers** (i.e. Each service implemented has multiple providers).
|
94 |
|
95 | If a service does not have at least two providers, it is considered a *beta* interface; We reserve the right to improve the API as multiple providers will allow generalization to be better determined.
|
96 |
|
97 | * **[Compute](#compute)**
|
98 | * [Amazon](docs/providers/amazon.md#using-compute)
|
99 | * [Azure](docs/providers/azure.md#using-compute)
|
100 | * [DigitalOcean](docs/providers/digitalocean.md#using-compute)
|
101 | * [HP](docs/providers/hp/compute.md)
|
102 | * [Joyent](docs/providers/joyent.md#using-compute)
|
103 | * [Openstack](docs/providers/openstack/compute.md)
|
104 | * [Rackspace](docs/providers/rackspace/compute.md)
|
105 | * **[Storage](#storage)**
|
106 | * [Amazon](docs/providers/amazon.md#using-storage)
|
107 | * [Azure](docs/providers/azure.md#using-storage)
|
108 | * [HP](docs/providers/hp/storage.md)
|
109 | * [Openstack](docs/providers/openstack/storage.md)
|
110 | * [Rackspace](docs/providers/rackspace/storage.md)
|
111 | * **[Database](#databases)**
|
112 | * [IrisCouch](docs/providers/iriscouch.md)
|
113 | * [MongoLab](docs/providers/mongolab.md)
|
114 | * [Rackspace](docs/providers/rackspace/database.md)
|
115 | * [MongoHQ](docs/providers/mongohq.md)
|
116 | * [RedisToGo](docs/providers/redistogo.md)
|
117 | * **[DNS](#dns----beta)** *(beta)*
|
118 | * [Rackspace](docs/providers/rackspace/dns.md)
|
119 | * **[Block Storage](#block-storage----beta)** *(beta)*
|
120 | * [Rackspace](docs/providers/rackspace/blockstorage.md)
|
121 | * **[Load Balancers](#load-balancers----beta)** *(beta)*
|
122 | * [Rackspace](docs/providers/rackspace/loadbalancer.md)
|
123 | * **[Network](#network----beta)** *(beta)*
|
124 | * [HP](docs/providers/hp/network.md)
|
125 | * [Openstack](docs/providers/openstack/network.md)
|
126 |
|
127 | ## Compute
|
128 |
|
129 | The `pkgcloud.compute` service is designed to make it easy to provision and work with VMs. To get started with a `pkgcloud.compute` client just create one:
|
130 |
|
131 | ``` js
|
132 | var client = require('pkgcloud').compute.createClient({
|
133 | //
|
134 | // The name of the provider (e.g. "joyent")
|
135 | //
|
136 | provider: 'provider-name',
|
137 |
|
138 | //
|
139 | // ... Provider specific credentials
|
140 | //
|
141 | });
|
142 | ```
|
143 |
|
144 | Each compute provider takes different credentials to authenticate; these details about each specific provider can be found below:
|
145 |
|
146 | * [Amazon](docs/providers/amazon.md#using-compute)
|
147 | * [Azure](docs/providers/azure.md#using-compute)
|
148 | * [DigitalOcean](docs/providers/digitalocean.md#using-compute)
|
149 | * [HP](docs/providers/hp/compute.md)
|
150 | * [Joyent](docs/providers/joyent.md#using-compute)
|
151 | * [Openstack](docs/providers/openstack/compute.md)
|
152 | * [Rackspace](docs/providers/rackspace/compute.md)
|
153 |
|
154 | Each instance of `pkgcloud.compute.Client` returned from `pkgcloud.compute.createClient` has a set of uniform APIs:
|
155 |
|
156 | ### Server
|
157 | * `client.getServers(function (err, servers) { })`
|
158 | * `client.createServer(options, function (err, server) { })`
|
159 | * `client.destroyServer(serverId, function (err, server) { })`
|
160 | * `client.getServer(serverId, function (err, server) { })`
|
161 | * `client.rebootServer(server, function (err, server) { })`
|
162 |
|
163 | ### Image
|
164 | * `client.getImages(function (err, images) { })`
|
165 | * `client.getImage(imageId, function (err, image) { })`
|
166 | * `client.destroyImage(image, function (err, ok) { })`
|
167 | * `client.createImage(options, function (err, image) { })`
|
168 |
|
169 | ### Flavor
|
170 | * `client.getFlavors(function (err, flavors) { })`
|
171 | * `client.getFlavor(flavorId, function (err, flavor) { })`
|
172 |
|
173 | ## Storage
|
174 |
|
175 | The `pkgcloud.storage` service is designed to make it easy to upload and download files to various infrastructure providers. **_Special attention has been paid so that methods are streams and pipe-capable._**
|
176 |
|
177 | To get started with a `pkgcloud.storage` client just create one:
|
178 |
|
179 | ``` js
|
180 | var client = require('pkgcloud').storage.createClient({
|
181 | //
|
182 | // The name of the provider (e.g. "joyent")
|
183 | //
|
184 | provider: 'provider-name',
|
185 |
|
186 | //
|
187 | // ... Provider specific credentials
|
188 | //
|
189 | });
|
190 | ```
|
191 |
|
192 | Each storage provider takes different credentials to authenticate; these details about each specific provider can be found below:
|
193 |
|
194 | * [Amazon](docs/providers/amazon.md#using-storage)
|
195 | * [Azure](docs/providers/azure.md#using-storage)
|
196 | * [HP](docs/providers/hp/storage.md)
|
197 | * [Openstack](docs/providers/openstack/storage.md)
|
198 | * [Rackspace](docs/providers/rackspace/storage.md)
|
199 |
|
200 | Each instance of `pkgcloud.storage.Client` returned from `pkgcloud.storage.createClient` has a set of uniform APIs:
|
201 |
|
202 | ### Container
|
203 | * `client.getContainers(function (err, containers) { })`
|
204 | * `client.createContainer(options, function (err, container) { })`
|
205 | * `client.destroyContainer(containerName, function (err) { })`
|
206 | * `client.getContainer(containerName, function (err, container) { })`
|
207 |
|
208 | ### File
|
209 | * `client.upload(options, function (err) { })`
|
210 | * `client.download(options, function (err) { })`
|
211 | * `client.getFiles(container, function (err, files) { })`
|
212 | * `client.getFile(container, file, function (err, server) { })`
|
213 | * `client.removeFile(container, file, function (err) { })`
|
214 |
|
215 | Both the `.upload(options)` and `.download(options)` have had **careful attention paid to make sure they are pipe and stream capable:**
|
216 |
|
217 | ### Upload a File
|
218 | ``` js
|
219 | var pkgcloud = require('pkgcloud'),
|
220 | fs = require('fs');
|
221 |
|
222 | var client = pkgcloud.storage.createClient({ /* ... */ });
|
223 |
|
224 | fs.createReadStream('a-file.txt').pipe(client.upload({
|
225 | container: 'a-container',
|
226 | remote: 'remote-file-name.txt'
|
227 | }));
|
228 | ```
|
229 |
|
230 | ### Download a File
|
231 | ``` js
|
232 | var pkgcloud = require('pkgcloud'),
|
233 | fs = require('fs');
|
234 |
|
235 | var client = pkgcloud.storage.createClient({ /* ... */ });
|
236 |
|
237 | client.download({
|
238 | container: 'a-container',
|
239 | remote: 'remote-file-name.txt'
|
240 | }).pipe(fs.createWriteStream('a-file.txt'));
|
241 | ```
|
242 |
|
243 | ## Databases
|
244 |
|
245 | The `pkgcloud.database` service is designed to consistently work with a variety of Database-as-a-Service (DBaaS) providers.
|
246 |
|
247 | To get started with a `pkgcloud.storage` client just create one:
|
248 |
|
249 | ``` js
|
250 | var client = require('pkgcloud').database.createClient({
|
251 | //
|
252 | // The name of the provider (e.g. "joyent")
|
253 | //
|
254 | provider: 'provider-name',
|
255 |
|
256 | //
|
257 | // ... Provider specific credentials
|
258 | //
|
259 | });
|
260 | ```
|
261 |
|
262 | Each database provider takes different credentials to authenticate; these details about each specific provider can be found below:
|
263 |
|
264 | * **CouchDB**
|
265 | * [IrisCouch](docs/providers/iriscouch.md#couchdb)
|
266 | * **MongoDB**
|
267 | * [MongoLab](docs/providers/mongolab.md)
|
268 | * [MongoHQ](docs/providers/mongohq.md)
|
269 | * **Redis**
|
270 | * [IrisCouch](docs/providers/iriscouch.md#redis)
|
271 | * [RedisToGo](docs/providers/redistogo.md)
|
272 | * **MySQL**
|
273 | * [Rackspace](docs/providers/rackspace/databases.md)
|
274 | * **Azure Tables**
|
275 | * [Azure](docs/providers/azure.md#database)
|
276 |
|
277 | Due to the various differences in how these DBaaS providers provision databases only a small surface area of the API for instances of `pkgcloud.database.Client` returned from `pkgcloud.database.createClient` is consistent across all providers:
|
278 |
|
279 | * `client.create(options, callback)`
|
280 |
|
281 | All of the individual methods are documented for each DBaaS provider listed above.
|
282 |
|
283 | ## DNS -- Beta
|
284 |
|
285 | ##### Note: DNS is considered Beta until there are multiple providers; presently only Rackspace are supported.
|
286 |
|
287 | The `pkgcloud.dns` service is designed to make it easy to manage DNS zones and records on various infrastructure providers. **_Special attention has been paid so that methods are streams and pipe-capable._**
|
288 |
|
289 | To get started with a `pkgcloud.dns` client just create one:
|
290 |
|
291 | ``` js
|
292 | var client = require('pkgcloud').dns.createClient({
|
293 | //
|
294 | // The name of the provider (e.g. "rackspace")
|
295 | //
|
296 | provider: 'provider-name',
|
297 |
|
298 | //
|
299 | // ... Provider specific credentials
|
300 | //
|
301 | });
|
302 | ```
|
303 |
|
304 | #### Providers
|
305 |
|
306 | * [Rackspace](docs/providers/rackspace/dns.md)
|
307 |
|
308 | Each instance of `pkgcloud.dns.Client` returned from `pkgcloud.dns.createClient` has a set of uniform APIs:
|
309 |
|
310 | ### Zone
|
311 | * `client.getZones(details, function (err, zones) { })`
|
312 | * `client.getZone(zone, function (err, zone) { })`
|
313 | * `client.createZone(details, function (err, zone) { })`
|
314 | * `client.updateZone(zone, function (err) { })`
|
315 | * `client.deleteZone(zone, function (err) { })`
|
316 |
|
317 | ### Record
|
318 | * `client.getRecords(zone, function (err, records) { })`
|
319 | * `client.getRecord(zone, record, function (err, record) { })`
|
320 | * `client.createRecord(zone, record, function (err, record) { })`
|
321 | * `client.updateRecord(zone, record, function (err, record) { })`
|
322 | * `client.deleteRecord(zone, record, function (err) { })`
|
323 |
|
324 | ## Block Storage -- Beta
|
325 |
|
326 | ##### Note: Block Storage is considered Beta until there are multiple providers; presently only Rackspace are supported.
|
327 |
|
328 | The `pkgcloud.blockstorage` service is designed to make it easy to create and manage block storage volumes and snapshots.
|
329 |
|
330 | To get started with a `pkgcloud.blockstorage` client just create one:
|
331 |
|
332 | ``` js
|
333 | var client = require('pkgcloud').blockstorage.createClient({
|
334 | //
|
335 | // The name of the provider (e.g. "rackspace")
|
336 | //
|
337 | provider: 'provider-name',
|
338 |
|
339 | //
|
340 | // ... Provider specific credentials
|
341 | //
|
342 | });
|
343 | ```
|
344 |
|
345 | #### Providers
|
346 |
|
347 | * [Rackspace](docs/providers/rackspace/blockstorage.md)
|
348 |
|
349 | Each instance of `pkgcloud.blockstorage.Client` returned from `pkgcloud.blockstorage.createClient` has a set of uniform APIs:
|
350 |
|
351 | ### Volume
|
352 | * `client.getVolumes(options, function (err, volumes) { })`
|
353 | * `client.getVolume(volume, function (err, volume) { })`
|
354 | * `client.createVolume(details, function (err, volume) { })`
|
355 | * `client.updateVolume(volume, function (err, volume) { })`
|
356 | * `client.deleteVolume(volume, function (err) { })`
|
357 |
|
358 | ### Snapshot
|
359 | * `client.getSnapshots(options, function (err, snapshots) { })`
|
360 | * `client.getSnapshot(snapshot, function (err, snapshot) { })`
|
361 | * `client.createSnapshot(details, function (err, snapshot) { })`
|
362 | * `client.updateSnapshot(snapshot, function (err, snapshot) { })`
|
363 | * `client.deleteSnapshot(snapshot, function (err) { })`
|
364 |
|
365 | ## Load Balancers -- Beta
|
366 |
|
367 | ##### Note: Load Balancers is considered Beta until there are multiple providers; presently only Rackspace are supported.
|
368 |
|
369 | The `pkgcloud.loadbalancer` service is designed to make it easy to create and manage block storage volumes and snapshots.
|
370 |
|
371 | To get started with a `pkgcloud.loadbalancer` client just create one:
|
372 |
|
373 | ``` js
|
374 | var client = require('pkgcloud').loadbalancer.createClient({
|
375 | //
|
376 | // The name of the provider (e.g. "rackspace")
|
377 | //
|
378 | provider: 'provider-name',
|
379 |
|
380 | //
|
381 | // ... Provider specific credentials
|
382 | //
|
383 | });
|
384 | ```
|
385 |
|
386 | #### Providers
|
387 |
|
388 | * [Rackspace](docs/providers/rackspace/loadbalancer.md)
|
389 |
|
390 | Each instance of `pkgcloud.loadbalancer.Client` returned from `pkgcloud.loadbalancer.createClient` has a set of uniform APIs:
|
391 |
|
392 | ### LoadBalancers
|
393 | * `client.getLoadBalancers(options, function (err, loadBalancers) { })`
|
394 | * `client.getLoadBalancer(loadBalancer, function (err, loadBalancer) { })`
|
395 | * `client.createLoadBalancer(details, function (err, loadBalancer) { })`
|
396 | * `client.updateLoadBalancer(loadBalancer, function (err) { })`
|
397 | * `client.deleteLoadBalancer(loadBalancer, function (err) { })`
|
398 |
|
399 | ### Nodes
|
400 | * `client.getNodes(loadBalancer, function (err, nodes) { })`
|
401 | * `client.addNodes(loadBalancer, nodes, function (err, nodes) { })`
|
402 | * `client.updateNode(loadBalancer, node, function (err) { })`
|
403 | * `client.removeNode(loadBalancer, node, function (err) { })`
|
404 |
|
405 | ## Network -- Beta
|
406 |
|
407 | ##### Note: Network is considered Beta until there are multiple providers; presently only HP & Openstack providers are supported.
|
408 |
|
409 | The `pkgcloud.network` service is designed to make it easy to create and manage networks.
|
410 |
|
411 | To get started with a `pkgcloud.network` client just create one:
|
412 |
|
413 | ``` js
|
414 | var client = require('pkgcloud').network.createClient({
|
415 | //
|
416 | // The name of the provider (e.g. "openstack")
|
417 | //
|
418 | provider: 'provider-name',
|
419 |
|
420 | //
|
421 | // ... Provider specific credentials
|
422 | //
|
423 | });
|
424 | ```
|
425 |
|
426 | #### Providers
|
427 |
|
428 | * [HP](docs/providers/hp/network.md)
|
429 | * [Openstack](docs/providers/openstack/network.md)
|
430 |
|
431 |
|
432 | Each instance of `pkgcloud.network.Client` returned from `pkgcloud.network.createClient` has a set of uniform APIs:
|
433 |
|
434 | ### Networks
|
435 | * `client.getNetworks(options, function (err, networks) { })`
|
436 | * `client.getNetwork(network, function (err, network) { })`
|
437 | * `client.createNetwork(options, function (err, network) { })`
|
438 | * `client.updateNetwork(network, function (err, network) { })`
|
439 | * `client.deleteNetwork(network, function (err, networkId) { })`
|
440 |
|
441 |
|
442 | ### Subnets
|
443 | * `client.getSubnets(options, function (err, subnets) { })`
|
444 | * `client.getSubnet(subnet, function (err, subnet) { })`
|
445 | * `client.createSubnet(options, function (err, subnet) { })`
|
446 | * `client.updateSubnet(subnet, function (err, subnet) { })`
|
447 | * `client.deleteSubnet(subnet, function (err, subnetId) { })`
|
448 |
|
449 | ### Ports
|
450 | * `client.getPorts(options, function (err, ports) { })`
|
451 | * `client.getPort(port, function (err, port) { })`
|
452 | * `client.createPort(options, function (err, port) { })`
|
453 | * `client.updatePort(port, function (err, port) { })`
|
454 | * `client.deletePort(port, function (err, portId) { })`
|
455 |
|
456 | ## Installation
|
457 |
|
458 | ``` bash
|
459 | $ npm install pkgcloud
|
460 | ```
|
461 |
|
462 | ## Tests
|
463 | For run the tests you will need `mocha@1.9.x` or higher, please install it and then run:
|
464 |
|
465 | ``` bash
|
466 | $ npm test
|
467 | ```
|
468 |
|
469 | The tests use the [`hock`](https://github.com/mmalecki/hock) library for mock up the response of providers, so the tests run without do any connection to the providers, there is a notorius advantage of speed on that, also you can run the tests without Internet connection and also can highlight a change of API just disabling `hock`.
|
470 |
|
471 |
|
472 | ### Running tests without mocks
|
473 | By default the `npm test` command run the tests enabling `hock`. And sometimes you will want to test against the live provider, so you need to do this steps, in order to test without mocks.
|
474 |
|
475 | 1. Copy a provider config file from `test/configs/mock` to `test/configs`
|
476 | 2. Fill in with your own credentials for the provider.
|
477 | 3. (Optional) The compute test suite run the common tests for all providers listed on `test/configs/providers.json`, there you can enable or disable providers.
|
478 | 4. Run the tests using mocha.
|
479 |
|
480 | ``` bash
|
481 | Mocha installed globally
|
482 | $ mocha -R spec test/*/*/*-test.js test/*/*/*/*-test.js
|
483 |
|
484 | Linux/Mac - Mocha installed locally
|
485 | $ ./node_modules/.bin/mocha -R spec test/*/*/*-test.js test/*/*/*/*-test.js
|
486 |
|
487 | Windows - Mocha installed locally:
|
488 | $ node_modules\.bin\mocha.cmd -R spec test/*/*/*-test.js test/*/*/*/*-test.js
|
489 |
|
490 | ```
|
491 |
|
492 | ### Other ways to run the tests
|
493 | Also you can run the tests directly using `mocha` with `hock` enabled:
|
494 |
|
495 | ``` bash
|
496 | Linux/Mac - Mocha installed globally:
|
497 | $ MOCK=on mocha -R spec test/*/*/*-test.js test/*/*/*/*-test.js
|
498 |
|
499 | Linux/Mac - Mocha installed locally:
|
500 | $ MOCK=on node_modules/.bin/mocha -R spec test/*/*/*-test.js test/*/*/*/*-test.js
|
501 |
|
502 | Windows - Mocha installed globally:
|
503 | $ set MOCK=on&mocha -R spec test/*/*/*-test.js test/*/*/*/*-test.js
|
504 |
|
505 | Windows - Mocha installed locally:
|
506 | $ set MOCK=on&node_modules\.bin\mocha.cmd -R spec test/*/*/*-test.js test/*/*/*/*-test.js
|
507 | ```
|
508 |
|
509 | Even better, you can run the tests for some specific provider:
|
510 |
|
511 | ``` bash
|
512 | Linux/Mac - Mocha installed globally:
|
513 | $ MOCK=on mocha -R spec test/iriscouch/*/*-test.js
|
514 |
|
515 | Linux/Mac - Mocha installed locally:
|
516 | $ MOCK=on ./node_modules/.bin/mocha -R spec test/iriscouch/*/*-test.js
|
517 |
|
518 | Windows - Mocha installed globally:
|
519 | $ set MOCK=on&mocha -R spec test/iriscouch/*/*-test.js
|
520 |
|
521 | Windows - Mocha installed locally:
|
522 | $ set MOCK=on&node_modules\.bin\mocha.cmd -R spec test/iriscouch/*/*-test.js
|
523 |
|
524 | ```
|
525 |
|
526 | ## Logging
|
527 | Any client you create with `createClient` can emit logging events. If you're interested in more detail from the internals of `pkgcloud`, you can wire up an event handler for log events.
|
528 |
|
529 | ```Javascript
|
530 | var client = pkgcloud.compute.createClient(options);
|
531 |
|
532 | client.on('log::*', function(message, object) {
|
533 | if (object) {
|
534 | console.log(this.event.split('::')[1] + ' ' + message)
|
535 | console.dir(object);
|
536 | }
|
537 | else {
|
538 | console.log(this.event.split('::')[1] + ' ' + message);
|
539 | }
|
540 | });
|
541 |
|
542 | ```
|
543 |
|
544 | The valid log events raised are `log::debug`, `log::verbose`, `log::info`, `log::warn`, and `log::error`. There is also a [more detailed logging example using pkgcloud with Winston](docs/logging-with-winston.md).
|
545 |
|
546 | ## Code Coverage
|
547 | You will need jscoverage installed in order to run code coverage. There seems to be many forks of the jscoverage project, but the recommended one is [node-jscoverage](https://github.com/visionmedia/node-jscoverage), because we use [node-coveralls](https://github.com/cainus/node-coveralls) to report coverage to http://coveralls.io. node-coveralls requires output from [mocha-lcov-reporter](https://github.com/StevenLooman/mocha-lcov-reporter), whose documentation mentions node-jscoverage.
|
548 |
|
549 | ### Warning
|
550 |
|
551 | **Running coverage will mess with your lib folder. It will make a backup lib-bak before running and restore it if the coverage task runs successfully.**
|
552 |
|
553 | In order to simplify cleanup if something goes wrong, it is recommended to have all all new files added and all changes committed before running coverage, so you'll be able to restore with these commands if something goes wrong:
|
554 |
|
555 | ``` bash
|
556 | git clean -fd
|
557 | git checkout lib
|
558 | ```
|
559 |
|
560 | ### Coverage Pre-requisites
|
561 |
|
562 | Please make sure jscoverage has been installed following the instructions at [node-jscoverage](https://github.com/visionmedia/node-jscoverage).
|
563 |
|
564 | ### Local Coverage
|
565 |
|
566 | <code>make test-cov</code>
|
567 |
|
568 | ### Run Coverage locally and send to coveralls.io
|
569 |
|
570 | Travis takes care of coveralls, so this shouldn't be necessary unless you're troubleshooting a problem with Travis/Coveralls.
|
571 | You'll need to have access to the coveralls repo_token, which should only be visible to pkgcloud/pkgcloud admins.
|
572 |
|
573 | 1. Create a .coveralls.yml containing the repo_token from https://coveralls.io/r/pkgcloud/pkgcloud
|
574 | 2. Run <code>make test-coveralls</code>
|
575 |
|
576 | <a name="contributing"></a>
|
577 | ## Contribute!
|
578 | We welcome contribution to `pkgcloud` by any and all individuals or organizations. Before contributing please take a look at the [Contribution Guidelines in CONTRIBUTING.md](CONTRIBUTING.md).
|
579 |
|
580 | We are pretty flexible about these guidelines, but the closer you follow them the more likely we are to merge your pull-request.
|
581 |
|
582 | <a name="roadmap"></a>
|
583 | ## Roadmap
|
584 |
|
585 | 1. Backport latest fixes from `node-cloudfiles` and `node-cloudservers`
|
586 | 2. Implement more providers for Block Storage, DNS, and Load Balancing
|
587 | 3. Add more services: Monitoring, Queueing, Autoscale.
|
588 | 4. Implement `fs` compatible file API.
|
589 | 5. Support additional service providers.
|
590 |
|
591 | #### Author: [Nodejitsu Inc.](http://nodejitsu.com)
|
592 | #### Contributors: [Charlie Robbins](https://github.com/indexzero), [Nuno Job](https://github.com/dscape), [Daniel Aristizabal](https://github.com/cronopio), [Marak Squires](https://github.com/marak), [Dale Stammen](https://github.com/stammen), [Ken Perkins](https://github.com/kenperkins)
|
593 | #### License: MIT
|