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

npm-replicator-monitor

v0.0.1

Published

Continuous monitor for mirrored npm registries, check and reset replicator as required

Downloads

2

Readme

npm-replicator-monitor

NPM

Monitor the replication status of an npm mirror and give it a kick if it gets stuck

$ npm-replicator-monitor -c config.json

Where config.json might look something like:

{
    "couchUrl"       : "http://my.npm.mirror.foo.com:5984"
  , "couchUser"      : "admin"
  , "couchPass"      : "fs98dkKHs87lasl"
  , "db"             : "registry"
  , "checkInterval"  : 3600000
  , "replicationDoc" : {
        "source"     : "https://fullfatdb.npmjs.com/registry"
      , "target"     : "registry"
      , "continuous" : true
      , "user_ctx"   : {
            "name"  : "admin"
          , "roles" : [ "_admin" ]
       }
    }
}

You need to ensure that you have an existing _replicator entry named "registry" for this to work.

What?

In my experience (not necessarily shared by others and may be caused by living on the other side of the planet to npm), the _replicator replication mechanism in CouchDB is a little brittle and can get stuck. It can even watch the upstream sequence count increase and not do anything about it even while the replication is in a "triggered" state.

An easy solution is to restart CouchDB when you notice this problem, but that's a brittle solution! An easier solution is to delete and re-create the _replicator doc for the npm registry which will trigger a re-start of the replication. It quickly figures out where it's at and starts again.

npm-replicator-monitor uses couch-replicator-api to monitor the status of the registry replication and if it's observed to be behind the source sequence and stuck at the same sequence number over two check intervals (interval time is set in config.json) then it'll delete the _replicator doc and re-insert it and start monitoring again.

Actual check interval will depend on the speed of your computer (i.e. it can be stuck but actually working on the data, as observed by CPU usage, so you generally want to leave it alone when it does this), and the speed of your connection.

License

npm-replicator-monitor is Copyright (c) 2014 Rod Vagg @rvagg and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.