Wednesday, January 19, 2011

AWSEB is really slow to deploy stuff. Several times it got "stuck" and I waited for more than 30 minutes for it to recover. It did not appear to be an app issue, since the app came up just fine.

The default instance size is t1.micro. I was able to get a Rails app to boot there, but it's a very underpowered size.

It appears to start up JVMs with 256MB of memory max and 64MB of permgen. For a larger app, or one with many Rails instances, that might not be enough. For a "threadsafe" Rails app, though, it's plenty.

The default EC2 load balancer for the new Beanstalk instance is set to ping the "/" URL. If you don't rig up a / route in your Rails app (like I forgot to do) the app will come up for a few minutes and immediately get taken out.

And the good news: it works great once you get past the hassles! Here's the process that worked for my app (assuming app is already build and ready for deploy).

Preparing the app:

Ensure jruby-openssl is in Gemfile. Rails seems to want it in production mode.

Edit config/environments/production.rb to enable threadsafe mode.

`warble`

Preparing Elastic Beanstalk:

Create a new instance, specifying the .war file Warbler created above as the app to deploy

There is no step two

Once the instance has been prepared, you may want to resize it to something larger than t1.micro if it's meant to be a real app...but it should boot ok.

Anonymous: The micro instance definitely does *work* for small, single-instance apps, but in my experience even for the smallest apps they throttle CPU use too heavily for it to be useful. But that's what you get for a free instance (micro is free).

When deploying JRuby, a single process is your entire app on that machine; JRuby can either route all requests through a single instance ("threadsafe" mode) or spin up multiple copies of your app in-memory (like a cluster-in-a-can). In the latter case, micro instances would be too tightly constrained to run an app that has more than one instance, but might be ok for a single-instance or threadsafe setup.

As far as elastically scaling, once you're hitting the limits of a given server instance, I believe AWSEB will spin up additional instances for you.

And of course, there's the benefit that your're running JRuby, which Heroku does not support.