iros / local-npmjs-skimdb

Vagrant file and instructions for setting up a local couchdb replica of https://skimdb.npmjs.com/registry

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup your own npm skim db replica

https://skimdb.npmjs.com/registry is the couchdb registry, minus the actual packages, meaning it's small. If you're just trying to get data about available packages, this is probably the easiest way to go about it.

Setup your box

First, setup your couchdb server.

  1. Run npm install if you're going to run any of the data scripts.

  2. Run vagrant up.

  3. Run vagrant ssh.

  4. Install couch:

    sudo apt-get update
    sudo apt-get install build-essential autoconf automake libtool erlang libicu-dev libmozjs-dev libcurl4-openssl-dev
    wget http://mirrors.ibiblio.org/apache/couchdb/source/1.6.0/apache-couchdb-1.6.0.tar.gz
    tar xvf apache-couchdb-1.6.0.tar.gz
    cd apache-couchdb-1.6.0/
    ./configure
    make
    sudo make install
  5. Change couchdb bind address, so you can access it by editing

    vi /usr/local/etc/couchdb/default.ini

Change bind_address to 0.0.0.0. More instructions here if you want to be more specific.

  1. Start Couch

While ssh'd into vagrant box, run sudo couchdb or sudo couchdb -d Verify you can reach it at http://192.168.33.31:5984/ (the IP is setup as a private network in the Vagrantfile. If you need to change it, change it there.)

  1. Start couch replication against skimdb:

From a terminal window that is not ssh'd to the vagrant box:

curl -X POST http://192.168.33.31:5984/_replicate -d '{"source":"https://skimdb.npmjs.com/registry/", "target":"registry", "create_target":true}' -H "Content-Type: application/json"

About

Vagrant file and instructions for setting up a local couchdb replica of https://skimdb.npmjs.com/registry