Laika is a Ruby on Rails application that targets JRuby/Glassfish for deployment.
-
JRuby >= 1.3.1
-
Sun Java >= 1.5 (1.6 required for the Glassfish gem)
-
MySQL >= 5.0 (for UMLS)
-
PostgreSQL >= 8.1 (for XDS)
(Laika itself supports either Postgres or MySQL database storage.)
See laika.wiki.sourceforge.net/LaikaXDSPIXPDQAlpha for information about getting an Amazon EC2 system prepared to run Laika.
Once you get a copy of the Laika code from gitHub, these are step-by-step instructions to get Laika installed on your local machine.
Ensure that you have JRuby version 1.3.1 installed locally (available here: dist.codehaus.org/jruby/1.3.1/) and add <jruby-install>/bin to your PATH environment variable.
You will need to install Rails for JRuby:
$ jruby -S gem sources -a http://gems.github.com $ jruby -S gem install rails -v=2.3.4 --no-rdoc --no-ri
Several commands require use of rake, which in turn loads the local rails environment and will complain if the configuration files are not set up. So make a local copy of config/database.yml.template as config/database.yml. The file just has to exist for now, we will configure it below.
Install the rest of the gem dependencies; from the root of your Laika project:
$ jruby -S rake gems:install
The default XDS setup on Laika points to localhost. You can change the initial XDS endpoints by editing the settings.yml in spec/fixtures. If you do not have your own XDS set up, you can use the public registry provided by NIST (more information at 129.6.24.109:9080/index.html); simply change localhost to the following IP address: 129.6.24.109:9080.
Install the database adapters:
$ jruby -S gem install activerecord-jdbcmysql-adapter $ jruby -S gem install activerecord-jdbcpostgresql-adapter
Make sure your local database server is running and create a new user laika with password laika and a new database/schema called laika. Find the database.yml.template file in laika/config under your local Laika project and edit it to include your database settings, for example:
development: adapter: jdbcpostgresql database: laika host: localhost port: 5432 <<: *login
Save the file as database.yml (i.e., without .template extension). Initialize the databases and load the seed data:
$ jruby -S rake db:create $ jruby -S rake db:schema:load $ jruby -S rake db:seed
You will be prompted for information about the administrator account.
Laika uses Saxon (saxon.sourceforge.net/) to handle XML Schema validation and XSLT. For this to function properly, the Saxon jars must be set in a CLASSPATH environment variable.
Navigate to the root of your Laika project and run:
$ source bin/laika_env.sh
As an alternative, you may create CLASSPATH environment variable as part of the user’s profile.
Laika sends mail for forgotten passwords, and potentially for error notifications (see below).
By default, Laika assumes that it can send mail through a mail server configured at localhost on port 25. To change this, create a copy of config/laika.yml from the config/laika.yml.template and set your mail settings as needed under ‘action_mailer:’. See the ActionMailer::Base configuration options for further details (api.rubyonrails.org/classes/ActionMailer/Base.html).
Laika uses the exception_notification plugin to email application errors encountered on a production server. If you wish to receive email notifications, make sure that you have a config/laika.yml YAML file in place and that the exception_recipients parameter has been set to a list of one or more email addresses who should be receiving error notifications:
exception_notifier:
exception_recipients: [ 'foo@bar.com' ]
Install the Glassfish server using the Glassfish gem:
$ jruby -S gem install glassfish
GlassFish will use default options for the server if you do not have a glassfish.yml file in your config directory. Laika provides a glassfish.yml.template file that you may edit. Note that GlassFish cannot run as a daemon process on Windows.
Deploying Laika on the GlassFish server is very simple. Run the following command from the root of your Laika project:
$ jruby -S glassfish
Point your browser to localhost:3000/.
$ # install both Java 1.5 and Java 1.6 $ sudo aptitude install sun-java5-jdk openjdk-6-jdk $ # use Java 1.5 $ sudo update-java-alternatives -s java-1.5.0-sun $ java -version java version "1.5.0_16" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02) Java HotSpot(TM) Server VM (build 1.5.0_16-b02, mixed mode) $ # use Java 1.6 $ sudo update-java-alternatives -s java-6-openjdk $ java -version java version "1.6.0_0" IcedTea6 1.3.1 (6b12-0ubuntu6) Runtime Environment (build 1.6.0_0-b12) OpenJDK Server VM (build 1.6.0_0-b12, mixed mode)
NOTE this is currently not supported. Instead load an AMI provided by CCHIT.
Here is a quick run-through of how deployment works so far. The first step is to get a recent AMI of a base system. These instructions assume you’re deploying to an instance of Amazon EC2 public AMI 95fc1afc
The deployment scripts install laika into /var/www/laika/DATESTAMP and maintain a link to the latest deployed version as /var/www/laika/current.
From a checked-out copy of the latest CCHIT/master on your local machine:
$ # add your Amazon-supplied SSH key to the ssh-agent $ ssh-add ~/ec2-keys/mykey.pem $ # customize your deployment config: $ cp config/deploy_local.rb.example config/deploy_local.rb $ vi config/deploy_local.rb $ # customize your app config: $ cp config/database.yml.template config/database.yml $ vi config/database.yml $ bootstrap the deployment setup server $ cap deploy:setup $ cap deploy:update # bootstrap the code so we can ... $ cap laika:install_gems # ... automatically install gem dependencies $ # once the setup is done, this should be the only command needed to deploy $ cap deploy:migrations