Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ekristen/leveldb-server
https://github.com/ekristen/leveldb-server
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ekristen/leveldb-server
- Owner: ekristen
- Created: 2015-03-17T02:02:26.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-17T02:23:01.000Z (almost 10 years ago)
- Last Synced: 2024-04-14T20:10:14.720Z (9 months ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LevelDB Server
This is a packaged setup of a leveldb instance exposed with multilevel. It comes with some helpful modules preloaded against the leveldb instance.
It was designed to be a docker image for quick usage of leveldb over a network connection instead of just locally.
This should be used as a tool to get familiar and to get started with leveldb. The LevelDB space is very modular and if you need more features, fork or roll your own.
Enjoy!
## NPM
`npm install leveldb-server`
### Server
```javascript
var leveldb_server = require('leveldb-server').createServer()
var db = leveldb_server.databasedb.put('key', 'value')
```### Client
```javascript
var leveldb_client = require('leveldb-server').createClient()
var client = require('./index.js').createClient()client.connection.connect(2012, function() {
client.database.get('testing', function(err,value) {
console.log(err)
console.log(value)
})
})```
## Docker
`docker pull ekristen/leveldb`
You can override any of the server settings using environment variables.
### Server
Run in the foreground
`docker run -it -p 2012:2012 -v /data/leveldb:/opt/app/db ekristen/leveldb`
Run in the background
`docker run -d -p 2012:2012 -v /data/leveldb:/opt/app/db ekristen/leveldb`
### Persisting Data
Use a host volume or a container volume.
`docker run -d -v /data/leveldb:/opt/app/db ekristen/leveldb`
### Environment Variables
* `leveldb_path`
* `leveldb_port`
* `leveldb_host`
* `leveldb_keyEncoding`
* `leveldb_valueEncoding`
* `leveldb_defaultTTL`
* `leveldb_checkFrequency`## Settings
### Server
```javascript
{
path: './db',
host: '0.0.0.0',
port: 2012,
keyEncoding: 'utf8',
valueEncoding: 'json',
defaultTTL: 0,
checkFrequency: 50
}
```### Client
```javascript
{
port: 2012
}
```