mapbox / dynamodb-replicator

module for dynamodb multi-region replication
ISC License
129 stars 48 forks source link

Added local support for compatibility with Dynalite #75

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi, I've added the support for local dynamo using dynalite.

https://github.com/mhart/dynalite

I've simply added support for local IP address with port (i.e. 127.0.0.1:80). The command line option to use it is '--local'. This will pass the primary and replica values to Dyno by endpoint instead of region.

I've tested it multiple times with Dynalite and so far it works great.

Feel free to contact me for any additional info.

Thanks for this great tool.

Cheers

rclark commented 8 years ago

Thanks! What would you think about breaking this up a little more so that you could potentially diff a local table against a real-life one?

I think that, instead of using a --local flag, you could specify the table names like so:

diff-tables.js localhost:80/my-local-table us-east-1/my-remote-table

What do you think?

ghost commented 8 years ago

This is actually a great idea. Also a use case I will probably need. I'll work on that and keep this thread updated.

ghost commented 8 years ago

Finally been able to work on this (been away for a while, sorry for inconvenience). Is this issue still relevant ? Also, I get Travis CI fail because of env variables for AWS access/secret keys. Do you have any idea on how to solve this ?

Thanks a lot !

rclark commented 8 years ago

I think this would be a great addition! The travis failures from external contributions are a problem that I'm afraid I don't know the solution to. I should also do some work on the tests to allow a mocked S3 service or client.

In the meantime you should be able to:

ghost commented 8 years ago

Hi rclark, I've placed the function responsible for parsing location into a separate js file and I've added some test in the diff.test file.

To give you more background, I come from an automation and robotics background and this is the first time I actually write js code and I am not very unfamiliar with the best practices of js with testing and functions. (Too little time and so many technologies out there to research) I hope it's also compliant with your way of coding. Any suggestion is very welcome ! Looking forward to it.

Also, interesting fact, I am using your tool on AWS China (I am based in China at the moment) and it's working great for diff functionality. I'll be testing it more this week but so far it's working great. Good job on the tool, it will be very useful for us.

Thanks !

ghost commented 8 years ago

Allright, I made these little changes and made sure the tests we're passing in local. If anything else can let me know.

Cheers !

rclark commented 8 years ago

Thanks!