Let's talk about deploying .NET applications on Linux-driven Cloud Servers offered by the Rackspace ("Slicehost" and "Mosso" brands). This article would be another technological addition to xLim 4 research and development series.
Using Mono on virtual cloud server machines would allow us to run lightweight .NET application and data gateway servers (basically, your building blocks for smart enterprise applications) in a cost-effective and elastically scalable environment.
Obviously, this comes with a certain vendor lock-down at the moment, since there are not that many affordable cloud computing providers with scalable solutions (even Windows Azure does not have a scalability management API at the moment). Yet, this will change, since that's the way to make complex deployments much more flexible and cost-effective.
Cost-effectiveness comes from:
- Decent pricing with on-demand payments for server instances.
- Running .NET on Linux means that there are no overhead license payments (like with Windows Servers) and hardware is a lot cheaper (you can compile Mono even for the embedded devices, but I don't want to get there, yet).
Elastic scalability comes from:
- Ability to manually resize servers on-the-fly (changing resource allocation and their prices) for basic solutions.
- Ability to manually clone servers from a prepared image in order to handle occasional spikes or adopt for long-term usage levels (this requires development solution to be ready for such changes).
- Ability to use REST API for automating deployment and scaling operation for creating cost-efficient solutions (as in enterprise cloud bursting solutions).
Here's the routine for building Mono 22.214.171.124 (from the latest tarball) on Linux Ubuntu x64 running on Cloud Server at Rackspace (Slicehost or Mosso):
Note 1: if you are reading this article in the year 2010, then probably you could get same accomplished by running:
apt-get install mono-xsp2
Note 2: we will be building only core Mono libraries here. Just the things that are really needed for the light-weight scalable application/gateway server in the cloud.
Note 3: no hardware was hurt in writing of this article. Approximately 12 Linux servers were deployed and killed in the research process, but this does not count, since they were purely virtual.
Step 1: Update and install core packages:
sudo apt-get update
sudo apt-get install -y build-essential bison gettext pkg-config libglib2.0-dev
Step 2: Grab and unpack Mono 126.96.36.199 tarball:
wget -c http://ftp.novell.com/pub/mono/sources/mono/mono-188.8.131.52.tar.bz2
tar xf ~/download/mono-184.108.40.206.tar.bz2
Step 3: Work around the bug in Linux Kernel that is currently used by Rackspace (related to amd64isimm32 assertion failure):
perl -i -pe 'last if eof' mini-amd64.h
perl -i -pe 'last if eof' mini-amd64.h
echo "#define MONO_ARCH_NOMAP32BIT" >> mini-amd64.h
echo "#endif" >> mini-amd64.h
Step 4: Optional patch - delete all 'doc' folder names in the file that is opened by the command below (mcs-docs switch does not work for some reason):
Step 5: Manual patch - remove all values in 'AOT_IN_PROFILES' from file opened by the command below (Ahead-of-time compilation is not supported on our flavor of AMD64 and we are not that interested in net11 anyway):
Step 6: Configure everything (this command is one line):
./configure --with-large-heap=yes --with-xen_opt=yes --with-mcs-docs=no \
Step 7: Make and install to the default folder:
sudo make install
Step 8: Verify that Mono is more-or-less working by running the command below. It should say that "No files to compile were specified".
Step 9: Optionally - get and install XPS server for running ASP.NET applications (we are interested in REST here):
wget -c http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.4.2.tar.bz2
tar xf ~/download/xsp-2.4.2.tar.bz2
./configure && make && sudo make install
Obviously, ability to run .NET code on Linux-driven and elastically resizable computing cloud does not guarantee anything. It just provides the flexible foundation for delivering building blocks of cost-efficient and scalable enterprise applications.