-
Notifications
You must be signed in to change notification settings - Fork 3
Installation
The minimal required in order to bring up the system (such as in a development environment or to test) is Nodejs and MySQL. Development and testing has been done using Ubuntu Linux. Your mileage may vary with Mac or Windows. Running Midwife-EMR within a Linux instance running in VirtualBox is known to work well.
-
Nodejs
- version 0.10.x
- nvm is nice but not necessary.
-
MySQL or MariaDB
- Of course it might be easiest to install with the package management system of your OS.
- Git (or get the source as a zip file)
- Linux with the toolset necessary for compilation installed.
- In Ubuntu, these packages need to be installed:
- curl build-essential openssl libssl-dev git python
- In Ubuntu, these packages need to be installed:
- Get the source code
git clone https://github.com/kbsymanz/midwife-EMR.git
cd midwife-EMR
npm install
npm install -g grunt-cli
npm install -g bower
bower install
grunt
cp config/config.sample.js config/config.development.js
- Configure the application
The configuration file is in <ApplicationRoot>
/config. The file is named config.NODE_ENV.js where NODE_ENV is the value of the NODE_ENV environmental variable. Examples:
NODE_ENV=development node ./cluster.js
will use config.development.js as the configuration file.
Edit the appropriate configuration file to insure that at least the following settings are appropriate for your environment. See Configuration for more details.
cfg.site.title: the name of your site
cfg.site.languagesMap: eliminate what you don't need or leave it. Can add to it later.
cfg.host.name: what host will this run on.
cfg.host.port: what is the non-SSL port it will listen on (if only to redirect to the SSL port).
cfg.host.tlsPort: the SSL port.
cfg.tls.key: JS to read in the private server key, e.g. fs.readFileSync('cert/serverKey.pem');
. Set to false to disable SSL entirely (not recommended for production).
cfg.tls.cert: JS to read in the server certificate, e.g. fs.readFileSync('cert/serverCrtBundle.pem');
. If TLS is not to be used, comment out this line so the application does not try to read in a file that probably is not there.
cfg.database.db: name of the database.
cfg.database.host: name of the server the database is located on, e.g.
localhost
.
cfg.database.port: port the server is listening on, e.g. 3306
.
cfg.database.dbUser: username for the database.
cfg.database.dbPass: password for the database.
cfg.cache.userTTL: time in seconds users can remain logged in without activity.
cfg.session.secret: set this to something unique to you.
cfg.cookie.secret: set this to something unique to you.
- Configure the database
The database must be created and loaded with mostly empty tables except for
some lookup tables that have suggested values (which you can adjust to your
needs). Create a database user that has rights to the database using the
database/sql/create_user.sql
as a guide. Make sure to properly set the
configuration values above.
cd database/sql
mysql -h <DatabaseHost> -u <DatabaseUser> -p <DatabaseName>
From within mysql
(or whatever MySQL client you use) load these scripts.
source create_tables.sql
source create_log_tables.sql
source create_log_triggers.sql
source load_default_data.sql
Note that the load_default_data.sql
adds a user named admin to the
administrator role for the application with a default password of admin
. If
you do not want this password, use the following steps to derive a hash for
the password that you do want. Otherwise, you can always change it by getting
the application running, logging in as admin, and change your password in the
user administration section or your profile.
Only do this if you want to change the admin user's password before bringing
the system up. From the top-level directory of the Midwife-EMR application, enter
Nodejs interactively by typing node
and enter.
var bcrypt = require('bcrypt');
var salt = bcrypt.genSaltSync(10);
var hash = bcrypt.hashSync("YourSuperSecretPassword", salt);
console.log(hash);
Now put this hash in the database/sql/create_user.sql
script and use mysql
to run/load that file.
- Start the application
From the top-level of the application directory you can start the server.
NODE_ENV=development node ./cluster.js
You should see no errors and according to how you set up your configuration file, you should be able to use your web browser to access the application and login as the admin user.
When it comes to installing into production or a QA environment, there are naturally lots of options. This is the solution we use.
The same as the basic installation above plus ...
- Nginx
- Linux server
This software has a GPLv3 License.