Run the OpenHIM on startup
This how to guide assumes the following
- You are working on an Ubuntu server
- The OpenHIM Core is already installed using
npm
- NodeJS is installed
Make sure the OpenHIM Core is not currently running on your machine before proceeding.
#
systemdTo help you get the OpenHIM server running on boot we supply a script for systemd
.
To setup the service create the following file with your editor of choice (vim in this example) and put in the above content:
For the ExecStart
field fill in the correct paths to NodeJS and your OpenHIM Core module. To find these directory paths try the following:
This will show you where NodeJS is installed. The OpenHIM npm module will be installed nearby (usually within ../../lib/node_modules/openhim-core
in relation to node).
Your ExecStart
field should look something like this:
If you have installed NodeJS using
nvm
the directory base will be/home/<user>/.nvm/versions/node/<node-version>/
instead of/usr/local/
Once your script is complete reload systemd with the following command:
Then, start the service:
Next check the service status:
You can confirm that the OpenHIM is accessible by navigating to https://localhost:8080/heartbeat on a browser. The browser will give you a security warning as SSL has not been setup yet. Accept the risk and the browser should return the OpenHIM uptime.
To diagnose any problems you can view the OpenHIM logs from the service with the following:
To configure the OpenHIM to run on server startup type the following: