azure-dev icon indicating copy to clipboard operation
azure-dev copied to clipboard

Use Oryx rather than local builds for Node.js and Python apps

Open fiveisprime opened this issue 3 years ago • 3 comments

I've noticed that I can run the CLI on WSL, so I setup my Windows side to support everything and I immediately noticed two things:

  • My API build failed because of CRLF
  • The build and deploy took a while compared to running the build in Oryx

This appears to be a conscious decision since SCM_DO_BUILD_DURING_DEPLOY is disabled. We've spent a lot of effort optimizing Oryx for node/python builds and that should be taken advantage of here as well.

fiveisprime avatar Jan 20 '22 18:01 fiveisprime

@fiveisprime - Thanks for opening this. I'm trying to better understand how Oryx works and where the work is done. Here's my (very likely incorrect understanding) of what we should be doing (for Node and Python):

  1. Set SCM_DO_BUILD_DURING_DEPLOY=true for app services which run node or python code (we'll keep it to false and use WEBSITE_RUN_FROM_PACKAGE for .NET)
  2. Don't call npm run build or any other build like steps
  3. When deploying, continue to use az webapp deplyoment source config-zip to provide a zip file, but don't include artifacts like node_modules or a python virtual env in the deployment package, since Oryx will pull these artifacts in as part of the build.

Is that correct? Or do we need to run Oryx on the machine we are deploying from? Do we need to set any other properties in the App Service configuration to use Oryx vs Kudu (which my understanding is now the legacy way to do these builds)?

ellismg avatar Jan 21 '22 21:01 ellismg

Oryx is an DevDiv project: https://github.com/microsoft/Oryx It's used in place of Kudu when deploying to App Service Linux.

Those steps are correct. This is also how we're doing deployments in the App Service extension for VS Code (including building .NET locally).

fiveisprime avatar Jan 21 '22 22:01 fiveisprime

@gadecast (Gabriel Castro) reached out and offered to advise us on this. He is with the Oryx team.

markweitzel avatar Feb 02 '22 14:02 markweitzel

Revisiting this stale issue... I'm not sure about the historical context here, but the current state is that:

For python:

  1. azd creates its own dictated python venv
  2. azd installs requirements.txt
  3. azd does a zipDeploy with the zipped source dir (excluding venv and pycache), with SCM_DO_BUILD_DURING_DEPLOY=true for Oryx to build

For node:

  1. azd runs npm install
  2. azd runs npm run build
  3. azd does a zipDeploy with the dist dir, with SCM_DO_BUILD_DURING_DEPLOY=true, but artifacts are already built locally.

I believe that some of this were to enable local dev scenarios. But there is opportunity to speed up deploy times for node/python - appservice if we were interested about those efforts (at the cost of less local dev validation).

weikanglim avatar Mar 01 '24 18:03 weikanglim