-
Notifications
You must be signed in to change notification settings - Fork 154
Installation
These instructions are for installing the most up to date version of the popHealth application. They are based off of installing from the current master branch of repository which is a work in progress until it is tagged.
You will need an NLM VSAC account to download value set definitions and finalize the installation of the VM. You can sign up for an NLM VSAC account at https://uts.nlm.nih.gov/home.html. Click the Sign Up link in the upper right of the page
The ISO for ubuntu 12.04 LTS can be downloaded from the following URL: http://releases.ubuntu.com/precise/ These instructions were developed against the "64-bit PC (AMD64) server install CD" (ubuntu-12.04.1-server-amd64.iso). Installing Ubuntu is a fairly straight-forward process, but for more details on installing Ubuntu please visit the following URLs: **Graphical install using the desktop CD:** https://help.ubuntu.com/community/GraphicalInstall **Installation using the Alternate CD (more configuration options):** https://help.ubuntu.com/12.04/installation-guide/index.html Once Ubuntu has been installed you need to update the Apt packages. Apt is a software package management system used by Ubuntu. Note: the last command in the group below is only necessary if any packages were actually upgraded. sudo apt-get update sudo apt-get upgrade sudo shutdown -r now Now on with the manual install process. You will likely want to install an SSH server. This will allow you to connect remotely to the machine. sudo apt-get install openssh-server Once SSH is installed, you can determine the IP address of the machine using the command ifconfig In the output of this command, look under the block labelled eth0, you should find an IP address after the label **inet addr:**. # 2. Configure Proxy Settings
This step is only required if the server you are installing popHealth onto needs to go through an HTTP proxy server to reach the internet. These steps will ensure that the appropriate proxy settings are in place for every user that logs into the system.
Use your favourite text editor to create a file in /etc/profile.d named http_proxy.sh with the following contents. In the sample below, replace your.proxy.host.com with the fully-qualified host name of your proxy server, and your.proxy.port with the port number that the proxy server uses.
# Set up system-wide HTTP proxy settings for all users http_proxy='http://your.proxy.host.com:your.proxy.port/' https_proxy='http://your.proxy.host.com:your.proxy.port/' export http_proxy https_proxy
Set proper permissions on the new file, and load the settings into the current environment. NOTE: the proxy settings will automatically be loaded when a user logs in, but we are manually loading them here, to avoid having to log out and log back in again.
sudo chmod 0644 /etc/profile.d/http_proxy.sh source /etc/profile.d/http_proxy.sh
Make sure that the sudo command will allow the new proxy settings to be passed to commands it launches. This is done by using your text editor to create a file in the /etc/sudoers.d directory named http_proxy (no extension) with the following contents:
# keep http_proxy environment variables. Defaults env_keep += "http_proxy https_proxy"
Set proper permissions on the new file:
sudo chmod 0440 /etc/sudoers.d/http_proxy
Git is a source control system. It will be used later to download the popHealth source code. sudo apt-get install git-core # 4. Installing RVM and Ruby 2.1.1
RVM is a system that allows managing different versions of Ruby. It will allow the correct version of ruby to be easily installed on the system. Ruby is the development language used for the popHealth application.
First we will need to install some dependencies:
sudo apt-get install build-essential openssl libssl-dev libreadline6 libreadline6-dev curl zlib1g zlib1g-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
Next install RVM. This will install RVM for all users
curl -L get.rvm.io | sudo -i bash -s stable
Log out, and then log back in again so that the settings RVM installs will be loaded in your environment. Once you have logged back in, run the following commands. These will install some more dependencies.
We will install these dependencies using an admin console. The admin console can be opened with the following command:
sudo -i
Next we want to set the autolibs flag in rvm
rvm autolibs enable
Next we want to install Ruby 2.1.1 using RVM
rvm install 2.1.1
If you get a message about installing dependencies, press 'q'. We have already installed everything we will need.
Set ruby version 2.1.1 to be the default version:
rvm --default 2.1.1
Finally install bundler. Bundler is a Ruby Gem that allows downloading additional dependencies once we have the popHealth source code:
gem install bundler -v '1.3.0'
Close the admin console by running:
exit
setup rvm for the admin user:
source /etc/profile.d/rvm.sh rvm use 2.1.1 rvm --default 2.1.1
MongoDB is the database used by popHealth. To install MongoDB run the commands: sudo sh -c "echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' >> /etc/apt/sources.list" sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 sudo apt-get update sudo apt-get install mongodb-10gen To test connection (wait at least 15 seconds to let the db start up), run the command below. If the command exits with a error about not being able to connect, then reboot, and log back in as the admin user. Sometimes mongodb fails to create a network socket when it is started immediately after installation. It should automatically start when the system is rebooted. mongo This should output **_MongoDB shell version: 2.4.x_** Note that the version must read 2.2.0 or later (at the time these instructions were written, the current release version of mongodb was 2.4.9). Type 'exit' to exit the mongo shell exit # 6. popHealth Source Code
add pophealth user (only if you did not create the VM with a popHealth user, i.e., when using EC2)
sudo adduser pophealth sudo usermod -G sudo pophealth sudo su - pophealth
Getting the popHealth code
wget https://github.com/pophealth/popHealth/archive/master.zip unzip master.zip mv popHealth-master popHealth cd popHealth
bundle install exit
popHealth releases measure bundles that contain the measure artifacts that are needed to begin the measure calculation process: In addition to the measure bundle, the value sets need to be loaded into popHealth from the NLM VSAC Service. You will need an NLM account in order to complete this step and load value sets from the VSAC service._ Register for an account at: https://uts.nlm.nih.gov/home.html **Run the following command to download the measure bundle** Note that the NLM username/password must be entered as part of the third command below: sudo su - pophealth cd /home/pophealth/popHealth curl -u NLM_USERNAME:NLM_PASSWORD http://demo.projectcypress.org/bundles/bundle-latest.zip -o ../bundle-latest.zip Once you have the bundle and the account you can run the following commands to load the bundle. cd /home/pophealth/popHealth bundle exec rake bundle:import[/home/pophealth/bundle-latest.zip,,,,,true] RAILS_ENV=production # 8. Seed the database
The popHealth database requires some look up data for things like race and ethnicity codes be available. To set this up, run the following commands:
cd /home/pophealth/popHealth bundle exec rake db:seed RAILS_ENV=production
Configure delayed job to start up on server startup. At this point, you should still have a shell open as the popHealth user: cd ~ echo -e '#!/bin/bash\ncd /home/pophealth/popHealth\n. /usr/local/rvm/scripts/rvm\nbundle exec rake jobs:work RAILS_ENV=production\n' > start_delayed_job.sh chmod +x start_delayed_job.sh echo -e 'start on started mongodb\nstop on stopping mongodb\n\nscript\nexec sudo -u pophealth /home/pophealth/start_delayed_job.sh >> /tmp/delayed_worker.log 2>&1\nend script\n' > /tmp/delayed_worker.conf sudo mv /tmp/delayed_worker.conf /etc/init/delayed_worker.conf sudo start delayed_worker exit # 10. Configure Passenger / Apache
Install apache and passenger with the following commands:
sudo -i apt-get install apache2 gem install passenger -v '3.0.18'
These should be the dependencies required for passenger:
apt-get install libcurl4-openssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev
Install the apache passenger module. If you need other dependencies, the installer will tell you:
passenger-install-apache2-module
The end of the passenger apache module install will tell you to edit two files.
The following set of commands will do those edits for you. Update the site configuration with:
echo -e '<VirtualHost *:80>\n DocumentRoot /home/pophealth/popHealth/public\n <Directory /home/pophealth/popHealth/public>\n AllowOverride all\n Options -MultiViews\n </Directory>\n</VirtualHost>\n' > /tmp/default mv /tmp/default /etc/apache2/sites-available/pophealth
Make the default apache site be the popHealth provided content:
rm /etc/apache2/sites-enabled/000-default ln -s /etc/apache2/sites-available/pophealth /etc/apache2/sites-enabled/000-default
Update the apache configuration with the following commands:
echo 'LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-3.0.18/ext/apache2/mod_passenger.so' > /etc/apache2/mods-available/pophealth.conf echo 'PassengerRoot /usr/local/rvm/gems/ruby-2.1.1/gems/passenger-3.0.18' >> /etc/apache2/mods-available/pophealth.conf echo 'PassengerRuby /usr/local/rvm/wrappers/ruby-2.1.1/ruby' >> /etc/apache2/mods-available/pophealth.conf ln -s /etc/apache2/mods-available/pophealth.conf /etc/apache2/mods-enabled/pophealth.conf
Restart apache:
service apache2 restart
Exit the root shell:
exit
popHealth requires that CSS and image files be placed into the appropriate location before usage. To do so, first open config/environments/production.rb and find the line config.assets.digest = true and after it add the following line config.assets.precompile << '*.scss' You need to install node.js: sudo apt-get install nodejs Then open a shell as the pophealth user: cd popHealth bundle exec rake assets:precompile To open the popHealth web app you'll need the server IP address from step 1. The server IP address was found from the ifconfig command. Open a web browser and enter http://<server_ip_address from step 1>/ This should open the popHealth web application. Click on the "Create New User" link to add a new user and to get started with popHealth