Giter Club home page Giter Club logo

local-dynamo's Introduction

A Node.js wrapper of AWS DynamoDB Local

Build Status

This is a thin wrapper of the AWS DynamoDB Local. You can start the DynamoDB Local within a Node.js program and easily specify where the database files should be.

Release notes can be found at http://aws.amazon.com/releasenotes/SDK/JavaScript

Installing

npm install local-dynamo

Usage

From command line:

$ node bin/launch_local_dynamo.js --database_dir=/database/dir --port=4567

or inside a Node.js application:

localDynamo = require('local-dynamo')
localDynamo.launch('/database/dir', 4567)

If you want to run DynamoDB Local in memory, pass in null:

localDynamo = require('local-dynamo')
localDynamo.launch(null, 4567)

Configuration

launch allows for additional options

localDynamo = require('local-dynamo')
localDynamo.launch({
  port: 4567,
  sharedDb: true,
  heap: '512m'
})
option description default
port The port number that DynamoDB will use to communicate with your application 8000
detached Prepare child to run independently of its parent process false
stdio Configure the pipes that are established between the parent and child process 'ignore'
heap Heap size null
sharedDb DynamoDB will use a single database file, instead of using separate files for each credential and region null
dir The directory where DynamoDB will write its database file null (default to inMemory)

AWS DynamoDB Local Versions

Here is a list of the versions DynamoDB Local that local-dynamo uses.

  • 0.0.1 -- dynamodb_local_2013-09-12
  • 0.0.2 -- dynamodb_local_2014-01-08
  • 0.0.3 -- dynamodb_local_2014-04-24
  • 0.0.4 -- dynamodb_local_2014-10-07
  • 0.0.5 -- dynamodb_local_2015-01-27
  • 0.0.6 -- dynamodb_local_2015-04-27
  • 0.2.0 -- dynamodb_local_2016-01-05
  • 0.3.0 -- dynamodb_local_2016-05-17
  • 0.5.0 -- dynamodb_local_2017-01-24
  • 0.6.0 -- dynamodb_local_2020-01-16

local-dynamo's People

Contributors

adrianlee44 avatar anth0d avatar brentropy avatar chaosgame avatar claylo avatar frostney avatar koresar avatar kylehg avatar mrblackus avatar nicks avatar vweevers avatar xiao 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

local-dynamo's Issues

Error: spawn java ENOENT thrown

I'm trying to start local-dynamo in a gulp task, and I'm getting this error:

Error: spawn java ENOENT
  at exports._errnoException (util.js:837:11)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
  at onErrorNT (internal/child_process.js:344:16)
  at doNTCallback2 (node.js:429:9)
  at process._tickCallback (node.js:343:17)
  at Function.Module.runMain (module.js:477:11)
  at startup (node.js:117:18)
  at node.js:951:3

The gulp task looks like:

gulp.task('launch-dev-db', function() {
  var localDynamo = require('local-dynamo');
  localDynamo.launch(paths.db, 3456);
});

I logged out the PATH that was being supplied to child_process.spawn, and it has /usr/bin/ included, which is where java is:

» file $(which java)
/usr/bin/java: symbolic link to `/etc/alternatives/java'

I'm on node 4.0.0 and Ubuntu 14.04.

stdout comes back as null

node bin/launch_local_dynamo.js --database_dir=/Users/mgenev1271/Projects/temp/local-dynamo/db --port=4567
/Users/mgenev1271/Projects/temp/local-dynamo/bin/launch_local_dynamo.js:15
childProcess.stdout.pipe(process.stdout)
                   ^
TypeError: Cannot read property 'pipe' of null
    at Object.<anonymous> (/Users/mgenev1271/Projects/temp/local-dynamo/bin/launch_local_dynamo.js:15:20)
    at Module._compile (module.js:430:26)
    at Object.Module._extensions..js (module.js:448:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:471:10)
    at startup (node.js:117:18)
    at node.js:948:3

Error: spawn ENOENT directory issues

installing using npm install -g local-dynamo does not properly load the module.
running the sample launch.js errors out


events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)

npm list -g | grep dynamo lists the module as installed though

log4j out of date

folder aws_dynamodb_includes contains the log4j that has the issue

.close() doesn't seem to close levelup

I'm experiencing some unexpected behaviour. I expect that when I call .close() on a dynalite server, the underlying Levelup database is closed. However, it seems that is not the case.

Here's an example:

var dynalite = require('dynalite');

var server = dynalite({path: './tmp/dynalite', createTableMs: 50});

server.listen(4567,function(err){
  if(!err){
    // doThings();

    server.close(function(){
      // Expect server to be closed...
      var server2 = dynalite({path: './tmp/dynalite', createTableMs: 50});
      server2.listen(6789,function(err){
        // recieved an error "Uncaught OpenError: IO error: lock ./tmp/mockDynamo/LOCK: already held by process"
      });
    });
  }
});

kinesis?

Is there anyway to hook up a kinesis stream to dynamo local that you know of? Are there any events coming out of it that I could use to redirect to a stream possibly?

Update to latest DynamoDB version

It appears that dynamodb is up to dynamodb_local_2016-01-07.

Should I submit a PR with the newest JAR files? Does it have an impact?

Unable to start local-dynamo - missing sheabang

Sheabang should be added at first line of file: ./bin/launch_local_dynamo.js

#!/usr/bin/env node

Steps to reproduce error:

mkdir test-local-dynamo
cd test-local-dynamo
npm init -y
npm install local-dynamo -S
# next command edit script "test" in package.json to start local-dynamo
sed -i '' -e 's/"test": ".*"[^"]*$/"test": "local-dynamo --port=8000"/' package.json
npm test

last command produces error:

./node_modules/.bin/local-dynamo: line 1: //: is a directory
./node_modules/.bin/local-dynamo: line 3: /Applications: is a directory
./node_modules/.bin/local-dynamo: line 4: node_modules: command not found
./node_modules/.bin/local-dynamo: line 5: node_modules/: is a directory
./node_modules/.bin/local-dynamo: line 7: syntax error near unexpected token `('
./node_modules/.bin/local-dynamo: line 7: `var flags = require('flags')'
npm ERR! Test failed.  See above for more details.

Workaround:
add under "scripts" in package.json entry:

"postinstall": "perl -i -pe '$.==1&&s%^%#!/usr/bin/env node\\n%' node_modules/local-dynamo/bin/launch_local_dynamo.js",

manually or by command:

perl -i -pe 's@^(.*"scripts": {)(.*)$@$1\n    "postinstall": "perl -i -pe '"'\\$.==1&&s%^%#\!\/usr\/bin\/env node\\\\\\\\n%'"' node_modules\/local-dynamo\/bin\/launch_local_dynamo.js",$2@' package.json

reinstall packages: npm ci
and run database: npm test

Suppress hs_err_pid_*.log files

For some reason when using this module my project's directory gets flooded by hs_err_pid_*.log files which I believe to be generated by some error thrown inside the JVM by the DynamoDB jar.

Java version:

java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Am I the only one experiencing this?
Thanks!

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.