Skip to content

VOC Deployment Requirements Guide Linux

jakectac edited this page Mar 19, 2013 · 3 revisions

VOC Deployment Requirements Guide (Linux)

Software Requirements

Ruby Version Manager (RVM)

https://rvm.io/

RVM is the industry standard method of supporting multiple ruby environments on the same application server or virtual machine while keeping each of them in complete isolation from each other. RVM enables the deployment of multiple projects, each with its own completely self-contained and dedicated ruby environment, from the specific version of ruby, all the way down to the precise set of required application gems. RVM prevents the issue of gem version conflicts between projects. RVM permits easy testing of gems and gemsets for upgrades, by switching to a new clean set of gems to test with, while leaving the original current live set intact. It is flexible enough to even to maintain a set of gems per environment, or per development branch, or even per individual developer's taste!

Ruby MRI 1.9.3-p194, Bundler v.1.2.3

Ruby version 1.9.3-p194, which includes Bundler v. 1.2.3, which is a standard gem used to manage and build gemsets for Ruby projects. Bundler is installed by RVM when installing most Ruby versions.

Gem Dependencies (retrieved from Github/packaged with source)

  • Rails 3.0.13 – Ruby on Rails web framework
  • jQuery-rails 1.0.19 – jQuery javascript library bridge for Ruby on Rails
  • Kaminari 0.14.1 – Pagination plugin
  • Delayed_job 2.1.4 – Background job processing
  • Authlogic 3.1.3 – Authentication plugin
  • Memcache-client 1.8.5 – Memcached interface for Ruby on Rails
  • Paperclip 3.3.0 – Document attachment management
  • Unicorn 4.3.1 – Application server

Database Requirements

MySQL 5.1 or later should be installed with a custom application user with read/write and create table permissions.

Build Requirements

Build Server

A build server, independent of existing host infrastructure, should be used to pull updates of the deployed code from the source controlled code repository. The code repository will initially be the HHS Open Source VOC Github, uri to be launched mid-December by HHS. The server will need internet access only to Github, as all dependent gems and gemsets, will be included at their appropriate version levels within the repository. Since there is no compilation process for Ruby, the resulting code pulled from the Github is ready for deployment. This code may then be compressed and transferred to the development/staging/production environment so that those environments may be kept secure from outside connections.

The file structure on the Application Server in each environment should look similar to the structure below.

app/
config/
db/
doc/
lib/
log/
public/
script/
tmp/
vendor/
config.ru
Gemfile
Gemfile.lock
README
Rakefile
sync_public_folder.sh*

The public folder contains all of the html and html support static files, which should be pushed to the front facing web server/CDN.

The build server can most easily constructed on top of any of the modern flavors of Linux.

Deployment Requirements

Configuration

RVM should have a configuration file for each project directory generated by the command line: rvm use ruby-1.9.3-p194 --rvmrc

Validation can be done by switching to the project directory in the terminal and reading the ruby version report string output upon the directory switch.

Once the Github code tree is deployed to Application Server, run the bundle install from the root of the project directory to install the required gems via the command line:

bundle install –local

In the VOC/config directory the files database.yml, unicorn.rb, and app_config.yml should be modified in the following ways. (The Github repository will have *.example files for reference and syntax requirements.)

  1. database.yml – Change the User/Database connection information.
  2. unicorn.rb – Set working directory, pid directory, and error log path.
  3. app_config.yml – Set the url to target of the ajax calls for each distinct environment dev/staging/production.
  4. mailer_settings.yml - Set options for email delivery.

Configure the Web servers. VOC consists of two distinct applications, each of which should have its own virtual host section. These virtual host sections will segment these applications away from existing and future Ruby applications running on the same server. Do not include any reference to Phusion Passenger in the virtual host section. Passenger applications can co-exist with VOC in the isolation of their own virtual host environments.

Run the initialization rake tasks in a single command line:

rake db:create db:migrate db:seed

Assuming the settings in database.yml are correct rake will create the database, load the schema, and populate with the required seed data.

Run the rake task to start the unicorn processes in a single command line:

rake unicorn:start

The number of workers will be determined by the configuration in VPC/config/unicorn.rb.