MRCollective / AzureWebFarm

MsDeploy enabled Web Farm using Web Roles in Azure based on Windows Azure Accelerator for Web Roles and including a background worker execution model
Other
19 stars 4 forks source link

Issue from the old Accelerator. Not an Issue with AzureWebfarm #12

Closed christianarg closed 10 years ago

christianarg commented 10 years ago

We use the old Web Role Accelerator. Since we use Azure 2012 server, we have to use a startup script to uninstall webdeploy 3.0 and install webdeploy 2.1. How did you guys solve this? I suppose you use WebDeploy 3.0?

We currently have no resources to Update to your proyect (we'll try).

robdmoore commented 10 years ago

Hi @christianarg!

I'm pretty sure that we are using 3 - we use whatever the Azure package installs when you opt in to WebDeploy (a bit cheeky on our part, but it definitely works). We had to overcome the problem of Web Deploy 3 not working against the Windows Azure Load Balancer by default (I assume this is the problem you are referring to) by doing some clever stuff with load balancer probes. Happy to explain if you want to know.

In terms of upgrading it should be fairly easy to do side-by-side with your old farm since it actually uses different tables in table storage. The readme has fairly complete instructions for setting it up. If you need assistance to get it running feel free to reach out here or on twitter via @robdmoore or @mdaviesnet.

christianarg commented 10 years ago

Yes, our problem is with WebDeploy 3 and the Azure Load Balancer! Please explain me the clever stuff! (Hope I get it).

Do you explain it to me here or shall we continue with Twitter?

Sorry for opening an Issue!

MattDavies commented 10 years ago

Hey @christianarg,

Happy to explain here as it might be useful for someone else in the future.

After adding support for Windows Server 2012, we discovered that Web Deploy 3 doesn't really place nice with the Windows Azure Load Balancer - it appears to use multiple connections, and those connections were distributed to multiple servers in our test web farms for a single deployment, causing msdeploy to fail pretty miserably with strange XML errors.

The solution was to create a custom endpoint in https://github.com/MRCollective/AzureWebFarm/blob/master/AzureWebFarm.Example.Cloud/ServiceDefinition.csdef - take a look at the loadBalancerProbe="WebDeploy" and the LoadBalancerProbe config setting for reference.

That custom probe hits a file we created called Probe.aspx. That file is a really simple bit of code which attempts to get an Azure Blob Storage lease on a blob we specify. Only one instance will ever be able to get that lease at a time, and if it ever fails, another instance will pick it up, ensuring this solution still gives us redundancy for deployments.

Should an instance successfully get the lease, it will return a HTTP OK status on that load balancer endpoint, and the Azure Fabric will know that it's fine to route web deploy requests to that instance. All the other instances will fail to get the lease, and return a HTTP error status back to the endpoint, meaning the Azure Fabric will not send any web deploy requests to all other instances.

You must find this useful if you're interested in more detail about custom endpoint monitoring in Azure: http://blog.mdavies.net/2013/04/27/custom-load-balancing-endpoints-azure-web-worker-vm-role/.

Hopefully that all makes sense - you can check out our ServiceDefinition.csdef and Probe.aspx if you want to attempt that with the old Accelerator project, but I'd still definitely recommend you try to move to our version of the solution if possible (especially if you have limited resources) given you then never have to worry about dealing with this type of issue yourself :)

robdmoore commented 10 years ago

Nice Matt. Now copy that into a blog post! Lol.

MattDavies commented 10 years ago

Haha okay. I've put it up here, anything I've missed?

http://blog.mdavies.net/2014/01/10/fixing-msdeploy-error-web-deployment-task-failed-root-element-missing/

christianarg commented 10 years ago

Allright guys, many many thanks for your fast answers. We also use the Steve Marxs AutoLease so I get it. You were right, it's really clever stuff :)

We will try to adopt this solution. I really want to Update to de WebFarms, but we also modified the Accelerator code to solve some of it problems, specially that process that leaked memory (we also moved the sincronization code to a service, etc). So I think it will take some time.

Again many thanks and sorry for opening a Issue, as it was already solved by you.

MattDavies commented 10 years ago

Nice! Our solution is based on AutoLease :)

Yeah, understood. I remember fixing that memory leak issue as well with a startup script hotfix - fortunately it's fixed by default in Windows Server 2012.

No problems at all - good luck and feel free to ping one of us on twitter if you need anything, or just to let us know how you're going with it!