Adam Gordon Bell
Adam Gordon Bell

Reputation: 3093

Can you deploy multiple webapps on one Windows Azure instance?

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.

Upvotes: 20

Views: 10112

Answers (6)

Randy Staats
Randy Staats

Reputation: 394

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>

Upvotes: 18

dthorpe
dthorpe

Reputation: 36082

The only way to have multiple web apps running in one Azure instance is to combine the multiple apps into one WebRole project. Azure requires one web app per web role instance.

This might not be too hard if your web apps are fairly simple or just aspx generated html pages - put each app in its own URL subdirectory to keep the page names separate from other apps. Since links between pages within the same app are usually relative to the home directory, this shouldn't upset your links much. You can access each "subapp" using url paths: http://mydomain.com/app1/default.html, http://mydomain.com/app2/... etc.

You'll see diminishing returns as the complexity of each web app increases. It will be more difficult to shoehorn multiple complex apps into a common master app.

But for experiments and proof of concept type work, once you start the master app pattern it should be fairly easy to keep it going for future work. You would be using your Azure web role instance as a portfolio of works instead of a one-off scratchpad for whatever the latest experiment was.

Upvotes: 3

Roopesh Shenoy
Roopesh Shenoy

Reputation: 3447

Azure may not be the best for this use case - one VM allows only one app and all other options are somewhat complicated to implement (like having multiple apps in one web role or on-demand deploying and tearing down - also note that Azure charges for the clock hour, so I am not sure what happens if you bring up an instance, bring it down and then bring it up again within an hour).

Another cloud provider, like rackspace or Amazon might be better, you could create Windows VMs and host your apps on IIS as you would on a normal server. Only advantage in this case would be easier provisioning of that server and no infrastructure management (you still have to manage OS and other dependencies though, unlike Azure).

Upvotes: 1

Adron
Adron

Reputation: 1856

Basically you're limited to one app per role.

Not sure if this will change as there are reasons behind Windows Azure hosting this way.

From reading your question, it sounds like the cloud may not be ideal for you at this time. Especially if you have something that is "90%" not utilized. That's a lot of wasted process time for a role to sit idle, while paying the $$.

My advice would be to use shared hosting or something until the site demands higher uptime, scalability, and other Cloud Features of that sort.

Upvotes: 1

Taylor Bird
Taylor Bird

Reputation: 8007

Azure in its current state (Aug 2010) will only run one application ("service", "role") per VM instance.

So the simple answer to your question is no, at this time.

Now, given all the capabilities of the platform, you could come up with some creative ways of providing this sort of sandbox. With the Service Management API, you could have the deployment sitting out in Azure storage and bring the roles online at the moment they are requested, then turn them off ("delete the deployment") when they are no longer needed. There would be some lag on the deployment as the fabric brings the VMs online .. but depending on the use-case, this could yield you some major savings.

Upvotes: 3

Rinat Abdullin
Rinat Abdullin

Reputation: 23552

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.

Upvotes: 3

Related Questions