The intent of this script and docker file is to test geo-location of DNS resolution. Many providers do this in different ways, and we need to be able to test that data.
Set your ENV. You can provide a <environment>.env
file and pass that to the run_test.sh script:
./run_test.sh example
This will run the docker container, but mount the script to it from local for testing.
You can run this anywhere using docker. Just pass an env file like the example.
docker run -itd --name resolver --env-file example.env readytalk/dns-geo-analyzer:latest
Note the nameserver and sites have the format ,<dns/ip>. This is to avoid having dots in the metric names for ES
This is setup to also run as a prometheus endpoint. There is an example daemonset so that you can run it on as many nodes as possible. Enable the PROMETHEUS_PORT to start a server on that port. The annotation on the daemonset coupled with the port specification will allow prometheus to scan it. See the code or the endpoint for details about the metrics available.
You can enable this by setting the IPSTACK_API_KEY env variable. This will use your api key to lookup geolocation data.
WARNING: This will use up your API calls. Don't make too many like I did an destroy your API limit in 2 days.
Set the ES_ENDPOINT and ES_INDEX to send these json objects to elasticsearch. Currently uses ES version 5.0, but could easily work with 6.0 by modifying the requirements.txt
This will control how often the server makes requests and queries. It is number of seconds.
The nubmer of seconds that a DNS query will wait to timeout
The format of the ENV is very specific. The short names are used so that we don't have dots in the keys, which makes the data ugly in ES