npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zgrzyt

v2.2.1

Published

Poor man's load balancing DNS switcher.

Downloads

55

Readme

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