Here at Trio, we are currently in the
process of moving all of our websites from our local datacenter to
Rackspace Cloud Sites. That means
moving a few Umbraco installations into a medium trust environment.
To make things more challenging, I made the decision to convert
everything to MySql as well. I decided to use this blog as the
guinea pig and I have to say, everything worked out really
well.
So, I thought I would write this post as a reminder to
myself of the process and to share my experience (and screw
ups) with everyone. Here we go!
Upgrade
First, I went ahead and upgraded this blog to Umbraco 4.5.2. You
can find an upgrade guide on
our.umbraco.org.
MySql
To convert everything to MySql, I simply created a fresh Umbraco
installation running MySql and installed a package (containing all
of my content, templates, doc types, xslt, etc.) that I
created from the original blog.
Here is where I screwed up.
To deploy my blog to Rackspace, I simply did a backup of my
local MySql database and restored it to the server
on Rackspace using MySql Administrator. I was left with an
exception that told me that the table UMBRACODOMAINS did
not exist. Of course it did exist and after some research
I found a solution to the problem.
MySql has a configurable
identifier called lower_case_table_names that
has a different default value based on the OS that MySql resides
on.
My local installation is on Windows XP, so the default value is
1. That means that all table names will be converted to lowercase
and that name comparisons ARE NOT case
sensitive.
That means when I installed Umbraco on my local server, all of
my table names were converted to lowercase. However, queries
from Umbraco use uppercase table names. Again, this is
not a probem on Windows becase comparisons are not case
sensitive.
The problem is that Rackspace runs MySql on Linux where the
default value is 0. That means that all table names are stored
using the lettercase specified in the CREATE TABLE
statement and comparisons ARE case sensitive.
Since I did a backup/restore from my local installation, all of
the table names on the Rackspace server were in lowercase,
thus causing the exception.
To solve the problem, I simply added the following under
the [mysqld] section of C:\Program
Files\MySQL\MySQL Server 5.1\my.ini:
[mysqld]
lower_case_table_names=0
Now, when I create local Umbraco installations running MySql,
the table names will be left in uppercase making the databases
interchangeable with MySql on Rackspace.
Web.config
Next, I set the following in web.config.
<add key="umbracoUseMediumTrust" value="true" />
Some instructions also tell you to uncomment the following line
(as you would to force medium trust at the app level), but that
will cause an exception on Rackspace because they do not allow
app level overrides, so just leave it as is.
<!-- <trust level="Medium" originUrl=".*" />-->
Impersonation
Finally, you will need to add
impersonation under the system.web
section. This will enable Umbraco to read/write to the file
system. You will need to impersonate the default FTP
account that is created by Rackspace when you created the site.
If you are in the Dallas datacenter you will use the
following:
<identity impersonate="true" userName="dfw\YOUR_FTP_USERNAME" password="YOUR_FTP_PASSWORD" />
If you are in the San Antonio datacenter you will use the
following:
<identity impersonate="true" userName="sat\YOUR_FTP_USERNAME" password="YOUR_FTP_PASSWORD" />
Of course, you will also need to update
umbracoDbDSN with the correct values for your
database on Rackspace.
Drop File Extensions (optional)
Rackspace is already set up to run without file extensions, so
you might as well go ahead and drop them.
<add key="umbracoUseDirectoryUrls" value="true" />
Be sure to update any rules you may have in
/config/UrlRewriting.config as well.
Closing Thoughts
So far, my experience with Rackspace Cloud Sites has been
great. Technical support (especially live chat) has been superb and
the Control Panel is simple to use. I am incredibly grateful
for the hard work and effort put in by Benjamin Howarth and the rest
of the Umbraco team that enabled us to have Umbraco running in such
an ideal environment.