Media Temple Grid Server on Rails

Kevin McFadden, Former Viget

Article Category: #Code

Posted on

Earlier this week I wrote about LiteSpeed. Besides potentially being expensive, it also requires having your own server or VPS. Another option, great for traffic-moderate sites, is Media Temple's Grid Server (GS). The basic set up costs $20/month and there is an option to add a 64 MB Rails container. All users appear confined to a chrooted environment, which is great because other users have no way of accessing your files, especially those hard-coded database passwords. For additional money, you can allocate more memory to the Rails container: $25/month for 256 MB and $75/month for 1 GB. Creating a GS account is pretty fast and easy. About thirty minutes after entering my contact and billing information, I received my GS login information. The following outline describes how to deploy your Rails application.
  • Create a new domain for your account, perhaps myapp.mydomain.com.
  • Enable the Rails container in the Media Temple control panel https://accountcenter.mediatemple.net/.
  • Run mtr generate_config to avoid having to enter the user and pass everytime. This info gets stored in a ~/.mtr file in clear text, but it should be secure enough since no one else may access your home dir and it has appropriate permissions.
  • The instructions for installing the necessary files into your container are found in the MT Grid Server guide.
  • Create your database in the control panel (Manage Databases, not MySQL or PostgreSQL Admin.)
  • We have a slightly custom rake process, but perhaps the standard rake db:migrate RAILS_ENV=production will work for you.
  • The permissions of your application files must must be readable by the web server: # cd into the rails container cd $HOME/../../containers/rails/ # All files should be readable find . -type f -exec chmod a+r {} ; # All directories should be executable and readable find . -type d -exec chmod a+rx {} ;
  • Don't forget to update your production settings for the database, ActionMailer, and other deployment specific features.
After this is done, you should be able to access your application. You can manage your container from the command line using Media Temple's mtr command. Run mtr -h for more information. In the long run, it may be more flexible and cost-effective to go the VPS route if you have, or want to learn, the Linux side of things; but, if that isn't your thing, the Grid Server is a good deal. References

Related Articles