You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+56-67Lines changed: 56 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,75 +14,58 @@ See the [development roadmap](https://github.com/jembi/openhim-core-js/wiki/Open
14
14
15
15
See [the documentation](https://github.com/jembi/openhim-core-js/wiki) for more details to get started.
16
16
17
-
# Quickstart Guide
17
+
For additional information and tutorials see [openhim.org](http://openhim.org).
18
18
19
-
0. Install [Node.js](http://nodejs.org/) 0.11.9 or greater
20
-
1. Install and start [MongoDB](http://www.mongodb.org/)
21
-
2. Clone the `https://github.com/jembi/openhim-core-js.git` repository or download [the code](https://github.com/jembi/openhim-core-js/archive/master.zip) to the desired location
22
-
3. In the root folder of the downloaded/cloned source, run `sudo npm install . -g`
23
-
5. Start the server by executing `openhim-core`
19
+
Getting started with the OpenHIM-core
20
+
-------------------------------------
24
21
25
-
Alternatively you can also use one of the following options:
26
-
* use [Vagrant](https://github.com/jembi/openhim-core-js/wiki/Running-the-OpenHIM-using-Vagrant) to fire up an instance if you're a developer, or just want a quick instance to test with, or
27
-
* use [Puppet](https://github.com/jembi/openhim-core-js/wiki/OpenHIM-Installation-using-Puppet) to deploy an instance on a server.
22
+
1. Install the latest stable [Node.js](http://nodejs.org/) 0.12.0 or greater.
23
+
2. Install and start [MongoDB](http://www.mongodb.org/) 2.4 or greater.
24
+
3. Install the OpenHIM-core package globally: `npm install openhim-core -g`, this will also install an openhim-core binary to your PATH.
25
+
4. Start the server by executing `openhim-core` from anywhere.
28
26
29
-
Installation and Development
30
-
============================
27
+
To make use of your own custom configurations you can copy the [default.json](https://github.com/jembi/openhim-core-js/blob/master/config/default.json) config file and override the default setting:
31
28
32
-
Clone the `https://github.com/jembi/openhim-core-js.git` repository or download [the code](https://github.com/jembi/openhim-core-js/archive/master.zip).
33
-
34
-
Prerequisites
35
-
-------------
36
-
*[Node.js](http://nodejs.org/) 0.11.9 or greater
37
-
*[Koa framework](http://koajs.com/)
38
-
*[MongoDB](http://www.mongodb.org/)
39
-
40
-
The OpenHIM core makes use of the [Koa framework](http://koajs.com/), which requires node version 0.11.9 or greater. Node also has to be run with the `--harmony` flag for this allocation to work.
41
-
42
-
The easiest way to use the latest version of node is to install [`nvm`](https://github.com/creationix/nvm). On Ubuntu, you can install using the install script but you have to add `[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh # This loads NVM` to the end of your `~/.bashrc` file as well.
**Note:** one of the first things that you should do once the OpenHIM is up and running is setup a properly signed TLS certificate. You can do this through the [OpenHIM console](https://github.com/jembi/openhim-console) under 'Certificates' on the sidebar.
45
36
46
-
`nvm install 0.11`
37
+
Developer guide
38
+
---------------
47
39
48
-
`nvm alias default 0.11`
40
+
You can use vagrant if you would want to get up and running quickly with a dev environment in a vm. See here to [use Vagrant](https://github.com/jembi/openhim-core-js/wiki/Running-the-OpenHIM-using-Vagrant) to fire up an instance.
49
41
50
-
The latest version of node 0.11 should now be installed and set as default. The next step is to get all the required dependencies using `npm`. Navigate to the directory where the openhim-core-js source is located and run the following:
42
+
Clone the `https://github.com/jembi/openhim-core-js.git` repository.
51
43
52
-
`npm install`
44
+
Ensure you have the following installed:
45
+
*[Node.js](http://nodejs.org/) 0.12.0 or greater
46
+
*[MongoDB](http://www.mongodb.org/) (in Ubuntu run `sudo apt-get install mongodb`, in OSX using [Homebrew](http://brew.sh), run `brew update` followed by `brew install mongodb`)
53
47
54
-
In order to run the OpenHIM core server, [MongoDB](http://www.mongodb.org/) must be installed and running.
48
+
The OpenHIM core makes use of the [Koa framework](http://koajs.com/), which requires node version 0.12.0 or greater. Node also has to be run with the `--harmony` flag for Koa to work as it needs generator support.
55
49
56
-
### Installing MongoDB
57
-
_Skip this section if you have already installed MongoDB_
* using [Homebrew](http://brew.sh), run `brew update` followed by `brew install mongodb`
62
-
* To install MongoDB on Windows, follow the [Windows install instructions](http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/).
50
+
The easiest way to use the latest version of node is to install [`nvm`](https://github.com/creationix/nvm). On Ubuntu, you can install using the install script but you have to add `[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh # This loads NVM` to the end of your `~/.bashrc` file as well.
63
51
64
-
For further information see the [MongoDB installation documentation](http://docs.mongodb.org/manual/installation/).
52
+
Once `nvm `is installed, run the following:
65
53
66
-
### Starting MongoDB
54
+
`nvm install 0.12`
67
55
68
-
*[Starting MongoDB on Linux](http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/#run-mongodb):
69
-
* in Ubuntu run `sudo service mongodb start`
70
-
*[Starting MongoDB on OSX](http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/#run-mongodb)
71
-
* run `mongod` (or `mongod --dbpath <some alternate directory>` to manually specify your data directory)
72
-
* To run MongoDB on Windows, see the [Windows documentation](http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/#start-mongodb).
56
+
`nvm alias default 0.12`
73
57
74
-
For more information see the [MongoDB getting started guide](http://docs.mongodb.org/manual/tutorial/getting-started/).
58
+
The latest version of node 0.12 should now be installed and set as default. The next step is to get all the required dependencies using `npm`. Navigate to the directory where the openhim-core-js source is located and run the following:
75
59
76
-
### Testing
77
-
This step is optional but recommended to ensure that the system is running as expected. To run the tests see the [Testing](https://github.com/jembi/openhim-core-js#testing-1) section below.
60
+
`npm install`
78
61
62
+
Then build the project:
79
63
80
-
Running the server
81
-
==================
64
+
`grunt build`
82
65
83
-
First make sure the project is build by running `grunt build`.
66
+
In order to run the OpenHIM core server, [MongoDB](http://www.mongodb.org/) must be installed and running.
84
67
85
-
Once all the prerequisites have been installed, configured and started, run the OpenHIM core server by executing the following:
68
+
To run the server, execute:
86
69
87
70
`node --harmony lib/server.js`
88
71
@@ -92,54 +75,60 @@ The server will by default start in development mode using the mongodb database
92
75
93
76
This starts the server with production defaults, including the use of the production mongodb database called 'openhim'.
94
77
95
-
To make use of your own custom configurations you can copy the [default.json](https://github.com/jembi/openhim-core-js/blob/master/config/default.json) config script and keep the settings you wish to override. You can then override the default configuration settings with the following command:
78
+
This project uses [mocha](http://visionmedia.github.io/mocha/) as a unit testing framework with [should.js](https://github.com/visionmedia/should.js/) for assertions and [sinon.js](http://sinonjs.org/) for spies and mocks. The tests can be run using `npm test`.
96
79
97
-
`--conf=path/to/customConfig.json`
80
+
**Useful tips:**
98
81
99
-
So to start a production server with a custom config script it will look something like this:
*`grunt watch` - will automatically build the project on any changes.
83
+
*`grunt lint` - ensure the code is lint free, this is also run before an `npm test`
84
+
*`npm link` - will symlink you local working directory to the globally installed openhim-core module. Use this so you can use the global openhim-core binary to run your current work in progress. Also, if you build any local changes the server will automatically restart.
101
85
102
86
Running the OpenHIM on boot
103
-
===========================
87
+
---------------------------
104
88
105
89
To help you get the OpenHIM server running on boot we supply a upstart config file (good for Ubuntu or other system that use upstart). Install the upstart config by doing the following:
If you require custom config you will have to edit `openhim-core.conf` to add in the `--conf` parameter pointing to your external config file.
103
+
104
+
Contributing
105
+
------------
106
+
107
+
You may view/add issues here: https://github.com/jembi/openhim-core-js/issues
108
+
109
+
To contibute code, please fork the repository and submit a pull request. The maintainers will review the code and merge it in if all is well.
110
+
115
111
Exporting/Importing Server Configuration
116
-
===========================
112
+
----------------------------------------
113
+
114
+
**Note:** This can now be done from the OpenHIM console which may be easier.
117
115
118
116
### Exporting
117
+
119
118
Follow the below steps to export and import the server metadata configuration. By default, the Users, Channels, Clients, ContactGroups and Mediators collections will be exported.
120
119
Copy the file [openhim-configuration-export.sh](https://github.com/jembi/openhim-core-js/blob/master/resources/openhim-configuration-export.sh) to a folder where you wish your export to be saved. Run the shell scrip by executing the following command:
121
120
`./openhim-configuration-export.sh`
122
121
123
122
Your exported collections should be located in the folder structure '/dump/openhim/'.
124
123
125
124
### Importing
125
+
126
126
To import you data successfully ensure that you are in the correct folder where the dump files are located. Execute the below command to import your collections.
127
127
`mongorestore --db openhim dump/openhim`
128
128
129
129
NB! if you have changed your database name, then do so for the export/import as well.
130
130
NB! Please ensure that you stop the server before exporting and importing.
131
131
132
-
133
-
Testing
134
-
=======
135
-
136
-
This project uses [mocha](http://visionmedia.github.io/mocha/) as a unit testing framework with [should.js](https://github.com/visionmedia/should.js/) for assertions and [sinon.js](http://sinonjs.org/) for spies and mocks. The tests can be run using `grunt`:
137
-
```
138
-
grunt test
139
-
```
140
-
141
-
Alternatively you can also run the tests using `npm test`.
0 commit comments