HOWTO: install Indivo X
From Indivo
Contents |
[edit] Defaults
This document sets up the Indivo backend server and Indivo UI server on the same machine. The backend server runs on port 8000, the UI server on port 80 by default. This is configurable by changing the appropriate port numbers in the instructions below.
This document is up-to-date for Indivo X alpha 3 (0.8.3). See the Indivo X Alpha 3 (0.8.3) Release Notes.
[edit] Pre-Requisites
This documents the installation of a complete Indivo X server and user interface. For concreteness, we show all of the exact instructions needed when installing on Ubuntu Linux 10.04 (Lucid). We welcome variants of these explicit instructions from folks installing on other operating systems, we will be happy to post them alongside these instructions.
- Recent Linux installation (Kernel 2.6+)
- Note: We recommend you do this by sudo'ing from a non-root user. If you would like to do this as root make sure you create at least one non-root user with `useradd -m {USER}` otherwise the default locale will not be set. This issue is most common on a new OS build.
- PostgreSQL 8.3+ (8.4 recommended and the default on Ubuntu 10.04)
apt-get install postgresql
- Python 2.6 (NOT 2.5 or below) with packages: libxml2, libxslt1, psycopg2
apt-get install python-psycopg2 python-libxml2 python-libxslt1
- Django 1.1
apt-get install python-django
- Apache 2 (for production) with module mod_wsgi (mod_ssl for HTTPS is strongly recommended for production, but we won't cover its installation here.)
apt-get install apache2-mpm-prefork
- NOTE: For Lucid, you may need to do an apt-get update before making the following command:
apt-get install libapache2-mod-wsgi
[edit] Setup Database
You'll have the easiest time naming your database indivo
- There are two ways to authenticate to PostgreSQL: use your Unix credentials, or use a separate username and password. We strongly recommend the latter, and our instructions are tailored appropriately. If you know how to use PostgreSQL and want to use Unix-logins, go for it, just remember that when you use Apache, it will usually try to log in using its username, www-data.
- in /etc/postgresql/8.4/main/pg_hba.conf, find the line that reads:
local all all ident
This should be the second uncommented line in your default config. Change ident to md5:
local all all md5
You will need to restart PostgreSQL:
service postgresql-8.4 restart
- Create a PostgreSQL user for your Indivo service, e.g. "indivo" and setup a password
su - postgres createuser --superuser indivo psql postgres=# \password indivo
- Create the Database and make the Indivo user its owner.
createdb -O indivo indivo
[edit] Download, Install, and Configure Indivo Backend Server
- Download the latest release of Indivo X (see Releases) and untar into indivo_server/. Do not change this directory name--it will break the django settings file.
- Copy settings.py.default to settings.py, and update a few key parameters:
- set DATABASE_USER to the username you chose, in this documentation web, and set DATABASE_PASSWORD accordingly.
- set APP_HOME to the complete path to the location where you've installed indivo_server, e.g. /web/indivo_server
- set SITE_URL_PREFIX to the URL where your server is running, including port number e.g. https://pchr.acme.com:8443
- set the EMAIL_* parameters appropriately for sending out emails.
- set the SEND_MAIL parameter to True or False depending on whether you want emails actually being sent.
- set SECRET_KEY to a unique value, and don't share it with anybody
- Under utils/ copy indivo_data.xml.default to indivo_data.xml and edit accordingly.
- Using reset.sh:
- Reset can take three optional flags:
-b Load bootstrap -c Load coding systems -s syncdb
For all simply run:
./reset.sh -bcs
You must run reset.sh before the accounts and applications you set up in indivo_data.xml exist.
[edit] Coding Systems
Indivo uses SNOMED CT for problem coding and HL7v3 for immunization coding. Medication coding will likely use RxNorm. In most cases, the license on these coding systems does not allow us to redistribute these codes with Indivo. We don't like this. We wish we had truly free coding systems for health. But there's not much we can do about this for now.
What we've done is make it easy for you to load coding systems into Indivo if you can get them independently. Get the HL7 v3 codes from hl7.org, get the SNOMED CT dataset from UMLS. You should see "|"-separated files. Examples of how these files are formatted can be found in codingsystems/data/sample. Once you've downloaded these files independently from the coding system agencies, copy them to:
- codingsystems/data/complete/SNOMEDCT_CORE_SUBSET_200911_utf8.txt
- codingsystems/data/complete/HL7_V3_VACCINES.txt
Once that's done, assuming you've installed everything in /web/indivo_server, you can run
utils/reset.sh -bcs
and have everything loaded properly.
[edit] Download, Install, and Configure UI Server
- Download the latest release of Indivo X UI Server (see Releases) and untar into indivo_ui_server/. Do not change this directory name--it will break the django settings file.
- Copy settings.py.default to settings.py, and update a few key parameters:
- set INDIVO_UI_BASE to the complete path to the location where you've installed indivo_ui_server, e.g. /web/indivo_ui_server
- set INDIVO_SERVER_LOCATION, CONSUMER_KEY, CONSUMER_SECRET appropriately to match the Indivo Server's location and chrome credentials (check utils/indivo_data.xml BEFORE you syncdb on the server end).
- set SECRET_KEY to a unique value, and don't share it with anybody
[edit] Running the Development Servers
The Django development servers are easy to run at the prompt.
The backend server can run on localhost in the configuration given above:
cd /web/indivo_server/ python manage.py runserver 8000
The UI server, if you want it accessible from another machine, needs to specify a hostname or IP address. If you want port 80, you need to be root of course:
cd /web/indivo_ui_server/ python manage.py runserver HOSTNAME:80
[edit] Running on Apache
Assuming you installed Indivo Server and UI in /web, the steps to getting Apache2 serving Indivo and its UI are:
- in /etc/apache2/sites-enabled/000-default, add:
<VirtualHost *:8000>
ServerAdmin YOU@localhost
ServerName localhost
DocumentRoot /web/indivo_server
Alias /static/ /web/indivo_server/static/
EnableMMAP On
EnableSendfile On
LogLevel warn
<Directory /web/indivo_server>
Order deny,allow
Allow from all
</Directory>
WSGIDaemonProcess indivo user=www-data group=www-data processes=1 maximum-requests=500 threads=10
WSGIScriptAlias / /web/indivo_server/django.wsgi
WSGIPassAuthorization On
</VirtualHost>
<VirtualHost *:80>
ServerAdmin YOU@localhost
ServerName localhost
DocumentRoot /web/indivo_ui_server
Alias /static/ /web/indivo_ui_server/ui/static/
EnableMMAP On
EnableSendfile On
LogLevel warn
<Directory /web/indivo_ui_server>
Order deny,allow
Allow from all
</Directory>
WSGIDaemonProcess indivo_ui user=www-data group=www-data processes=1 maximum-requests=500 threads=10
WSGIScriptAlias / /web/indivo_ui_server/django.wsgi
WSGIPassAuthorization On
</VirtualHost>
In our experience, using WSGIProcessGroup directive, even when it matches the WSGIDaemonProcess group name (i.e. indivo_ui), can cause a permission issue with reading the Unix socket. We will continue to investigate this issue. For now, we recommend not using this directive.
- make sure ports.conf has:
NameVirtualHost *:80 Listen 80 Listen 8000
- make sure that www-data (or whoever is in /etc/apache2/envvars) has access to indivo_server and indivo_ui_server AND can write to indivo_server/indivo.log and indivo_ui_server/session/*, including the session/ directory itself.
- since you probably did a python manage.py syncdb, you almost certainly want to just remove the current indivo.log before you move ahead.
- really, have you checked this www-data permission issue? This will be the cause of all your problems if you don't check this carefully.
- check your /etc/apache2/sites-enabled/000-default file again and make sure that your Alias /static/ lines match the above example exactly
- restart Apache:
service apache2 restart
[edit] What Next?
You should be able to log in, but you won't see any apps. We'll be releasing apps over time, but you may want to start with our Sample PHA
[edit] BEFORE YOU RUN THIS IN PRODUCTION
It's alpha. Don't run this in production.
When Indivo is ready, you'll need to do the following things:
- change the SECRET_KEY parameter in both settings.py files.
