diff --git a/README.md b/README.md index fd1c20e2af..73167521c7 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,18 @@ To install the frontend please do the following: 5. Clone this repo with `git clone https://github.com/HospitalRun/hospitalrun-frontend`, go to the cloned folder and run `script/bootstrap`. (*Note: Depending on your [npm permissions](https://docs.npmjs.com/getting-started/fixing-npm-permissions) you might need root access to install PhantomJS2; also, Windows users must run with [Cygwin](http://cygwin.org/)*). 6. Install and configure [CouchDB](http://couchdb.apache.org/) 1. Download and install CouchDB from http://couchdb.apache.org/#download - 2. Create admin user: + 2. Start CouchDB + 1. If you downloaded the installed app, navigate to CouchDB and double-click on the application. + 2. If you installed CouchDB via Homebrew or some other command line tool, launch the tool from the command line + 3. If you're stuck with the installation, check out the instructions published here: http://docs.couchdb.org/en/1.6.1/install/index.html + 3. Verify that CouchDB is running by successfully navigating to 127.0.0.1:5984/_utils. If that fails, check the installation guide for CouchDB http://docs.couchdb.org/en/1.6.1/install/index.html + 4. Create admin user: + If you are running CouchDB 1.x 1. If you have just installed CouchDB and have no admin user, please run `./script/initcouch.sh` in the folder you cloned the HospitalRun repo. A user `hradmin` will be created with password: `test`. 2. If you already have a CouchDB admin user, please run `./script/initcouch.sh USER PASS` in the folder you cloned the HospitalRun repo. `USER` and `PASS` are the CouchDB admin user credentials. + If you are running CouchDB 2.x + 1. If you have just installed CouchDB and have no admin user, please run `./script/initcouch2.sh` in the folder you cloned the HospitalRun repo. A user `hradmin` will be created with password: `test`. + 2. If you already have a CouchDB admin user, please run `./script/initcouch2.sh USER PASS` in the folder you cloned the HospitalRun repo. `USER` and `PASS` are the CouchDB admin user credentials. 7. Copy the `server/config-example.js` to `server/config.js` in the folder you cloned the HospitalRun repo. If you already had a CouchDB admin user that you passed into the couch script (`./script/initcouch.sh USER PASS`), then you will need to modify the `couchAdminUser` and `couchAdminPassword` values in `server/config.js` to reflect those credentials. (*Note: If on Mac, you need to make sure CouchDB can be run. See [How to open an app from a unidentified developer and exempt it from Gatekeeper](https://support.apple.com/en-us/HT202491).*) ### Experimental diff --git a/script/initcouch2.sh b/script/initcouch2.sh new file mode 100755 index 0000000000..7fa8ae73ce --- /dev/null +++ b/script/initcouch2.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +URL="localhost" +PORT="5986" +PORT2="5986" + +if [ -z "${1}" ] || [ -z "${2}" ]; then + HOST="http://$URL:$PORT" + curl -X PUT $HOST/_config/admins/couchadmin -d '"test"' + SECUREHOST="http://127.0.0.1:test@$URL:$PORT" + SECUREHOST2="http://127.0.0.1:test@$URL:$PORT2" +else + SECUREHOST="http://$1:$2@$URL:$PORT" + SECUREHOST2="http://$1:$2@$URL:$PORT2" +fi +curl -X PUT $SECUREHOST2/_users/_security -d '{ "admins": { "names": [], "roles": ["admin"]}, "members": { "names": [], "roles": []}}' +curl -X PUT $SECUREHOST/config +curl -X PUT $SECUREHOST/config/_security -d '{ "admins": { "names": [], "roles": ["admin"]}, "members": { "names": [], "roles": []}}' +curl -X PUT $SECUREHOST/main +curl -X PUT $SECUREHOST/main/_security -d '{ "admins": { "names": [], "roles": ["admin"]}, "members": { "names": [], "roles": ["user"]}}' +curl -X PUT $SECUREHOST2/_config/http/authentication_handlers -d '"{couch_httpd_oauth, oauth_authentication_handler}, {couch_httpd_auth, proxy_authentification_handler}, {couch_httpd_auth, cookie_authentication_handler}, {couch_httpd_auth, default_authentication_handler}"' +curl -X PUT $SECUREHOST2/_config/couch_httpd_oauth/use_users_db -d '"true"' +curl -X PUT $SECUREHOST2/_users/org.couchdb.user:hradmin -d '{"name": "hradmin", "password": "test", "roles": ["System Administrator","admin","user"], "type": "user", "userPrefix": "p1"}'