Getting Typo 4.1.1 Installed on a Shared Host
Every shared host has their own procedures for getting a Rails app up and running. The instructions that TextDrive has for installing a Rails application does a great job for them. However there are a few gotchas that you need to be aware of. First and foremost the installed version of Rails at TextDrive does not match what Typo 4.1.1 needs. Not to mention that the quotas installed for users are pretty limiting for RAM usage. You can't run gem update or install because it exceeds the memory allowed for a user (you can run gem list --local, but that's about it). That means you can't use the preferred method for Typo installation! Such a pain, but all is not lost.
Preparing the Typo Package
Typo needs Rails version 1.2.2 to function properly. It needs at least 1.2.0, but I did find issues with 1.2.3 and I didn't have time to figure out what they where. So, how do we publish an application that needs a different version of Rails than our host provides? Thankfully the Rails folks already have a solution for that, which was designed to let you play with "EdgeRails" (or the latest trunk). First, let's make sure you have the appropriate version of Rails installed on your local machine:
gem uninstall rails gem install rails --version '= 1.2.2'
Now that the right version of rails is installed on your machine, we have to install it into the typo distribution. Download the tarball from the Typo website, and unpack it on your machine:
tar xzf typo-4.1.1.tgz
With the command line, navigate into the distribution directory. The following command is probably a good idea no matter where you are publishing--particularly on a shared host. You don't have control over when your ISP decides to upgrade or change things. We are going to "Freeze" the version of rails to the gems you just installed on your machine.
rake rails:freeze:gems
Now you can repack the tar file. Go ahead and delete the old tarball before you pack it. The Rails app will have paths that are too long for the "old" style tar so you can't use the 'o' option. The following worked well:
tar czf typo-4.1.1.tgz typo-4.1.1
All you have to do at this point is upload the tarball to your account on your ISP. Unpack the tarball
Setting up the Database
The next step is to get the database up and running. Do whatever you need with your ISP to create a database for typo, and run the appropriate SQL script provided in the typo/db directory to set up the database schema. Next you'll have to configure the database.yml. The Typo team was good enough to provide an example configuration file. You just need to edit it to connect to your ISP's database instance. Just for safe keeping, do change the database name to the same thing for the development, test, and production configurations.
As a way to test the database connection, and to ensure everything is configured properly, you'll need to run the migrate task.
RAILS_ENV=production rake db:migrate
There's just a couple things left to do now.
Configure The Application
We need to make things easier on ourselves, so whether your ISP lets you set environment variables for running tasks or not, you'll want to uncomment the line to force the rails environment to production in the config/environment.rb file:
ENV['RAILS_ENV'] = 'production'
Also, because shared hosting is usually pretty limiting on your memory allocations, you'll want to disable any plugins that generate thumbnails. Find the line where the config/environment.rb file specifies plugins and edit it to look like this:
config.plugins = [ 'localization',
'typo_textfilter_tmcode' ]
Finally, most ISP instructions include changing the public/dispatch.* files so that the hashbang line has an explicit reference to your ISP's ruby interpreter. There's no guarantee that the env will find the ruby interpreter, and it removes one thing the machine has to do to get the app running.
Assuming the rest of the instructions from your ISP worked to get the app visible to the world, you will be able to go into the blog, create your username/password and manage the blog. I highly recommend keeping the sidebar simple. Only use static text, archives, syndication, and tags (and categories if you want) plugins when you have to share your host. The Magnolia and Flickr plugins generate thumbnails which look nice, but you'll run out of memory quick and the fastcgi process will die.
