Installation
Creating a working version of the PHR requires download and installation of the code, the third-party packages used by the PHR system, and population of the database.
The PHR system assumes that all code and third-party packages are located within a directory named def.
PHR Repository
- Clone the PHR Repository from github.com
- This should give you the def directory, which will
contain the following:
- a bashrc.def file
- a bin subdirectory, which should contain a file
and multiple softlinks. The softlinks are mostly set
to point to the packages subdirectory, which is
where the softlinks should be adjusted to match your
installation. The following softlinks are found in the
bin subdirectory:
- bundle - points to the ruby bundle script
- gem - points to the ruby gem script
- irb - points to the ruby irb script
- node - points to your node directory
- npm - points to your npm directory
- rails - points to the rails script in your ruby/bin directory
- rake - points to the rake script in your ruby/bin directory
- ruby - points to the ruby script in your ruby/bin directory
- mysql - points to your mysql executable - and is the only link that does not depend on links in the packages subdirectory
The git file, which is found the bin subdirectory is a script that we use to control how git commands are run. - a cshrc.def file, which we use to set up various development environment variables. You will certainly need to modify this for your environment.
- a dependencies.yaml file, which shows which versions various packages are using for the current code.
- a packages subdirectory, which will be empty. This
subdirectory will need to be populated with a combination
of third-party package directories and softlinks to
third-party packages, which you will need to supply as
you install the packages:
- autocomp - either the top-level directory of the autocomp-phr package or a softlink to it;
- javascript-stacktrace - either the top-level directory of the javascript-stacktrace code or a softlink to it;
- jquery - either the top-level directory of the jquery-1.9.1 code or a softlink to it;
- jquery-mobile - either the top-level directory of the jquery-mobile-1.4.2 code or a softlink to it;
- jquery-ui - either the top-level directory of the jquery-ui-1.10.1 code or a softlink to it;
- node - either the top-level directory of the node.js code or a softlink to it;
- node_modules - either the top-level directory of the node.js modules or a softlink to it; and
- ruby - either the top-level directory of the ruby code or a softlink to it.
- a proto1 sudirectory, which contains the bulk of the PHR code, and follows the Rails directory hierarchy conventions.
Third-party Packages to be Installed
We have found that your web server and database system should be in place before you try to install the other packages, particularly Ruby on Rails.MySQL or some other SQL database
- http://www.mysql.com
- we are using MySQL version 5.6.45 (linux)
- the def/bin directory contains a mysql softlink to the mysql executable. If this is not correct for your installation, update that softlink.
- make sure you set up a user before installing other packages
- we recommend specifying a secure installation, since the PHR system deals with sensitive information
A webserver such as Apache
- http://httpd.apache.org
- version 2.4.6
RubyOnRails
- http://rubyonrails.org
- we are using
- ruby version 2.4.4
- rails version 5.1.4
- installation order that works for us:
- install ruby
- manually install the ruby gem named bundler
- move the Gemfile from the def directory to your ruby directory
- issue the bundle install command to install the gems listed in the Gemfile. When the installation completes successfully, you should have a Gemfile.lock file in your ruby directory (in addition to the Gemfile).
- create a softlink ruby in the def/packages directory that points to your ruby directory
- update the proto1/config/database.yml file as appropriate for your database.
node.js
- http://nodejs.org
- we are using
- node-v8.11.3-linux-x64
- create a softlink node in the def/packages directory that points to your node directory
- create a softlink node_modules in the def/packages directory that points to your node_modules directory. The node_modules should include prototype v0.0.5
- npm - use the version that comes with your node.js distribution
jQuery
- http://jquery.com
- we are using
- jquery-1.9.1, for which we create a directory that should
contain the following files:
- jquery-1.9.1.js and jquery-1.9.1.min.js, and
- softlink jquery.js should point to jquery-1.9.1.js
- softlink jquery.min.js should point to jquery-1.9.1.min.js
- jquery.flot (v0.8.3)
- jquery.flot.js and jquery.flot.min.js
- jquery.flot.crosshair.js and jquery.flot.crosshair.min.js
- jquery.flot.selection.js and jquery.flot.crosshair.selection.min.js
- jquery.sparkline.js and jquery.sparkline.min.js (v2.1.1)
- jquery-1.9.1.js and jquery-1.9.1.min.js, and
- jquery-mobile-1.4.2, for which we create a directory that
should contain the following files:
- jquery.mobile-1.4.2.js and jquery.mobile-1.4.2.min.js, and
- softlink jquery.mobile.js should point to jquery.mobile-1.4.2.js
- softlink jquery.mobile.min.js should point to jquery.mobile-1.4.2.min.js
- jquery.mobile-1.4.2.css and jquery.mobile-1.4.2.min.css, and
- softlink jquery.mobile.css should point to jquery.mobile-1.4.2.css
- softlink jquery.mobile.min.css should point to jquery.mobile-1.4.2.min.css
- jquery.mobile-1.4.2.js and jquery.mobile-1.4.2.min.js, and
- jquery-ui-1.10.1.custom
- http://jqueryui.com/download
- select version 1.10.x
- at the bottom of the page, under Theme, select Start and Download
- create a subdirectory in the home/phr/packages directory and extract the zip file to it.
- create a jquery-ui softlink to that directory
- in the js subdirectory create 2 softlinks:
- jquery-ui.js that points to jquery-ui-1.10.x.custom.js; and
- jquery-ui.min.js that points to jquery-ui-1-10.x.custom.min.js
- in the css/start subdirectory create 2 softlinks:
- jquery-ui.css that points to jquery-ui-1.10.x.custom.css; and
- jquery-ui.min.css that points to jquery-ui-1.10.x.custom.css
- jquery-1.9.1, for which we create a directory that should
contain the following files:
- jquery
- jquery-mobile
- jquery-ui
autocomplete-lhc
- https://github.com/lhncbc/autocomplete-lhc.git
- version 6.1.1
- create a softlink autocomp in the packages directory that points to your autocomplete-lhc directory
javascript-stacktrace
- https://github.com/stacktracejs/stacktrace.js/
- version 0.6.4 on 8/28/2015
- create a softlink javascript-stacktrace in the packages directory that points to your javascript-stacktrace directory
Third-party Packages Included with the PHR
maxlength.js
- http://www.javascriptkit.com/script/script2/enforceform.shtml
- the proto1/vendor/assets/javascripts directory contains the maxlength.js file.
prototype.js
- http://prototypejs.org
- the prototype.js file is included in the app/assets/javascripts directory.
script.aculo.us
- http://madrobby.github.io/scriptaculous/
- the following scriptaculous files are included
in the proto1/app/assets/javascripts directory:
- controls.js
- dragdrop.js
- effects.js
jquery.connect.js
- this file is contained in the def/proto1/app/assets/javascripts/jqueryPluginsExt/jq_connect_2 directory, along with a test_jqconnect.html file
- there is a jquery.connect.js package on github, but it is not the same as what we use, and what we use is no longer available on the web (that we could find).
Download and load the SQL Database
- A dump of the database is available at https://www.dropbox.com/s/olrm5d6u08d43yn/PHRDataDump.sql?dl=0
- The file was created using mysqldump
- http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html
- The dump file includes SQL statements to:
- create all tables in the database; and
- load program data (non-user data) to the program tables. This includes form definitions, rules, etc. See the database descriptions for a description of the program data tables.
- The initial load of this will be slow, because of the way the dump file was created (using a separate insert statement for each row of data loaded to the tables). Once you have established your database we recommend that you create a backup that uses a faster restoration method.
- After the database is populated you need to build the indexes
used to search some of the program data tables. There is a
rake task that will build those indexes:
rake def:rebuild_ferret_index - The indexes will be built in a subdirectory of the def/proto1/index directory.
Return to the main page