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
- NodeJS is installed
Make sure the OpenHIM Core is not currently running on your machine before proceeding.
To help you get the OpenHIM server running on boot we supply a script for
To setup the service create the following file with your editor of choice (vim in this example) and put in the above content:
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).
ExecStart field should look something like this:
If you have installed NodeJS using
nvmthe directory base will be
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: