Skip to content

Domain agnostic DHT accessible through HTTP and configurable with environmental variables

Notifications You must be signed in to change notification settings

htw-projekt-p2p-volltextsuche/p2p-dht

Repository files navigation

p2p-dht

Part of a project at HTW to build a distributed full-text-search. See the rest of the project.

This repo implements the DHT that hosts the entries of the inverted index for the full-text-search component.

The slides of our closing presentation include an explaination of how this whole project fits together and takes a deeper look into what this component does if you want to know more.

Design

Entire Project

This Component

Run

Install:

npm install

Development:

npm start

Production:

npm run start-prod

Configure

Configured via environmental variables in variables.env. See: variables.env.example.

HTTP_PORT

Port for the http server to run on.

Default: 8090

HTTP_LIMIT

The maximum request body size.

Default: 10mb

See: body-parser

PEER_PORT

Port for the p2p node to run on.

Default: 8070

PEER_IP

IP for the p2p node to run on.

Default: 127.0.0.1 (localhost)

PEER_LIST

List of peers, required for joining the network. Leave blank on first peer, that is "creating" the network.

Default: empty

Format:

  • multiaddr incl. ipfs address
  • seperated by commas

Example:

PEER_LIST=/ip4/127.0.0.1/tcp/8071/ipfs/QmdW3RF4Yq4acYc4bgUmxeuJQLb2mQpQmMuDTGir5gQcYM, /ip4/127.0.0.1/tcp/8072/ipfs/QmPP5pdu6Dh93DL7LnQkKU2x8m4BoSrQswjQR5q26PMneg

You have to fill this list manually with the multiaddresses of the other peers. You do this by configuring a peer through the above options (ports and ip) and running the npm run addr script to show you that specific peers multiaddress, which can then be used in another peers PEER_LIST to connect to this peer.

PEER_STORAGE

Storage location on disk for the data of the DHT.

Default: /tmp/datastore

PEER_REDUNDANCY

Specifies on how many different remote nodes a value should be stored.

Default: 2

PEER_MPLEX_SIZE

Specify the max message size of the p2p net's multiplexer.

Default: 10mb

DEBUG

Enable logging in the p2p network.

Set it to:

libp2p:dht:Q*,libp2p:dht:rpc:get-value:*

Scripts

Multiaddress:

Print the multiaddress used for connection to the node:

npm run addr

Debug:

Print the environmental variables that are being read in:

npm run debug

Node testing:

Run a node for testing:

npm run spawn 1

Generate peerId locally:

Create the peerId.json locally.

npm run local-peerid

About

Domain agnostic DHT accessible through HTTP and configurable with environmental variables

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •