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

couch-readonly-replica

v0.1.2

Published

A service to keep a read-only CouchDB replica up to date

Downloads

8

Readme

couch-read-replica

A CouchDB replicator that also replicates the pre-generated view data.

It does this by using rsync whenever it encounters a design doc in the changes feed. As a result, it is very important that the destination database be truly read-only. If you are putting records into the database via any other means, then Bad Things may happen.

By default, it copies ALL databases on the server. The intent is to make the replica a full copy of everything that the origin. You can configure this with the dbs option. If not set, then it'll read /_all_dbs from the remote server.

If you are using this in production, make sure that you use the copy trick with your production design docs. If you do, then the production design doc will only be copied over once the view data is copied as well. Using the copy trick ensures that the production design doc will not be copied until its view data is transferred as well. So, the read-only replicas will serve stale views for a brief time, but they'll never be completely unavailable.

USAGE

// must be run directly on the machine where couch runs.
// otherwise rsyncing won't do much good!

var Replica = require('couch-read-replica')
var r = new Replica({
  // must provide a sequence file
  // Actual files will be suffixed with the name of each db
  seqFile: 'my-replica.seq',

  // private ssh key file to use with rsync
  // ~ is ok if $HOME is set, but `~otheruser/...` won't work
  sshKey: '~/.ssh/id_rsa',

  // The user that we'll log into the other machine as.
  // defaults to $USER environ
  remoteUser: process.env.USER,

  // The url to the couch *instance*, not a single db
  remoteCouch: 'https://couchuser:[email protected]/',

  // The url to the couch instance on this box
  // almost certainly will need some kind of admin creds
  localCouch: 'http://admin:secretpassword@localhost:15984'
})