question

LuigiAversa-2462 avatar image
0 Votes"
LuigiAversa-2462 asked ·

Azure App Service Node.js deployment with Kudu serves the public folder rather than the build folder

I just used azure app service with CI/CD to deploy my react application, however I realised that after all the steps kudu serves my application not from the build folder that it has generated, but from my source folder. How I can change to let kudu to serve the build folder?

azure-webapps
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JoffreyNURIT-4769 avatar image
0 Votes"
JoffreyNURIT-4769 answered ·

Hi @LuigiAversa-2462,

In a "normal way", your app service have only files from your ArtifactStagingDirectory.

You CI/CD have 2 parts: builds and Reelease management.
If you have source / build folder on your VM / app service, your error are in Pipeline process.

A pipeline process work like this:
- download source
- execute build (npm install, restore nugget, build for .net / java apps, etc.)
- Execute tests if you have some
- The most important: create an artefact and publish

This artefact are your app files you want to deploy. In my exemple below, you can see i have a build process for my .net core app who set result in artifactstaggingdirectory. The second process make a zip from this directory and publish that. So, in my release management, i have only my artifactstaggingdirectory files.
It's a good practice. For exemple, a security warning : in source and build files, you have sometimes necessary files for testing, and you don't want to have this files on your production server !


alt text

alt text

I hope i help you. If not, you can sent screen ;)



azuredevops.png (27.0 KiB)
azure-devops2.png (15.8 KiB)
· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LuigiAversa-2462 avatar image
0 Votes"
LuigiAversa-2462 answered ·

Hi @JoffreyNURIT-4769

thanks for getting back to me and sorry for the late answer.

Let me put some context around my question: my case is specific of Azure App Service Node.js deployment on Linux machine. My app is hosted in GitHub, therefore App Service uses Kudu as deployment engine.

The deployment is successful and the App status is Active and reachable.

What push me to raise the issue is Azure App Service on Linux machine seems to serve the app from the "/home/site/wwwroot/public" rather than "/home/site/wwwroot/build", the former seems to be the webserver virtualhost and the latter is the result of the node.js built process which in a production environment should be the one reachable from outside because it contains the app itself.

Please also note that the Azure App Service Setting --> Configuration section is slightly different in this case from any .Net application. Most of the configuration that you can do on the server side for a "typical Microsoft App" are not available for Linux.

Thanks
Luigi

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.