22 June 2011 Windows Azure CI Team

imageFor many people (including me till today) the windows azure instances are insufficient configurable. You have installed a naked Windows + IIS and .NET Framework. If you want to do anything else you have to use VM Role – that’s what you here. But in fact also the normal Windows Azure instances are much more versatile and most of the time you don’t need VM Role...

I need Ruby, Java, Node.js on Azure....

To say it short: Everything you are able to install on a regular Windows Server you are able to install on a regular Azure Instance.

Secret tip: preinstall Software

After the start of an instance you are able to govern a Code on it like for example on the RoleEntryPoint or the Startup CMD:

<ServiceDefinition name="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
   <WebRole name="WebRole1">
      <Startup>
         <Task commandLine="Startup.cmd" executionContext="limited" taskType="simple">
         </Task>
      </Startup>
   </WebRole>
</ServiceDefinition>

Because the Startup Task calls a simple CMD you can do almost everything on it. Steven Marx has created a cool website where he collects many interesting things about what you can do with Aure:

image

The Installscripts look a little bit ... different but there are some nice examples like: how to install Phyton:

cd %~dp0
for /f %%p in ('GetLocalPath.exe Python') do set PYTHONPATH=%%p

msiexec /i python-2.7.1.msi /qn TARGETDIR="%PYTHONPATH%" /log installPython.log

%PYTHONPATH%\python -c "import sys, os; sys.path.insert(0, os.path.abspath('setuptools-0.6c11-py2.7.egg')); from setuptools.command.easy_install import bootstrap; sys.exit(bootstrap())"
%PYTHONPATH%\scripts\easy_install Pygments-1.4-py2.7.egg

echo y| cacls %PYTHONPATH% /t /grant everyone:f

exit /b 0

The trick is to deploy the installation Medias into the Azure Instance and to install it while starting the service like in this case of Node.js:

var proc = new Process()
{
    StartInfo = new ProcessStartInfo(
        RoleEnvironment.GetLocalResource("Executables").RootPath + @"\node.exe",
        string.Format("server.js {0}",
            RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["HttpIn"].IPEndpoint.Port))
    {
        UseShellExecute = false,
        WorkingDirectory = RoleEnvironment.GetLocalResource("Executables").RootPath
    }
};

Advantages of this method

At VM Role you have to take care about the update of your system software by yourself. Take a look on this Blogpost where you can read more about SLA, Statelessmess and Updating. In Fact I can’t promise to you if the examples on this side are Best Practices. It seems like it works and before you are too much into the VM thing it might be good to know your opportunities.

Disadvantages

Of course difficult installations takes there time... and they can fall through. If the Fabric Controller adjusts the VM it’s not good if it takes a long time to boot specific VMs – in this time you can’t use the needed resources.

Result

If you don’t use standard Azure components or install more Tools you can do it on several ways with the regular Windows Azure instance – but if the application is more complex (Sharepoint / TFS) it will be more difficult and maybe unsolvable. A view on these examples will show you more about this.