Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Installation Instructions (Ubuntu 14.04)

Michael O'Keefe edited this page Jul 22, 2016 · 8 revisions

NOTE: These are basic installation instructions. Properly configuring a production server would require additional work.

The installation will require the installation of the following components

  1. Ubuntu (these instructions are for Ubuntu version 14.04 LTS)

  2. Configure Proxy Settings

  3. Git

  4. RVM and Ruby 2

  5. MongoDB

  6. Crucible Source Code

  7. Configure Passenger / Apache

  8. Installing Ubuntu


The ISO for ubuntu 14.04 LTS can be downloaded from the following URL: http://releases.ubuntu.com/14.04/

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/14.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

Once the machine reboots 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:.

  1. Configure Proxy Settings

This step is only required if the server you are installing Crucible 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
  1. Installing Git

Git is a source control system.  It will be used later to download the Crucible source code.

sudo apt-get install git-core
  1. Installing RVM and Ruby 2.0

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 Crucible 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 Ruby.

cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash

rbenv install 2.2.3
rbenv global 2.2.3
ruby -v

Install bundler.  Bundler is a Ruby Gem that allows downloading additional dependencies once we have the Crucible source code:

gem install bundler
  1. Installing MongoDB

MongoDB is the database used by Crucible.  To install MongoDB run the commands:

sudo sh -c "echo 'deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse' >> /etc/apt/sources.list"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
sudo apt-get update
sudo apt-get install -y mongodb-org=3.0.12 mongodb-org-server=3.0.12 mongodb-org-shell=3.0.12 mongodb-org-mongos=3.0.12 mongodb-org-tools=3.0.12
echo "mongodb-org hold" | sudo dpkg --set-selections
echo "mongodb-org-server hold" | sudo dpkg --set-selections
echo "mongodb-org-shell hold" | sudo dpkg --set-selections
echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
echo "mongodb-org-tools hold" | sudo dpkg --set-selections

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: 3.0.x

Type 'exit' to exit the mongo shell

exit
  1. Crucible Source Code

Install Bower

sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install bower -g
sudo ln -s /usr/bin/nodejs /usr/bin/node

Getting the Crucible code

git clone https://github.com/fhir-crucible/crucible.git
cd crucible
bundle install
bower install
bundle exec rake assets:precompile RAILS_ENV=production
  1. Configure Passenger / Apache

Install apache and passenger with the following commands:

sudo apt-get install apache2
gem install passenger

These should be the dependencies required for passenger:

sudo apt-get install libcurl4-openssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev

Install the apache passenger module.  NOTE the configuration at the end. If you need other dependencies, the installer will tell you:

passenger-install-apache2-module

Add a file for passenger configuration

sudo nano /etc/apache2/conf-available/passenger.conf

Add the contents from the end of the passenger-install-apache2-module command... they should look something like:

LoadModule passenger_module /home/ubuntu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/passenger-5.0.22/buildout/apache2/mod_passenger.so PassengerRoot /home/ubuntu/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/passenger-5.0.22 PassengerDefaultRuby /home/ubuntu/.rbenv/versions/2.2.3/bin/ruby

turn on the configuration

sudo ln -s /etc/apache2/conf-available/passenger.conf /etc/apache2/conf-enabled/passenger.conf

Add a file for config info

sudo nano /etc/apache2/sites-available/crucible.conf

With the following content (changing the path appropriately):

<VirtualHost *:80>
        DocumentRoot <path>/crucible/public
        <Directory <path>/crucible/public>
                Require all granted
                AllowOverride all
                Options -MultiViews
                # Compress css and js
                AddOutputFilterByType DEFLATE text/css application/x-javascript application/javascript text/javascript
        </Directory>
</VirtualHost>

Make the default apache site be the crucible provided content:

sudo rm /etc/apache2/sites-enabled/000-default.conf
sudo ln -s /etc/apache2/sites-available/crucible.conf /etc/apache2/sites-enabled/crucible.conf

Set the secret token. Edit the following file and replace <%= ENV["SECRET_KEY_BASE"] %> with a secret key. You can also set this through the environment if you choose. nano config/secrets.yml

Restart apache:

sudo service apache2 restart

Set up job runner sudo nano /etc/init.d/delayed-job

Enter the following contents (NOTE: you will have to update the path from /home/ubuntu to your user home)

#!/bin/bash
#
# delayed job
#
# chkconfig: - 99 15
# description: start, stop, restart God (bet you feel powerful)
#

RETVAL=0

case "$1" in
    start)
      cd /home/ubuntu/crucible
      su ubuntu -c 'export PATH=$PATH:/home/ubuntu/.rbenv/versions/2.2.3/bin/ ; RAILS_ENV=production bin/delayed_job -n3 start'
      RETVAL=$?
      ;;
    stop)
      cd /home/ubuntu/crucible
      su ubuntu -c 'export PATH=$PATH:/home/ubuntu/.rbenv/versions/2.2.3/bin/ ; RAILS_ENV=production bin/delayed_job stop'
      RETVAL=$?
      ;;
    restart)
      cd /home/ubuntu/crucible
      su ubuntu -c 'export PATH=$PATH:/home/ubuntu/.rbenv/versions/2.2.3/bin/ ; RAILS_ENV=production bin/delayed_job restart'
      RETVAL=$?
      ;;
    status)
      cd /home/ubuntu/crucible
      su ubuntu -c 'export PATH=$PATH:/home/ubuntu/.rbenv/versions/2.2.3/bin/ ; RAILS_ENV=production bin/delayed_job status'
      RETVAL=$?
      ;;
    *)
      echo "Usage: delayed-job {start|stop|restart|status}"
      exit 1
  ;;
esac

exit $RETVAL

Allow execution

sudo chmod a+x /etc/init.d/delayed-job

Set Delayed Job to start up automatically

sudo update-rc.d delayed-job defaults

Then start the Delayed Job:

sudo /etc/init.d/delayed-job start

To open the Crucible 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 Crucible web application.  Add a server url to begin testing FHIR.

Clone this wiki locally