Isnor Creative
Isnor Creative Blog
Ruby, Ruby on Rails, Ember, Elm, Phoenix, Elixir, React, Vue

Sep 21, 2011

Deploying Ruby on Rails 3.1 to WebFaction

WebFaction has a new Rail 3.1 installer out. I nevertheless hit a few obstacles in setting up a new app.

Ruby EE vs Ruby 1.9.2 Issues

First off, the installer is using the Ruby Enterprise Edition rather than 1.9.2 which I hadn’t planned on, so all of the new hash syntax I was using did not work out. So – you may want to install Ruby 1.9.2 for starters. I was able to do that relatively painlessly by removing the existing install files, then installing into the same directory (~/webapps/yourapp)

Asset Pipeline Issues

Secondly, the asset pipeline was a bit of a problem - the capistrano task rake assets:precompile never finishes and caused me to receive a memory over limit warning message. After some back and forth with a not particularly tech support person it seemed that you can’t precompile on the production server – at least not with the standard shared hosting plan. I ended up finding a capistrano task that allows local compilation:

Path Variables

You’ll also want to add some path variables to .bash_profile and .bashrc:

export PATH=$PWD/bin:$PATH export GEM_HOME=$PWD/gems export RUBYLIB=$PWD/lib

deploy.rb

`desc “deploy the precompiled assets” task :deployassets, :except => { :norelease => true } do runlocally(“rake assets:clean && rake assets:precompile”) upload(“public/assets”, “#{releasepath}/public/assets”, :via => :scp, :recursive => true) end

after ‘deploy:updatecode’, ‘deployassets’`

Gemfile

One snag I have still not figured out is that cucumber-rails is causing a “the spawn server has exited unexpectedly” warning message, so I am keeping the entire test portion of the Gemfile commented out and then uncommenting each time I run the test suite, a pain in the butt, but it works.

=begin group :test, :development do gem "rspec-rails" gem 'cucumber-rails' gem 'database_cleaner' gem 'factory_girl_rails' gem 'capybara' end =end

Other than that, things went pretty smoothly and so far the app has been running well.


I am available for Ruby on Rails consulting work – get in touch to learn more.

Gordon B. Isnor

Gordon B. Isnor writes about Ruby on Rails, Ember.js, Elm, Elixir, Phoenix, React, Vue and the web.
If you enjoyed this article, you may be interested in the occasional newsletter.

I am now available for project work. I have availability to build greenfield sites and applications, to maintain and update/upgrade existing applications, team augmentation. I offer website/web application assessment packages that can help with SEO/security/performance/accessibility and best practices. Let’s talk

comments powered by Disqus