Ilya
Ilya

Reputation: 436

Code deployment to Azure multi-instance Web App

The basic question how does Azure copies ASP.NET web site's files to all instances of the site during web deploy?

Can we deploy just zip package with web site and one powershell script based Azure Web job(triggered one) which will do the following:

  1. unzip the package
  2. do copy right on the Azure server to /site/wwwroot/

?

if its possible, By this way we get advantages:

  1. We send less bytes to Azure web site during deployment(web site sources could be zipped very well) so deployment process takes seconds even for huge sites

  2. Real deployment work is done by triggered web job which makes deployment process async. we can run many deployments from same build machine and then just monitor the processes

we have successfully applied such approach to deploy Azure Web Jobs. we have 10 web jobs with almost the same dependencies and deploy the same stuff 10 times(50MB * 10) takes too much time. but in this case Azure Web App which hosts this web jobs is one instance.

So will situation be different for multi-instanced web app?

Upvotes: 2

Views: 1165

Answers (2)

Amor
Amor

Reputation: 8491

how does Azure copies ASP.NET web site's files to all instances of the site during web deploy?

Azure web app content is stored on Azure Storage and is surfaced up in a durable manner as a content share. For each instance, the sandbox implements a dynamic symbolic link in kernel mode which maps d:\home to the web app content home directory. No matter how many instances the web app is deployed on, each can access their home directory using 'd:\home'. So, by default, Azure Web App will not copies the web site's files to each VM instance.

You can also enable Local Cache by setting 'WEBSITE_LOCAL_CACHE_OPTION' property to 'Always' in app settings for your App Service. After that, Azure Web App will copy the /site and /siteextensions folders of shared content to each local VM instance on web app startup. And the 'd:\home' path will point to the local cache. If your Web App is restarted, Azure Web App will re-copy the shared content to each local VM instance.

So will situation be different for multi-instanced web app?

If you haven't turn on the local cache, the situation will be same for multi-instanced web app. If you did turn on the local cache, you need to restart your Web App to apply the changes to each instance after any content has been deployed.

Upvotes: 3

Galin Iliev
Galin Iliev

Reputation: 167

App service is using a network share to map the source folder. So changes in the content are applied to all instances. There are exceptions when LocalCache is used -in this case explicit web app restart is needed to make changes in effect

Upvotes: 1

Related Questions