Deploying RAP to Windows Azure
Since I recently deployed my first application to Microsoft’s Cloud Services-Platform Windows Azure I wanted to share the steps taken to get the application up and running. As I promised in the title of my post my sample application will be an Eclipse RAP application (to keep things simple I will use the RAP Mail template).
Before we can start we need to install some things first. Here is what we need to get started:
- IIS and ASP.NET (If those are not installed the Azure SDK won’t install) 
- The Azure SDK from http://www.microsoft.com/downloads/de-de/details.aspx?FamilyID=7a1089b6-4050-4307-86c4-9dadaa5ed018
- The Azure Eclipse-Plugin from the following repository http://webdownload.persistent.co.in/windowsazureplugin4ej/
- Eclipse RAP Target and Tooling
- The Eclipse WAR-Products-Plugin from the following repository http://download.eclipsesource.com/~hstaudacher/warproducts/3.7/
After finishing the wizard the project will be created. At this point we should have a fresh Windows Azure Project which should look like this.
- A zipped version of the JRE (Since there is no zipped version of the JRE available for download I zipped C:\Program Files\Java\jre6)
- A zipped version of tomcat (It is also possible to use other servers such as Jetty)
- The WAR-archive we created earlier
Next we have to edit the file /MyAzureProject/WorkerRole1/approot/util/startup.cmd to contain the following lines:
@REM unzips the Tomcat Server cscript /B /Nologo util\unzip.vbs apache-tomcat-7.0.22-windows-x64.zip "%ROLEROOT%\approot" @REM unzips the JRE cscript /B /Nologo util\unzip.vbs jre6.zip "%ROLEROOT%\approot" @REM copies the war-archive to the server md "%ROLEROOT%\approot\apache-tomcat-7.0.6\webapps\myapp" copy rapmail.war "%ROLEROOT%\approot\apache-tomcat-7.0.22\webapps" @REM starts the server cd "%ROLEROOT%\approot\apache-tomcat-7.0.22\bin" set JRE_HOME=%ROLEROOT%\approot\jre6 startup.bat
At this point we have to configure a public endpoint for the tomcat server to listen on. To do so we have to open the project properties of the azure project and navigate to Windows Azure –> Roles and edit WorkerRole1.
Testing in the emulator
To test our application in the Windows Azure emulator we first have to make sure that we build for the emulator. To do so we have to set Build For: Testing in emulator in the project settings of the azure project.
Now we can build the project by running the provided ant script package.xml. After a successful build we can use the scripts in the folder emulatorTools start the emulator and deploy the project.
If deployment was successful the Rap-Mail-Sample should be available via http://localhost:8080/rapmail/mail?startup=RapMail.mailapp
Deploying to the cloud
To build the project for deployment to the cloud we have change the project settings to Build For: Deployment to cloud.