• Stars
    star
    144
  • Rank 254,631 (Top 6 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created over 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A rock solid, dynamic DNS server with swappable backends and CRUD API

Quarry Logo

About

Description

A rock solid, dynamic DNS server with swappable backends and CRUD API. Start Quarry with one of the available persistence layers and manage records and forwarders through the API. Quarry can also be accessed programmatically by requiring it in your code!

Author

ContainerShip Developers - [email protected]

Getting Started

Installing

Run npm install -g quarry-dns to install Quarry as an executable

Run npm install quarry-dns --save to install Quarry as a required module for your application

Features

Statsd Integration

Setting --statsd-host will enable Quarry statsd integration. Ship metrics such as:

  • errors

  • forwarder timeouts

  • records

  • forwarders

  • HTTP Response Codes

Various Persistence Layers

  • Disk
  • Memory
  • MongoDB
  • S3
  • Redis

CRUD API

When running Quarry as a standalone executable, records and forwarders are managed through a simple CRUD API.

Module

When requiring Quarry as a module, records and forwarders are managed through exposed functions.

Usage & Examples

Executable

quarry --help can be used for a comprehensive list of available commands and options. To run Quarry on a priviliged port such as 53, it must be start as root. Below are some usage examples:

Disk

sudo quarry disk --file-location /path/to/quarry/config.json

Memory

sudo quarry memory

MongoDB

sudo quarry mongo --mongo-host ds028017.mongolab.com

Redis

sudo quarry redis --redis-host quarry.abcdef.0001.use1.cache.amazonaws.com

S3

sudo quarry s3 --access-key-id $AWS_ACCESS_KEY_ID --secret-access-key $AWS_SECRET_ACCESS_KEY --bucket quarry

Get Records

curl http://quarry.server:5353/v1/records -X GET -H "Content-Type: application/json"

Get Record

curl http://quarry.server:5353/v1/records/www.domain.com -X GET -H "Content-Type: application/json"

Create Record

curl http://quarry.server:5353/v1/records/www.domain.com -X POST -d '{"address": "1.2.3.4", "type": "A", "ttl": 60}' -H "Content-Type: application/json"

Update Record

curl http://quarry.server:5353/v1/records/www.domain.com -X PUT -d '{"address": ["1.2.3.4", "5.6.7.8"], "type": "A", "ttl": 60}' -H "Content-Type: application/json"

Delete Record

curl http://quarry.server:5353/v1/records/www.domain.com -X DELETE

Get Forwarders

curl http://quarry.server:5353/v1/forwarders -X GET -H "Content-Type: application/json"

Get Forwarder

curl http://quarry.server:5353/v1/forwarders/8.8.8.8 -X GET -H "Content-Type: application/json"

Create Forwarder

curl http://quarry.server:5353/v1/forwarders/8.8.8.8 -X POST -d '{"timeout": 500, "port": 53}' -H "Content-Type: application/json"

Update Forwarder

curl http://quarry.server:5353/v1/forwarders/8.8.8.8 -X PUT -d '{"timeout": 1000, "port": 53}' -H "Content-Type: application/json"

Delete Forwarder

curl http://quarry.server:5353/v1/forwarders/8.8.8.8 -X DELETE

Module

var Quarry = require("quarry-dns");
var quarry = new Quarry({
    persistence: "memory"
});

if(quarry){
    quarry.listen(function(){
        console.log("quarry is now listening");
    });
}

Disk

var quarry = new Quarry({
    persistence: "disk",
    "file-location": "/tmp/quarry.json"
});

Memory

var quarry = new Quarry({
    persistence: "memory"
});

MongoDB

var quarry = new Quarry({
    persistence: "mongo",
    "mongo-host": "ds028017.mongolab.com"
});

Redis

var quarry = new Quarry({
    persistence: "redis",
    "redis-host": "quarry.abcdef.0001.use1.cache.amazonaws.com"
});

S3

var quarry = new Quarry({
    persistence: "s3",
    "access-key-id": process.env["AWS_ACCESS_KEY_ID"],
    "secret-access-key": process.env["AWS_SECRET_ACCESS_KEY"],
    bucket: "quarry"
});

Get Records

quarry.persistence.get_configuration(function(err, configuration){
    if(err)
        throw err;

    var records = configuration.records;
});

Get Record

quarry.persistence.get_configuration(function(err, configuration){
    if(err)
        throw err;

    var record = configuration.records["www.domain.com"];
});

Create Record

quarry.persistence.create_record("www.domain.com", { address: "1.2.3.4", type: "A", ttl: 60 }, function(err){
    if(err)
        throw err;
});

Update Record

quarry.persistence.update_record("www.domain.com", { address: ["1.2.3.4", "5.6.7.8"], type: "A", ttl: 60 }, function(err){
    if(err)
        throw err;
});

Delete Record

quarry.persistence.delete_record("www.domain.com", function(err){
    if(err)
        throw err;
});

Get Forwarders

quarry.persistence.get_configuration(function(err, configuration){
    if(err)
        throw err;

    var forwarders = configuration.forwarders;
});

Get Forwarder

quarry.persistence.get_configuration(function(err, configuration){
    if(err)
        throw err;

    var forwarder = configuration.forwarders["8.8.8.8"];
});

Create Forwarder

quarry.persistence.create_forwarder("8.8.8.8", { timeout: 500, port: 53 }, function(err){
    if(err)
        throw err;
});

Update Forwarder

quarry.persistence.update_forwarder("8.8.8.8", { timeout: 1000, port: 53 }, function(err){
    if(err)
        throw err;
});

Delete Forwarder

quarry.persistence.delete_forwarder("8.8.8.8", function(err){
    if(err)
        throw err;
});

Contributing

Please feel free to contribute by opening issues and creating pull requests!

More Repositories

1

node-quandl

A nodejs module for interacting with the Quandl API.
JavaScript
77
star
2

chef-api

A simple client providing access the chef server api, implemented in nodejs.
JavaScript
27
star
3

node-fleetctl

A nodejs module for interacting with fleetctl.
JavaScript
8
star
4

memory-leak-handler

Handle high memory utilization in nodejs by killing the process
JavaScript
6
star
5

serf-rpc

A simple nodejs module for interacting with the Serf RPC protocol.
JavaScript
5
star
6

cloudwatch-conveyor

Ship AWS Cloudwatch metrics to various backends
JavaScript
5
star
7

circle-api

A nodejs module for interacting with the Circle API
JavaScript
5
star
8

node-tckr

A command line utility to display stock prices
JavaScript
3
star
9

marketmuster

Streaming and static stock quotes from various datasources
JavaScript
3
star
10

espial

A secure distributed event layer for nodejs applications
JavaScript
3
star
11

randy-jackson

Express middleware that pays homage to the greatest American Idol judge of all time: Randy Jackson
JavaScript
2
star
12

vrsn

Opinionated application version management across languages
JavaScript
2
star
13

clifx

Command line interface for interacting with LIFX bulbs using LIFX Cloud
JavaScript
2
star
14

chef-xen

A chef cookbook for setting up xen and managing guests
Ruby
1
star
15

metrics-conveyor

Ship metrics from a datasource to various backends
JavaScript
1
star
16

x509

A nodejs library built for in-memory x509 manipulation
C++
1
star
17

salt-shaker

A script to purge old slugs from a datastore
JavaScript
1
star
18

marathon-md

A marathon application backup and restoration utility
JavaScript
1
star
19

dotfiles

vimrc file
Shell
1
star
20

docker-aerospike

Docker image designed to run an Aerospike cluster on ContainerShip
JavaScript
1
star