Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you deploy multiple webapps on one Windows Azure instance?

Tags:

It is possible have a bunch of web apps running in one windows azure small compute instance?

I am looking at using Azure as a place to sit a bunch of projects (web apps) that are in dev and non-production ready. Some are actually moth-balled, but I'd like to have an active instance of them somewhere. I don't want to pay for separate compute hours for each app, that is just sitting there 90 % of the time.

The other option I am considering to get a shared hosting account for these projects.

like image 395
Adam Gordon Bell Avatar asked Aug 22 '10 17:08

Adam Gordon Bell


2 Answers

Yes, it is now possible with the latest Azure platform updates that were released late 2010.

You have to make the appropriate config changes in your Azure Project's service definition file. Below is an example of multiple sites on the same domain. The Register site is using an https endpoint (you must also configure your cert) and the rest are using http. The Public site does not specify a host header and will catch anything not explicity specified. This is great when you have one app that needs to handle multiple subdomains (like shopify). In order to make this work you need to have a dns that allows wildcard cnames (GoDaddy dns does not). Obviously, you also need a cname record that points to azure for each of the other subdomains. One other thing to note in this example is that the physicalDirectory for the apps are relative to the Azure Project. Hope this helps!

Here's a link that may help: http://msdn.microsoft.com/en-us/library/gg433110.aspx

    <?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="SampleAzureProject" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
  <WebRole name="RegisterSite_WebRole">
    <Sites>
      <Site name="RegisterSite" physicalDirectory="..\RegisterSite">
        <Bindings>
          <Binding name="RegisterBinding" endpointName="Endpoint1" hostHeader="register.sample.com" />
        </Bindings>
      </Site>
      <Site name="PublicSite" physicalDirectory="..\PublicSite">
        <Bindings>
          <Binding name="PublicBinding" endpointName="Endpoint2" hostHeader="" />
        </Bindings>
      </Site>
      <Site name="ManageSite" physicalDirectory="..\ManageSite">
        <Bindings>
          <Binding name="ManageBinding" endpointName="Endpoint2" hostHeader="manage.sample.com" />
        </Bindings>
      </Site>
      <Site name="MarketingSite" physicalDirectory="..\MarketingSite">
        <Bindings>
          <Binding name="MarketingBinding" endpointName="Endpoint2"  hostHeader="www.sample.com" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="https" port="443" certificate="SampleReg" />
      <InputEndpoint name="Endpoint2" protocol="http" port="80" />
    </Endpoints>
    <Imports>
      <Import moduleName="Diagnostics" />
    </Imports>
    <Certificates>
      <Certificate name="SampleReg" storeLocation="LocalMachine" storeName="My" />
    </Certificates>
  </WebRole>
</ServiceDefinition>
like image 187
Randy Staats Avatar answered Sep 20 '22 05:09

Randy Staats


It depends on what you mean by Windows Azure instance.

A single Azure Account can hold multiple services and deployments. Deployment (at the moment of writing) could hold multiple Worker and Web Roles (essentially projects).

A single Web Role can be deployed in multiple deployment instances.

Given all that, you can easily host multiple web applications in a single Windows Azure Account or even a single deployment.

If you are interested in minimizing costs and keeping multiple test web apps under a single web role instance it gets tricky - you'll need to bring them together into a single project and deploy at once.

Note: last scenario might see drastic improvements rather soon, so Windows Azure is a rather safe bet.

like image 40
Rinat Abdullin Avatar answered Sep 20 '22 05:09

Rinat Abdullin