Upgrading Typo 4 to 5 1
This site used to be hosted at bluehost.com, but is now running on my own reasonably speedy Mac Mini running OS X. Bluehost is not a bad hosting provider, for the most part. But they upgraded to Rails 2.0 without notice, which broke Typo 4.0. I should have frozen the Rails version into Typo, and perhaps the Bluehost fine print includes something about doing system upgrades without notice. I was also not pleased with having to run FastCGI.
So, I upgraded to Typo 5 and moved away from the shared hosting environment. I also used the opportunity to become familiar with configuring a Rails production environment using a few popular industrial strength components, namely: Nginx, mongrel, and mongrel cluster.
I chose Nginx as the web server/reverse proxy component because 1) it appears to be very lightweight and fast, and 2) configuring and managing Apache can be very tiresome. The basic set-up has the mongrel cluster managing the spawning of multiple mongrel processes ("mongrels"), with Nginx load balancing and round robin'ing requests to the mongrels.
Here are the steps I took to do it. On OS X, Xcode must be installed.
- Install Rails 2.0, mongrel, mongrel cluster, and the mysql native bindings gem. I used the standard 'gem install --include-dependencies {gem-name}' to get these. Rails should probably be frozen to the application itself.
- Download and build Nginx. Instructions and more info can be found here: Nginx, my new favorite front end for mongrel cluster. One issue I ran into was that PCRE could not be found during the configure step. This article helped me install it.
- Edit nginx.conf. Again, the article mentioned above is a good reference. The key section is where the "upstream mongrels" are declared. To properly configure Nginx to start on boot, etc., refer to this article.
- Download Typo 5. Configure the mongrel cluster at the application root: mongrel_rails cluster::configure -e production -p 3000 -a 127.0.0.1 -N 3 This will create a config file that will be included to actually kick off the cluster. The -p 3000 sets the port and must match the "upstream mongrel" declaration in nginx.conf. In this instance, three (-N 3) mongrel processes are spawned. The mongrel cluster is started at the application root with: mongrel_rails cluster::start
- There were some manual edits and stylesheet replacements I did to retain what this site looked like in Typo 4...not too interesting to include the mundane details.
- Import the existing Typo database: mysql -uroot -p ossolab_typo < ossolab_typo.sql
- Run a migration at application root to reflect the changed model in Typo 5: rake db:migrate RAILS_ENV=production This actually failed for me with a strange mysql related error message: dyld: Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib I did some research and was able to proceed by creating a folder named 'mysql' in /usr/local/mysql/lib/ and then copying 'libmysqlclient.15.dylib' to it.
- The one disappointment I had was that managing the sidebars after the upgrade was broken. Not wanting to spend anymore time on the issue, I got around it by getting rid of the sidebar records from Typo 4, since they aren't a huge deal to me. The recent comments section on the right was added by directly writing that code in one of the view files.
Comments
-
What is the monthly cost for a rails hosting like bluehost?