3.34.0 • Published 1 year ago

@fabcotech/dappy-node v3.34.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Dappy-node

Dappy node is a DoH and an authoritative name server, written in NodeJS. It is a core component of the dappy protocol and ecosystem.

Dappy node is currently available with three connectors for storing the zones : memory (dev), postreSQL (production) and RChain (blockchain, experimental).

dappy website

docs for domain purchase and management

dappy-tools repository

Quick start

Run a dappy-node with memory zone provider using npx

# Run a dappy-node that save zones in memory
DAPPY_NODE_ZONE_PROVIDER=memory DAPPY_NODE_CACHING=0 npx @fabcotech/dappy-node

# Resolve example.d A record
dappy-lookup example.d A --endpoint=http://127.0.0.1:3001

Build and test

# In dappy-tools root
npm i & npx lerna bootstrap

# Build the npm lib from dappy-tools/packages/dappy-node
npm i
npm run build

# Build the docker image from dappy-tools/
docker build . -f ./packages/dappy-node/Dockerfile -t dappynodelocal

# test
npm run test

Understanding dappy-node

Zone providers

Dappy-node abstracts how zones and records are persisted.

There are 3 zone providers availables:

  • memory: for demo and development purpose. It contains a built-in zone example with some records. It is the easiest way to start and experiment dappy-node.
  • postgresql: for production purposes when confidentiality is needed. Zones and records are persisted on a pg instance.
  • rchain: experimental provider that connects with a RChain (L1) deployment.

Each of these zone providers have their own jobs and routes.

Use DAPPY_NODE_ZONE_PROVIDER environment variable to define zone_provider.

DNS over HTTPS

Dappy-node is queryable over HTTPS. It implements DoH RFC. DNS packets are sent over HTTPS in binary format.

Under the hood, dappy-node use dns-packet to decode and encode DNS packets.

Every DoH clients can query dappy-node, it includes browsers like Chrome. Dappy provide a command line dappy-lookup that makes DoH queries. You can try it like this:

npx @fabcotech/dappy-lookup example.d A --endpoint=http://127.0.0.1:3001

Support

We are open to, and grateful for, any contributions made by the community.

Report a bug

We use the issue tracker to keep track of bugs and improvements to dappy-node itself and the documentation. We encourage you to open issues to discuss improvements, architecture, theory, internal implementation, etc. If a topic has been discussed before, we will ask you to join the previous discussion.

Reference

dappy-node configuration

dappy-node is configurable through environments variables. To be more convenient, dappy-node try to load a .env file named dappyrc at startup.

Below, here are all environments variables read by dappy-node.

General environment variables

KeysRequiredDefault valueDescription
DAPPY_NODE_ZONE_PROVIDERNorchainZone provider used
DAPPY_NODE_DNS_PORTNodappy-node dns port, disabled if not provided
DAPPY_NODE_HTTP_PORTYes3001dappy-node http port
DAPPY_NODE_HTTPS_PORTNodappy-node https port. HTTPS is disabled if not defined
DAPPY_NODE_PRIVATE_KEY_FILENAMENodappynode.keydappy-node private key. Generated if not exists
DAPPY_NODE_CERTIFICATE_FILENAMENodappynode.crtdappy-node certificate. Generated if not exists
DAPPY_NODE_CACHINGYes60record ttl cache. Disabled if set to 0
DAPPY_NODE_ENABLE_REQUEST_METRICSYesfalseActivate metrics
DAPPY_NODE_SENTRY_URLNofalseSend logs to sentry
DAPPY_NETWORK_IDYesunknown, gamma, beta or d
DAPPY_NETWORK_MASTER_PUBLIC_KEYNo04ea33c...Public key to check messages for zone creation (dappy network master)
DAPPY_NETWORK_FILENoFile path of a dappy network .json file
DAPPY_LOG_PATHYes./logspath to log warning and errors

if DAPPY_NETWORK_ID is unknown, the program will try to load a dappy network from the file ./dappyNetwork.js.

Environment variables read when postgresql is used as zone provider

KeysRequiredDefault value (dev)Description
DAPPY_PG_CONNECTION_STRINGNopostgresql://postgres:postgres@localhost:5432/dappypostgresql connection string
DAPPY_NETWORK_MEMBER_TO_DOWNLOAD_ZONES_FROMNo | the network member hostname you want to download zones from
DOWNLOAD_ZONES_IF_EMPTYNofalsedo you want to download the zones if there are zero zones in pg (setup)
DAPPY_NETWORK_IDNolocalID of the dappy network you want to connect to
DAPPY_NETWORK_MASTER_PUBLIC_KEYNo04ea33c4...The public key of the entity able to send new zones

API Reference

Please read API Reference for more details.

Kubernetes

Kubernetes guide

Docker

When deploying using docker, we assume you have setup a secure postgreSQL database already (on your server or a cloud provider). And know the DAPPY_PG_CONNECTION_STRING (in the format postgresql://postgres:postgres@db1234.cloudprovider.com:5432/dappy) for allowing dappy-node to write/ready in the database.

Note : the host address from within the container may vary depending on your OS, on linux it's probably 172.17.0.1, on macOS host.docker.internal.

.pgdata folder is shared with container, it will be useful only if you're running a pg instance locally.

docker compose up

dappy-nod should be exposed on port 3001, you can run curl localhost:3001/hashes to make sure it's up, and responds with hashes of the zones.

Now you must to link your local port 3001 to the public port 443 or else of your public IP address. (nginx or Apache). You'll need to generate a certificate (see Kubernetes guide) and configure your nginx to use this self signed certificate.

Local postgreSQL and adminer

Want to start a local postgreSQL (localhost:5432) + adminer (localhost:8082) ? (we do not recommend for production)

docker compose --file docker-compose-pg-adminer.yml  up
3.34.0

1 year ago

3.31.11

2 years ago

3.31.10

2 years ago

3.31.12

2 years ago

3.31.0

2 years ago

3.31.1

2 years ago

3.33.0

2 years ago

3.31.2

2 years ago

3.33.1

2 years ago

3.31.3

2 years ago

3.33.2

2 years ago

3.31.4

2 years ago

3.33.3

2 years ago

3.31.5

2 years ago

3.33.4

2 years ago

3.31.6

2 years ago

3.33.5

2 years ago

3.31.7

2 years ago

3.33.6

2 years ago

3.31.8

2 years ago

3.33.7

2 years ago

3.31.9

2 years ago

3.33.8

2 years ago

3.30.0

2 years ago

3.32.0

2 years ago

3.32.1

2 years ago

3.32.2

2 years ago

3.29.5

2 years ago

3.29.4

2 years ago

3.29.7

2 years ago

3.29.6

2 years ago

3.28.0

2 years ago

3.29.1

2 years ago

3.29.0

2 years ago

3.27.2

2 years ago

3.29.3

2 years ago

3.29.2

2 years ago

3.26.0

2 years ago

3.27.1

2 years ago

3.27.0

2 years ago

3.25.1

2 years ago

3.25.0

2 years ago

3.25.2

2 years ago

3.24.0

2 years ago

3.22.0

2 years ago

3.21.0

2 years ago

3.20.5

2 years ago

3.20.4

2 years ago

3.20.3

2 years ago

3.20.1

2 years ago