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!
ContainerShip Developers - developers@containership.io
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
Setting --statsd-host
will enable Quarry statsd integration. Ship metrics such as:
- HTTP Response Codes
- Disk
- Memory
- MongoDB
- S3
- Redis
When running Quarry as a standalone executable, records and forwarders are managed through a simple CRUD API.
When requiring Quarry as a module, records and forwarders are managed through exposed functions.
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:
sudo quarry disk --file-location /path/to/quarry/config.json
sudo quarry memory
sudo quarry mongo --mongo-host ds028017.mongolab.com
sudo quarry redis --redis-host quarry.abcdef.0001.use1.cache.amazonaws.com
sudo quarry s3 --access-key-id $AWS_ACCESS_KEY_ID --secret-access-key $AWS_SECRET_ACCESS_KEY --bucket quarry
curl http://quarry.server:5353/v1/records -X GET -H "Content-Type: application/json"
curl http://quarry.server:5353/v1/records/www.domain.com -X GET -H "Content-Type: application/json"
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"
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"
curl http://quarry.server:5353/v1/records/www.domain.com -X DELETE
curl http://quarry.server:5353/v1/forwarders -X GET -H "Content-Type: application/json"
curl http://quarry.server:5353/v1/forwarders/8.8.8.8 -X GET -H "Content-Type: application/json"
curl http://quarry.server:5353/v1/forwarders/8.8.8.8 -X POST -d '{"timeout": 500, "port": 53}' -H "Content-Type: application/json"
curl http://quarry.server:5353/v1/forwarders/8.8.8.8 -X PUT -d '{"timeout": 1000, "port": 53}' -H "Content-Type: application/json"
curl http://quarry.server:5353/v1/forwarders/8.8.8.8 -X DELETE
var Quarry = require("quarry-dns");
var quarry = new Quarry({
persistence: "memory"
});
if(quarry){
quarry.listen(function(){
console.log("quarry is now listening");
});
}
var quarry = new Quarry({
persistence: "disk",
"file-location": "/tmp/quarry.json"
});
var quarry = new Quarry({
persistence: "memory"
});
var quarry = new Quarry({
persistence: "mongo",
"mongo-host": "ds028017.mongolab.com"
});
var quarry = new Quarry({
persistence: "redis",
"redis-host": "quarry.abcdef.0001.use1.cache.amazonaws.com"
});
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"
});
quarry.persistence.get_configuration(function(err, configuration){
if(err)
throw err;
var records = configuration.records;
});
quarry.persistence.get_configuration(function(err, configuration){
if(err)
throw err;
var record = configuration.records["www.domain.com"];
});
quarry.persistence.create_record("www.domain.com", { address: "1.2.3.4", type: "A", ttl: 60 }, function(err){
if(err)
throw err;
});
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;
});
quarry.persistence.delete_record("www.domain.com", function(err){
if(err)
throw err;
});
quarry.persistence.get_configuration(function(err, configuration){
if(err)
throw err;
var forwarders = configuration.forwarders;
});
quarry.persistence.get_configuration(function(err, configuration){
if(err)
throw err;
var forwarder = configuration.forwarders["8.8.8.8"];
});
quarry.persistence.create_forwarder("8.8.8.8", { timeout: 500, port: 53 }, function(err){
if(err)
throw err;
});
quarry.persistence.update_forwarder("8.8.8.8", { timeout: 1000, port: 53 }, function(err){
if(err)
throw err;
});
quarry.persistence.delete_forwarder("8.8.8.8", function(err){
if(err)
throw err;
});
Please feel free to contribute by opening issues and creating pull requests!