$ brew install couchdb
It may throw an exception while compiling erlang. If so, you need to install a different gcc, reinstall erlang, then try the couchdb install again:
$ brew install apple-gcc42
$ brew reinstall -v --use-gcc erlang
> Took a REALLY long time
$ brew install couchdb
$ subl /usr/local/etc/couchdb/local.ini
[httpd]
secure_rewrites = false
[ssl]
verify_ssl_certificates = false
ssl_certificate_max_depth = 1
[admin]
admin = mysecretpassword
$ couchdb
Open Futon and sign in as the Admin:
Create the NPM Registry Database:
$ curl -X PUT http://admin:[email protected]:5984/registry
Clone npmjs.org, then:
$ npm install
Configure NPM to talk to your couch db:
$ npm config set _npmjs.org:couch=http://admin:[email protected]:5984/registry
At present, the mainline repository and instructions do not work. We need to instead use the code from a repository that does work.
Clone npmjs.org, add the correct remote and checkout the correct branch from the remote:
$ git clone [email protected]:npm/npmjs.org.git
$ cd npmjs.org
$ git remote add rvagg [email protected]:rvagg/npmjs.org.git
$ git checkout -t rvagg/new-install-docs
Now that we've got the code, we need to install its dependencies and load it into couchdb:
$ npm install
$ npm start
$ npm run load
Fix the next command (npm run copy
) before running. Open copy.sh
. It is not properly passing the auth username to curl. Change the last command from:
$ curl -k $auth "$url/_design/scratch" \
-X COPY \
-H destination:'_design/app'$rev
to:
curl -k -u admin "$url/_design/scratch" \
-X COPY \
-H destination:'_design/app'$rev
Then run it:
$ npm run copy
From FUTON:
- Remote Database: http://isaacs.iriscouch.com/registry
- Local Database: http://admin:[email protected]:5984/registry
From the command line
$ curl -H 'Content-Type: application/json' \
-X POST http://admin:[email protected]:5984/_replicator \
-d '{"source": "http://isaacs.iriscouch.com/registry", "target": "http://admin:[email protected]:5984/registry"}'
> {"ok":true,"id":"e25d8c28e6356ef15909fa251700185e","rev":"1-73efd11a1223fe69dc8652fb8ac03a0a"}
To cancel the previous replication, DELETE the item in the _replicator database using the document id and rev:
$ curl -H 'Content-Type: application/json' \
-X DELETE http://admin:[email protected]:5984/_replicator/e25d8c28e6356ef15909fa251700185e?rev=1-73efd11a1223fe69dc8652fb8ac03a0a
> {"ok":true,"id":"...","rev":"..."}
Configure npm
to speak to local registry (note the lack of user:pass):
$ npm config set registry http://127.0.0.1:5984/registry/_design/app/_rewrite
Test that this works by performing a search:
$ npm search dean
Add your npm user to the users database. This should match the user you have configured on the main NPM registry
$ npm adduser
Add this to any private package.json:
"publishConfig":{
"registry":"http://127.0.0.1:5984/registry/_design/app/_rewrite"
}
quick correction on the curl command you mentioned above to setup the replication:
the change is that the "target" attribute is jus the name of the DB, not the full URL.