Kid_Learning_C
Kid_Learning_C

Reputation: 3631

Azure function: clarifications about zip deployment and run from package file

Quote from this doc:

In Azure, you can run your functions directly from a deployment package file in your function app. The other option is to deploy your files in the d:\home\site\wwwroot (Windows) or /home/site/wwwroot (Linux) directory of your function app.

After reading the entire page and other pages regarding zip deployment. I'm not sure if I am correct in the following summary:

To run an Azure function, you can do either:

  1. Run your functions directly from a deployment package file in your function app in /home/data/SitePackages;

  2. Deploy your files in the /home/site/wwwroot (Linux) directory of your function app.

So, When deploy your function app project files directly from a .zip file, the .zip file is uploaded and saved in /home/data/SitePackages in linux. The .zip deployment API takes the contents of a .zip file and extracts the contents into the home/site/wwwroot folder of your function app. (This is what option 2 says)

For option 1, however, if choose to run your functions directly from the deployment package file (configure WEBSITE_RUN_FROM_PACKAGE = 1 in function app settings), then the contents in the .zip file are not extracted and copied into wwwroot directory. Instead, the package file is mounted by the Functions runtime, and the contents of the wwwroot directory become read-only.

Is the above understanding accurate?

specifically, are these 2 statements accurate:

Upvotes: 5

Views: 6346

Answers (1)

Daredevil
Daredevil

Reputation: 1625

No matter how you run the function, once you do zip deployment, the .zip package file is stored in /home/data/SitePackages.

Yes, this is accurate. Regardless of how you choose to run your function, zip deployment ensures that the package is stored in this location.

If you configure WEBSITE_RUN_FROM_PACKAGE = 1, then the .zip file located in /home/data/SitePackages is directly mounted. No extraction happens, and wwwroot is both read-only and empty (since Azure does not extract files and put them into it anymore).

This is almost correct. The main idea is correct: when you set WEBSITE_RUN_FROM_PACKAGE = 1, the .zip file is mounted directly, and its contents are not extracted to the wwwroot directory. As a result, wwwroot becomes read-only. But, whether it's "empty" is misleading; it may have other system files or old content, but it will be accurate to say that it won't have the active content from the current .zip package. The active content is directly read from the mounted .zip package.

Upvotes: 4

Related Questions