-
Notifications
You must be signed in to change notification settings - Fork 222
Azure deployment
This short tutorial demonstrates how to deploy Cumulus Server to Windows Azure
- Visual Studio 2010 SP1 installed
- Windows Azure SDK 1.8 installed
- Windows Azure Account
- Azure Homepage: http://www.windowsazure.com/en-us/
- Exercise Windows Azure and Native Code: http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_windowsazurenativecodevs2010_topic2.aspx
Windows Azure is built fully in a x64 environment. Therefore you need to build Cumulus Server for the x64 platform.
While building POCO library with Visual Studio 2010 command prompt x64 I faced an unfixed issue (http://connect.microsoft.com/VisualStudio/feedback/details/505682/x64-c-c-projects-cannot- compile). Use in this case Visual Studio instead. Build the POCO libraries with debug_static_mt in the following order: Foundation, NET, UTIL, XML. Then build the LuaJIT Project with the Visual Studio Command Prompt x64 by calling msvcbuild.bat. OpenSSL x64 binaries can be downloaded and installed – it needs no build.
Move the libraries to the Cumulus Folder\External\lib. Take from each project (POCO, LUAJIT and OpenSSL) the includes and place them into Cumulus Folder\External\include.
Follow the exercise “Windows Azure and Native Code”:
- Add a cloud project to the Cumulus Solution and use the dialog to create a worker role
- Use the Configuration Manager of the solution and change the CumulusLib and CumulusServer to x64 platform
- Keep the Output Folder of the CumulusServer (Property – Linker - General) as it is – do not follow the Exercise instruction (if you do, you cannot debug the project anymore)
- Build the solution
- Copy the following files to the worker role project and add it in Visual Studio: CumulusServer.exe, CumulusServer.ini, libeay32.dll, lua51.dll, msvcr100.dll (C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\redist\x64\Microsoft.VC100.CRT)
- Configure the Windows Azure Project – open the property page of the worker role inside the Role directory: a. Configuration tab: Change the .Net trust level to Full Trust b. Configuration tab: Change the diagnostics storage account string to your account c. Endpoint: Add an input udp enpoint with the port of your choice d. Open the ServiceDefinition.csdef file and add the following element inside the WorkerRole element:
<Runtime executionContext="elevated" />
-
Inside the WorkerRole.cs file inside the worker role add the following code inside the OnStart method:
var appRoot = Path.Combine(Environment.GetEnvironmentVariable("RoleRoot")+@"", @"approot"); int port = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["RTMFP"].IPEndpoint.Port; StreamWriter sw = new StreamWriter("CumulusServer.ini",false); sw.WriteLine("port = " + port.ToString()); sw.Flush(); var myProcess = new Process() { StartInfo = new ProcessStartInfo(Path.Combine(appRoot, @"CumulusServer.exe")) { CreateNoWindow = false, UseShellExecute = false, WorkingDirectory = appRoot }; myProcess.Start();
Run the project on your computer with the Windows Azure emulator ( right click the cloud project – Debug – start new instance). After starting up you should see the CumulusServer Command Prompt.
For deploying to Azure right click the Cloud project and click publish.
Switzerland, December 13th 2012 / Marc Loeb