So I had to move an application that I’m developing from a MediaTemple (dv) Dedicated-Virtual to a Ruby on Rails GridContainer running on a MediaTemple (gs) Grid-Service. Most of the tutorials I found that covered installing a Rails app on a GridContainer were somewhat dated. Things that were different than expected include:
- Rails, a few precompiled gems (like RMagick), and a test app are automatically installed for you. Most of the tutorials walk you through installing Rails and the skeleton app from SSH. That’s no longer necessary.
- For Capistrano, you need to set the
syspathoption (“System” in the control panel) to/home/[xxxxx]/containers/rails/[app_path]/currentwhere [xxxxx] is your GridContainer number and [app_path] is where you want your app located. I kept the app path and app name the same. - You can’t edit application options from the web control panel. You have to do this from a SSH session using
mtr set_option. You may need to do this to change thesyspathor to set theenvironment. For example, to set the environment to “staging” you use the following command:mtr set_option [app_name] environment=staging. - If you change the
syspathmake sure to update the symbolic link to the app’s public folder under your app’s domain, otherwise you’ll get an app not found error. In other words,~/domains/example.com/htmlshould point to/home/[xxxxx]/containers/rails/[app_path]/current/public. - When an application fails to start, you get no feedback about the cause. Check log/mongrel.log for details as to why your application fails to start.
- After changing the
syspath, the app may not restart. You may get anAddress already in use - bind(2) (Errno::EADDRINUSE). To resolve this, I ended up having to reboot the container. - For some reason,
rake gems:installdidn’t work. I had to manually install each gem.
I definitely had a lot more control over the installation when I had the application running on the (dv) using Passenger Phusion, especially having the ability to compile software. However, the GridContainer runs a lot faster.