Home > Integration, Testing > How to run Engine Yard Local in CentOS 6.5

How to run Engine Yard Local in CentOS 6.5

PrintEngine Yard is a platform as a service (PaaS) company that focuses on deployment and management of Ruby on Rails, PHP and Node.js servers in order to provide to customer a quick and simple way to deploy applications. They provide also a local version of Ruby on Rails server on Gentoo Linux so anyone can test how it works. I wanted to run the Engine Yard Local on CentOS 6.5 to test sample a Ruby application without the use of cloud services but I have faced some difficulties during deployment that I’ve been able to resolve and wanted to share it with you. This article shows all the steps to run Engine Yard Local on fresh install of CentOS 6.5 that I used for deployment.

Prerequisites to run Engine Yard Local:

  • VirtualBox 4.0, 4.1 or 4.2
  • Ruby 1.9.3
  • Rubygems

VirtualBox

There are two main options how to install Virtualbox:

  1. using package downloaded from Virtualbox sites. This link refers to download page for VirtualBox 4.2.22 version and you should choose version ending with:
    VirtualBox-4.2.22-el6-1.i686.rpm  for 32bit OS
    VirtualBox-4.2.22-el6-1.x86_64.rpm  for 64bit OS
  2. using repository prepared for CentOS and other RHEL distributions. The repository can be set via
    cd /etc/yum.repos.d
    wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

    and VirtualBox 4.2.22 version installed by

    yum install VirtualBox-4.2

You also need to have installed Dynamic Kernel Support Module (DKMS) from RPMForge repository, which can be installed by:

rpmforge-release-0.5.3-1.el6.rf.i686.rpm  for 32bit OS
rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm  for 64bit OS

and for the DKMS install run:

yum --enablerepo rpmforge install dkms

Ruby

There is a ruby in the official CentOS repository in version 1.8.7 but Engine Yard requires version 1.9.3 as it is written on Engine Yard Local page.

Prerequisites for Ruby

Before compiling and installing newer Ruby and Rubygems, it is also necessary to install some dependencies:

yum install openssl-devel zlib-devel

Note: These should be minimal dependencies to run Engine Yard Local, you can add another regarding your future requirements.

YAML parser

Optionally, you can install YAML lib which provides an option for Ruby to use a newer implementation of YAML parser (version 0.1.4). You will be getting the following warning message while using ruby, if you don’t install it:

/usr/local/lib/ruby/1.9.1/yaml.rb:84:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.

This is how to install Psych YAML parser:

wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar zxfv yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure
make

and with root privileges run

make install

Ruby itself

Download, compile and install Ruby (version 1.9.3 p484) is similar as previous steps:

wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.gz
tar zxfv ruby-1.9.3-p484.tar.gz
cd ruby-1.9.3-p484
./configure
make

and with root privileges run

make install

Verify that Ruby was succesfully installed by

ruby -v

Rubygems

As the Engine Yard Local is distributed as a Gem, you need to install RubyGems tool. You can download RubyGems (version 2.1.11) via:

wget http://production.cf.rubygems.org/rubygems/rubygems-2.1.11.tgz
tar zxfv rubygems-2.1.11.tgz
cd rubygems-2.1.11/

and with root privileges run

ruby setup.rb

Verify that RubyGems was successfully installed by

gem -v

Engine Yard Local gem

With all prerequisites met for Engine Yard Local, you can install it as written in documentation here (assuming root privileges):

gem install engineyard-local

Engine Yard Local example

You can try sample ruby application by downloading git repository

git clone git://github.com/engineyard/todo.git
cd todo
ey-local up

Note: You might see an error message indicating wrong settings for base MAC address for eth0/NAT. This is a known issue, workaround is start “ey-local up” once again.

When ey-local up successfully finishes, you should be able to see ToDo example running at http://127.0.0.1:8080.

Snímek obrazovky pořízený 2014-01-20 16:17:11

Troubleshooting

Snímek obrazovky pořízený 2014-01-20 17:46:00

If you see an error message instead of the ToDo application, you probably see some error messages at the end of the log too. These are given to stdout by ey-local up command. They look like:

[default] rake aborted!
[default] undefined method `create' for Psych::Visitors::YAMLTree:Class
[default] 
[default] Tasks: TOP => assets:precompile:primary
[default] (See full trace by running task with --trace)
[default] rake aborted!
Command failed with status (1): [/usr/bin/ruby19 /usr/bin/rake assets:preco...]

Tasks: TOP => assets:precompile
(See full trace by running task with --trace

It seems that this happens when Ruby 1.9.3 is not compatible with Psych YAML parser so you need to switch back to Syck YAML parser. This incompatibility occurs in both cases no matter, if you installed it or not. There are two options how to solve it:

    1. add manually
      YAML::ENGINE.yamler = "syck" if RUBY_VERSION >= "1.9.2"

      right after

      Bundler.require(:default, Rails.env) if defined?(Bundler)

      in config/application.rb file

    2. OR apply patch to config/application.rb in downloaded example’s todo directory.
      Create new file e.g. engineyard.patch with content:

      --- config/application.rb    2014-01-20 11:45:50.856045465 +0000
      +++ config/application.rb    2014-01-20 11:45:32.680045487 +0000
      @@ -5,6 +5,7 @@
       # If you have a Gemfile, require the gems listed there, including any gems
       # you've limited to :test, :development, or :production.
       Bundler.require(:default, Rails.env) if defined?(Bundler)
      +YAML::ENGINE.yamler = "syck" if RUBY_VERSION >= "1.9.2"
      
       module Listr
         class Application < Rails::Application

      and apply the patch using:

      patch -p1 config/application.rb engineyard.patch

The last step is reboot the Gentoo rack machine to apply changes via

ey-local down
ey-local up

Summary

You should be able to run Engine Yard Local version and you can discover Engine Yard options on your local machine. You can customize deploying the machine using different Chef’s cookbooks and managing recipes and test your applications with EngineYard’s platform. Running on Engine Yard local environment might be a good alternative if you want to learn about underlying platform or if you want to develop your applications in an environment where internet connection might be an issue such as while traveling on your business trips.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: