2.2.1 • Published 2 months ago

zgrzyt v2.2.1

Weekly downloads
14
License
MIT
Repository
github
Last release
2 months ago

NPM version Build Status

zgrzyt

Poor man's load balancing DNS switcher.

Install

$ npm install --global zgrzyt

Usage

Zgrzyt assumes that you have two or more servers (alfa and beta in our below) configured to serve an API or a web site (example.com). It also assumes that you are using Cloudflare DNS to configure CNAME records for example.com to point to either alfa or beta servers.

Zgrzyt will poll all configured servers and will ensure that CNAME record points to the server that responds (HTTP 2xx code) to the poll.

# using command line only
zgrzyt --servers alfa.example.net --servers alfa.example.net --api.url  https://example.com --cloudflare.token XXXX

# using config only but forcing the first responding server to become the active one
zgrzyt --force

Configuration

zgrzyt is using rc package to read its config - you can keep one or more config files in the standard places described in rc documentation (such as /etc/zgrzytrc or /etc/zgrzyt/config). You can pass one or more locations using --config parameter.

; list of potential servers configured for this domain CNAME record
servers[]=alfa.example.net
servers[]=beta.example.net
ipv6=true          ; by default ipv4 is true and ipv6 is false

[cloudflare]
; cloudflare API token
token=XXXXXX

[api]
; API URL to be tested on each of the servers
url=https://api.example.net/status
timeout=250        ; optional, in millis
retry=2            ; optional, by default zgrzyt retries 2 times before assuming API endpoint is down 
domain=example.net ; optional, domain for which zgrzyt will update DNS record
method=HEAD        ; optional, HTTP method used by zgrzyt

If api.domain is not specified its value is deduced from api.url. If api.method is not specified zgrzyt will send HEAD requests to poll the servers. api.method can be set to GET if needed. retry, timeout, ipv4, and ipv6 can be either configured globally or separately for each API.

Multiple checks

It's possible to check multiple domains from a single config

[api.one]
url=https://one.example.net/status

[api.two]
url=https://two.example.net/status

Each API can specify its own list of servers (presumably different from the default list of servers) using cluster parameter.

[cluster.europe]
servers[]=berlin.example.com
servers[]=warsaw.example.com

[api.one]
url=https://one.example.net/status
cluster=europe

License

MIT © Damian Krzeminski

2.2.1

2 months ago

2.2.0

3 months ago

2.1.1

4 months ago

2.0.3

6 months ago

2.1.0

6 months ago

2.0.2

7 months ago

2.0.1

7 months ago

1.6.1

1 year ago

2.0.0

1 year ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago