My Goodbye Letter to Engine Yard

August 29th, 2010

That response sounds familiar but really isn’t that comforting or
realistic. You’re suggesting its rare to have instances disappear yet
it happened twice in less than 6 months. You’re suggesting I upgrade
to a more expensive server which may or may not solve the problem. You
don’t know what causes the instances to disappear but for some reason
a more expensive instance solves the problem. I’m not sure how those
dots are connected but it certainly doesn’t add up to me. You want me
to spend more money per month without any real justification,
quantitative data, or explanations.

To summarize:

* You don’t know why instances disappear.
* Its rare for instances to disappear.
* The solution is to spend more money per month.

From my perspective, you still haven’t resolved the underlying
problem. You suggest maybe hardware but hardware crashes twice in 6
months? That doesn’t sound realistic. The issue that concerns me is
that you haven’t addressed the underlying problem of why the instances
disappeared. You’ve only offered a solution that has no connection to
the actual problem: Get a better server. Of course, I could just go
straight to Amazon and bypass EY altogether if I were to get another
server.

Without really understanding why the instances are disappearing it
points to a bigger problem at EY than just this issue. It points to a
lack of concern for your clients, a lack of understanding of your own
technology, and a fundamental problem in how you attempt to solve the
problems presented to you. Its a ‘shuffle it under the rug’ approach
to solving your problems which doesn’t bode well with me. Your
solution is, simply put, one without any technical merit. Anyone in
sales could have given me the same answer. If I were to refer clients
to EY and they had other problems that you couldn’t figure out would
your solution be that they need to upgrade their servers?

I appreciate your delayed investigation into the issue but I
definitely won’t be moving more of my clients to EY anytime soon. I’m
actually glad you reached out to me recently because its given me the
motivation to review what I still see as this outstanding issue. As
such, I’ve decided to cancel my EY account.

> From: EY
>
> X and Y asked me to follow up with you on this.
> First of all, if someone on my team dropped the ball on getting back to you,
> we apologize. I will follow up with the engineers on my end.
> Re. instances disappearing – I found and reviewed the ticket for when this
> happened. It appears that it was no longer possible to SSH into your
> instance and when our engineer tried to terminate it, it was stuck in a
> shutting down state. I can’t answer why this happened in this particular
> case, but out of the several thousand AWS instances we manage on the EY
> AppCloud, occasionally we have observed that an instance can disappear or
> become unresponsive. This can happen, for example, if the physical server
> it is mounted on fails. The few times we have seen it, it has been for
> Small instances, which is what you had. Our default AWS instance size for
> EY AppCloud is now Medium, which we to date have not observed issues with.
> Hope that answers your question – and feel free to contact me for any
> additional questions about this.

Faster AJAX integration tests using Rails, Cucumber, Capybara, and envjs

July 4th, 2010

I admit it. I put off using Cucumber for a few years while it became more stable. I took a look at it a few years ago and found it didn’t really work properly according to the then current documentation. So, I shelved it until recently. There seems a renewed interest in BDD and Cucumber recently so I decided to take another look. Needless to say, I was impressed and since I was starting a new project I figured it was the perfect time to start using Cucumber.

An hour or so into it, I still didn’t have my first test passing but I felt I was making progress so I persisted. Here is my first test:

Feature: Registration
  In order to use the site
  As a visitor
  I want to be able to create a new account

  @javascript
  Scenario: Signup Form
    Given there are no users with the email address test@domain.com
    And I am on the home page
    When I follow "Signup"
    Then I should see "First Name"

I added the ‘@javascript’ part later. I couldn’t figure out why my AJAX query wasn’t running in Cucumber. It was working fine in my browser so I asked my buddy Corey. He pointed me to Capybara.

Basically, there are 2 distinct pieces to the testing process in Cucumber.

1. the step definitions
2. the browser simulator

For the step definitions part, its not really about you write the steps but more about how those steps are translated back to the DOM and how they interface with the browser simulator. Cucumber uses Webrat as the default for step definitions and I may have just followed the introduction docs to end up with that as the default. The problem with Webrat is that it doesn’t support interfacing with the DOM very well and so it doesn’t allow access to page elements that have been updated by Javascript. That means any AJAX testing is completely out the window. Unfortunately, most websites today pretty much require Javascript so Webrat is pretty much useless to me.

Capybara is a Webrat alternative that does support Javascript. Capybara allows you to access DOM elements that have been updated by Javascript. Now here’s where things get tricky. Both Webrat and Capybara integrate with Selenium, a browser simulator. The same simulator is being run in both cases but only Capybara has the ability to access the updated DOM elements.

This allowed me to finish up my first test. I didn’t notice it at first but after I added a second test I realized how slowly these tests were running. I didn’t get any quantitative performance data to share but just sitting there waiting for 2 simple tests to run I was pretty amazed that anyone would even be testing like this. There would be no way this could scale to a suite of tests for an entire site. The time wasted in just waiting for all the tests to run would prevent any actual development to occur.

So I started looking for alternatives. The culprit in the slowdown here was Selenium. I came across a blog post by RubyFlare the was talking about a much faster alternative to Selenium called envjs. You need to install the capybara-envjs gem, the envjs gem, and reconfigure some things in Cucumber but its fairly simple.

Now that I had my brand new envjs browser simulator working with Cucumber and Capybara, I tried to run my first 2 tests on it. FAILED

What I discovered in the envjs output was:

ERROR: [Sun Jul 04 2010 17:44:10 GMT-0600 (CST)] {ENVJS} response XML does not apear to be well formed xml Line: 1377
ERROR: [Sun Jul 04 2010 17:44:10 GMT-0600 (CST)] {ENVJS} ReferenceError: $domparser is not defined

I started digging through the envjs code and basically discovered it doesn’t really support AJAX calls returning HTML. Just XML. Well back to the drawing board. It doesn’t seem like it would be incredibly difficult to add support for that to envjs and the rest of the chain of libraries up to Cucumber. When? I’m not going to start responding to all my AJAX queries with well formed XML instead of simple HTML anytime soon. It would just add an unnecessary layer of complexity to the application and I would have to do it just to use the envjs browser. No thanks. Back to the drawing board.

Since I did get my first AJAX tests to pass using Selenium, I reverted back to using that so I can at least progress for now, albeit slowly. I know a lot of people are frustrated by the slowness of Selenium so I doubt it’ll be too long before envjs supports HTML to be returned from AJAX calls.

EngineYard default configurations strike again

April 30th, 2010

It was just brought to my attention that my company’s homepage was pointing to the wrong app. This has happened a few times since I’ve switched to EngineYard. They don’t include www aliases in the default nginx configuration so you have to add them with a keep.domain.conf file. I recently migrated my company site to a new instance and left the default configuration. When I checked to make sure the app was setup on the new instance properly, http://onomojo.com , it worked fine and I didn’t think anything of it. Of course, I didn’t test http://www.onomojo.com which ended up pointing to an app that is still in the early phases of development since I didn’t customize the nginx config. What a huge goof. No wonder I’m getting mixed responses from potential new work lately. If you’re reading this and you saw the awkward half broken site with the test video please revisit the site again.

Google Analytics maps are way off

April 16th, 2010

I was just browsing my Google Analytics data today when I noticed the map of Florida looked really weird. Growing up in Florida I knew this was obviously incorrect so I took a screenshot.

Bad Florida Map

And here is what Florida is supposed to look like.

Take a look at the bottom past Miami near the Keys. The Google map has no land there at all and the shape is all wrong. It looks like someone took a big bite out of south Florida. Maybe they’re just predicting water levels to rise soon and just saving themselves the extra effort of redoing their map after that happens. A bit of proactive thinking perhaps or completely obvious blunder.

No Plastic Day – June 8, 2010

April 15th, 2010

No Plastic Day - June 8, 2010

