GithubHelp home page GithubHelp logo

node-baas's Introduction

Build Status

Bcrypt as a service (node.js)

This module is a client and server.

Server

Installation:

sudo npm i -g auth0/node-baas

Start a baas server on port 9485 and salt with 10 iterations:

baas -p 9485 -s 10

How it works?

The server listen in a TCP port. The protocol buffer is defined in /protocol.

The server start N workers by default N is the number of COREs on the system.

Every request (hash or compare) is assigned to a worker. A worker can handle one operation at the time. If all workers are "busy", the server will reply the request with "SERVER IS BUSY" error to the client. The client automatically retries the request in another connection.

Client

Install:

npm i auth0/node-baas

The client keeps api-level compatibility with node-bcrypt.

var BaasClient = require('baas').Client;

var baas = new BaasClient({
  port: 9485,
  host: 'my-baas-load-balancer'
  pool: {
    maxConnections: 20,
    maxRequestsPerConnection: 10
  }
});

//hash a password
baas.hash('plainTextPassword', function (err, hash) {
  console.log(hash)
});

//compare a password
baas.compare('plainTextPassword', 'bcryptHash', function (err, success) {
  console.log(success)
});

The client also support ssl:

var BaasClient = require('baas').Client;
var baas = new BaasClient({
  port: 9485,
  host: 'my-baas-load-balancer',
  protocol: 'baass'
  pool: {
    maxConnections: 20,
    maxRequestsPerConnection: 10
  }
});

//or
var baas = new BaasClient({
  uri: 'baass://my-baas-load-balancer',
  pool: {
    maxConnections: 20,
    maxRequestsPerConnection: 10
  }
});

To install on ubuntu/debian

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv F63E3D3A
sudo sh -c 'echo deb http://debs.auth0.com/ stable main > /etc/apt/sources.list.d/auth0.list'
sudo aptitude update
sudo aptitude install -y baas

Author

Auth0

License

This project is licensed under the MIT license. See the LICENSE file for more info.

node-baas's People

Contributors

dafortune avatar dirceu avatar dschenkelman avatar elbuo8 avatar glena avatar ja30278 avatar jfromaniello avatar lhelman avatar panga avatar silverxmary avatar tshak avatar woloski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-baas's Issues

Running on Ubuntu 16.04 LTS fails

Hi.

I am trying to run the BaaS service on Ubuntu 16.04 LTS and the service is failing with:

ubuntu@ip-10-0-1-241:/opt/auth0/baas/bin$ /opt/auth0/baas/bin/baas -p 9485 -s 10
module.js:549
    throw err;
    ^

Error: Cannot find module '/opt/auth0/baas/node_modules/auth0-instrumentation/node_modules/gc-stats/build/gcstats/v1.0.2/Release/node-v57-linux-x64/gcstats.node'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/opt/auth0/baas/node_modules/auth0-instrumentation/node_modules/gc-stats/index.js:7:13)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

I had to install NodeJS version 8.11.4

node-baas fails to install on OSX 10.13.3

Hi.

I am trying to install node-baas locally on my MacBook Pro and I get an error. Node version is v10.6.0 and npm version is 6.4.0.

me@Mes-MacBook-Pro: ~/Workspace/infrastructure/baas-client$ npm i auth0/node-baas
npm WARN deprecated [email protected]: Use uuid module instead

> [email protected] preinstall /Users/me/Workspace/infrastructure/baas-client/node_modules/v8-profiler-node8
> node -e 'process.exit(0)'


> [email protected] install /Users/me/Workspace/infrastructure/baas-client/node_modules/dtrace-provider
> node-gyp rebuild || node suppress-error.js

  ACTION binding_gyp_ndtp_target_build_ndtp .
  TOUCH Release/obj.target/ndtp.stamp

> [email protected] install /Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://node-binaries.s3.amazonaws.com/gcstats/v1.0.2/Release/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://node-binaries.s3.amazonaws.com/gcstats/v1.0.2/Release/node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI) (falling back to source compile with node-gyp)
  CXX(target) Release/obj.target/gcstats/src/gcstats.o
  CXX(target) Release/obj.target/gcstats/src/gcstats.o
../src/gcstats.cc:132:19: warning: 'Call' is deprecated [-Wdeprecated-declarations]
        afterGCCallback->Call(1, arguments);
                         ^
../../nan/nan.h:1646:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:102:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/gcstats.cc:132:19: warning: 'Call' is deprecated [-Wdeprecated-declarations]
        afterGCCallback->Call(1, arguments);
                         ^
../../nan/nan.h:1646:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:102:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
1 warning generated.
1 warning generated.
rm: ./Release/.deps/Release/obj.target/gcstats/src/gcstats.o.d.raw: No such file or directory
make: *** [Release/obj.target/gcstats/src/gcstats.o] Error 1
gyp ERR! build error
  SOLINK_MODULE(target) Release/gcstats.node
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! command "/usr/local/Cellar/node/10.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats/build/gcstats/v1.0.2/Release/node-v64-darwin-x64/gcstats.node" "--module_name=gcstats" "--module_path=/Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats/build/gcstats/v1.0.2/Release/node-v64-darwin-x64"
gyp ERR! cwd /Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats
gyp ERR! node -v v10.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/10.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats/build/gcstats/v1.0.2/Release/node-v64-darwin-x64/gcstats.node --module_name=gcstats --module_path=/Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats/build/gcstats/v1.0.2/Release/node-v64-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:961:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
node-pre-gyp ERR! System Darwin 17.4.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/10.6.0/bin/node" "/Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats
node-pre-gyp ERR! node -v v10.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/10.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats/build/gcstats/v1.0.2/Release/node-v64-darwin-x64/gcstats.node --module_name=gcstats --module_path=/Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats/build/gcstats/v1.0.2/Release/node-v64-darwin-x64' (1)
  COPY /Users/me/Workspace/infrastructure/baas-client/node_modules/gc-stats/build/gcstats/v1.0.2/Release/node-v64-darwin-x64/gcstats.node
  TOUCH Release/obj.target/action_after_build.stamp
npm WARN enoent ENOENT: no such file or directory, open '/Users/me/Workspace/infrastructure/baas-client/package.json'
npm WARN baas-client No description
npm WARN baas-client No repository field.
npm WARN baas-client No README data
npm WARN baas-client No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2018-09-04T14_52_39_729Z-debug.log

Best regards.

Upgrade Node.js for security fixes #security-nodejs-20160209

Please upgrade Node.js to v0.12.10, v4.3.0, v5.6.0, or newer, to address the security issues listed here:
https://groups.google.com/forum/#!topic/nodejs-sec/G8IA0G4uA88.

Due date for this request is 2016-02-26.

This update addresses the following issues:

Please acknowledge that you've received this request and that it makes sense.
If it's not applicable to your repo, let me know so I can fix my list.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.