I like to do my part to save the planet and this is just one way in which Onomojo is trying to help. We’ve just recently finished a non-profit site promoting No Plastic Day which is on June 8, 2010. So far we’ve got a decent amount of people joining the event and I’m asking for your help in promoting it further. We all need to do our part to save the planet. One day without disposable plastics isn’t much to ask. Join us and together we can create a better future.

Engine Yard problems

March 6th, 2010

Here I am with yet another proprietary EngineYard problem again. I simply clone an existing application that’s up and running fine and the new cloned environment doesn’t boot. Its giving me this error instead:

/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/rails/gem_dependency.rb:224:in `specification’: undefined method `version_requirements=’ for # (NoMethodError)

Here’s a recent thread about the same issue:

http://rubyforge.org/tracker/index.php?func=detail&aid=27868&group_id=126&atid=575

Looking into the differences in my ‘cloned’ environment and my actual environment and I see the gems list isn’t even the same. So basically Engine Yard’s clone command doesn’t actually clone the environment at all. It just took my old apps and tried to copy and paste everything onto a newly configured environment which obviously doesn’t work.

My original environment gems:

abstract (1.0.0)
actionmailer (2.3.5, 2.3.3, 2.2.2, 1.3.6)
actionpack (2.3.5, 2.3.3, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.5, 2.3.3, 2.2.2, 1.15.6)
activeresource (2.3.5, 2.3.3, 2.2.2)
activesupport (2.3.5, 2.3.3, 2.2.2, 1.4.4)
addressable (2.1.1)
aws-s3 (0.6.2)
builder (2.1.2)
daemons (1.0.10)
erubis (2.6.2)
eventmachine (0.12.6)
extlib (0.9.9)
eyrubygems (0.0.2)
facter (1.5.2)
fastercsv (1.5.1)
fastthread (1.0.7)
ferret (0.11.6)
gem_plugin (0.2.3)
hpricot (0.8.2, 0.8.1)
igrigorik-em-http-request (0.1.5)
json (1.1.3)
mime-types (1.16)
mixlib-cli (1.0.4)
mixlib-config (1.0.12)
mixlib-log (1.0.3)
mongrel (1.1.5.1)
mongrel_cluster (1.0.5)
ohai (0.2.0)
open4 (0.9.6)
rack (1.0.1, 0.4.0)
rails (2.3.5, 2.3.3, 2.2.2, 1.2.6)
rake (0.8.3)
rest-client (1.3.1, 0.9.2)
right_aws (1.10.0)
right_http_connection (1.2.4)
rmagick (2.8.0)
ruby-openid (2.1.2)
rubyforge (1.0.3)
sparklines (0.5.2)
stomp (1.0.6)
systemu (1.2.0)
will_paginate (2.3.12)
xml-simple (1.0.12)

And the ‘Cloned’ environment gems:

abstract (1.0.0)
actionmailer (2.3.3, 2.2.2, 1.3.6)
actionpack (2.3.3, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.3, 2.2.2, 1.15.6)
activeresource (2.3.3, 2.2.2)
activesupport (2.3.3, 2.2.2, 1.4.4)
addressable (2.1.1)
aws-s3 (0.6.2)
builder (2.1.2)
daemons (1.0.10)
erubis (2.6.2)
eventmachine (0.12.6)
extlib (0.9.9)
eyrubygems (0.0.2)
facter (1.5.2)
fastercsv (1.5.1)
fastthread (1.0.7)
ferret (0.11.6)
gem_plugin (0.2.3)
hpricot (0.8.2, 0.8.1)
igrigorik-em-http-request (0.1.5)
json (1.1.3)
mime-types (1.16)
mongrel (1.1.5.1)
mongrel_cluster (1.0.5)
ohai (0.2.0)
open4 (0.9.6)
rack (1.0.1, 0.4.0)
rails (2.3.3, 2.2.2, 1.2.6)
rake (0.8.3)
rest-client (0.9.2)
right_aws (1.10.0)
right_http_connection (1.2.4)
rmagick (2.8.0)
ruby-openid (2.1.2)
rubyforge (1.0.3)
sparklines (0.5.2)
stomp (1.0.6)
will_paginate (2.3.12)
xml-simple (1.0.12)

Clearly this new environment isn’t a ‘clone’ at all. You can’t just put feathers in your butt and call yourself a chicken. Don’t call this feature ‘clone’ when its really just recreating everything on a completely different setup if they’ve changed their default environment configuration. It should be called the ‘waste another 4 hours fixing our broken Engine Yard system’ feature. I think its a little more accurate.

Rojo: An easy to install Ruby on Rails CMS

February 8th, 2010

Rojo is Onomojo’s Ruby on Rails Content Management System. You can find it here:

http://github.com/onomojo/rojo

Today we made some changes to make the initial setup of a Rojo instance easier. The steps to setup a new Rojo instance are clearly detailed in the README. This should help eliminate most of the problems new users were encountering when trying to setup Rojo from scratch. Please let us know if you have any comments or suggestions for improving the setup process.

In the next few weeks, we will be releasing the plugins that we’ve developed for Rojo including a blog, video gallery, photo gallery, and more so stay tuned.

GitHub down yet again

February 2nd, 2010

I am experimenting with a new Engine Yard account today and their Setup basically requires you to have your projects in git. Since the site was from a private svn repos I decided I’d go ahead and signup for a paid Github account so I can host my projects there privately instead of having to setup my own git server. I should have trusted my gut because not more than a few hours later here I am trying to access my Github account and the site is broken again.

Rojo – A Ruby on Rails CMS

January 31st, 2010

Rojo logo

We’ve been working on this part time for a while now and I finally decided to just go ahead and release it. Its far from perfect and isn’t what I originally envisioned but it does work and we do use it on a number of sites. Its fairly stable and we have a handful of plugins that I’ll be releasing in the next week or two.

The 2 main motivations for Rojo came from the lacking diversity in Ruby on Rails content management systems. There are a few and some work well but I wasn’t happy with the learning curve with the ones I explored when we initially started this project. It seemed to me that every time I embraced a CMS the CMS ended up determining how I had to write my application. Its simply impossible to craft a CMS that enforces a strict data and programming interface that works for every situation. I didn’t want a content management system that forced me to write my tables one way or another or forced me to communicate with the CMS in certain ways. In short, I really just wanted a simple core that I could easily extend in any way I needed without having to conform to any standard imposed by the CMS.

You can check out the Rojo code here: http://github.com/onomojo/rojo

Rails threading with Spawn plugin

December 8th, 2009

My previous post was about using Thread in Rails which simply doesn’t work properly when you’re doing anything with ActiveRecord despite what anyone else is claiming.

This post will focus on my second attempt at a solution to intra-request threading in Rails. Basically, I have a Rails app where I want to run multiple computations at the same time. Since I had problems with Ruby’s native Thread method previously, I had no intention of going down that route again. I decided to try out the Spawn plugin.

Spawn was able to successfully segregate my multiple threads, or forks in my case. This got around the MySQL errors I reported in my previous post but it created a whole new set of problems all its own.

The first problem I had was that the spawn forks I was creating weren’t able to communicate their changes back to the main Rails request. I was creating forks and they were running fine and even saving data via ActiveRecord. I could confirm this via the console. The problem was that I need to know what data was being written by the spawn forks inside of the main Rails request. It was as if the main Rails request didn’t even know that something new was written to the database. I was able to get around this by forcing a reload from the database on the object I was trying to get association data from.

No big deal and it seems to make sense to do that anyway. That’s not where the real problem occurs though. After I got past that I realized that since each fork was essentially using a ‘copy’ of the database and not actually live connections that the data validations randomly failed. Basically if two forks are writing data to the database at the same time when there is a validates_uniqueness on the data. They both write to the database and both actually pass validation. The result is a database full of incorrect data which should have never passed the validation. I’m still not sure if that’s a problem with Spawn or an inherent problem with ActiveRecord’s connection pool.