-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deployment is *very* slow (nodeJS with publish profile) #60
Comments
My deployments are taking 10 minutes and it is slowing us down. How can we improve the situation? |
Our deployments are taking over 30 mins! |
@0gust1 Sorry for delayed response. |
Any way to speed it up @AmrutaKawade ? |
@sfabriece custom deloyment scripts should work. some examples |
Thanks @AmrutaKawade ! Ideally, hints could be given in documentations and workflow files (for example: https://github.com/Azure/actions-workflow-samples/blob/master/AppService/node.js-webapp-on-azure.yml), as every nodeJS app have the same behavior on this, and people using the actions-workflow-samples will encounter the same issue. |
@AmrutaKawade as far as I can tell, the deploy scripts control how the app is deployment once on the target machine. How do I control what ends up in the zip file? |
@sfabriece you can provide directly zip as a input to action or folder location which will be zipped in action
|
…tion resolving the issue - Azure/webapps-deploy#60
Closing the issue as the question has been addressed and for performance we already have npm install in the sample workflow which optimises the time |
Had the same issue, tried with the suggested solution of creating a custom deploy (btw, custom deploy for a standard task?) |
Could somebody please explain how this can be solved? I am using the latest version of the script automatically installed by the Azure portal when using the deployment center. It seems to be running npm install on Github then uploading every file individually. Did anyone find a way to (A) zip them up and unzip them on the target webapp or (B) just do the npm install on the target webapp (although that would stop you from doing any other steps using github actions like testing)? |
Seconding this one I am having the same problem and the solutions provided above do not seem to be working. I am using the standard file automatically generated by the Azure portal as well. |
@BALAGA-GAYATRI , can you please help here with the above queries? If the solution isn't working, can you please reopen the issue? |
Takes 30+ min for my deploy step on Azure, just < 5min on DigitalOcean app service. |
@stefanoz-cloud sure
|
The deployment is slow when there are many files to deploy. The only way to speed up deployment time is to decrease the artifact size. |
Not sure how other platforms handle it, but I’ve only seen this delay deploying to Azure. Vercel, digitalocean and a few others do not have this issue, same codebase. |
I could imagine that the deployment process, especially the Zip unpacking on the App Service, would be faster when running in parallel. Another option would be using Docker images. You create your custom image and upload it to a container registry. After that the image is applied on the App Service. Perhaps this is faster than deploying a Zip file. |
@MoatezNG your answer worked for me. Brought my build and deploy from 2.5 hrs to 20 min. Thank you |
Something to add: |
Similar issue (#229) is going on, we will be fixing this soon. |
great to hear, thank you! |
In upload artifacts section include only build/ directory
|
Making the zip file from GitHub build process and doing unzip on the Azure side seems to work much better. |
I significantly reduce my deployment time from 11 minutes to 1 minute by zipping after |
I was using Azure Devops to build and package my NextJS app with fully acceptable build times (~1 minute with caching). However when I changed the WEBSITE_RUN_FROM_PACKAGE application setting to 1 my deploys took 20 seconds. So for everyone banging their heads: go to configuration and set:
|
A small update (as I originally created the issue...)
|
|
Well it continues to be an issue to deploy anything other than .NET on Azure |
Indeed. Just switched to the
Not sure who's really at fault here, Windows with its legacy path requirements, or node and npm with it's 90k+ JS files required to run a website... |
Hey guys, I wanted to validate @MoatezNG answer as successful. After you connect your Azure resource to your Github account, you will have a secret and yaml file appear in your respective repo. You need to access that .yml file and modify it according to @MoatezNG instructions though it might differ for some people. Also remember that indentation is important and will result in errors if done incorrectly. Here is my new yml file which resulted in deployment in under 4 minutes (remember most of this is automatically generated so you just need to add specific parts):
P.S. if you're publishing a react app you need to include your build file in your repo (npm run build will generate this file on your machine) ✌️ |
this solve the delay to deployment but adding this, breaking application and getting this error - code: 'MODULE_NOT_FOUND', |
commenting to keep reference. having a similar situation of ~15min build time even with a zipped directory. i tried excluding the node_modules folder from the zip and then doing npm install in the startup command. i verified it was targeting the correct directory and that it was correctly installing modules but the apiapp just says there was an error. may try using a bash script in the /home directory, as some others in the thread suggest, but i cant see why that would work as opposed to a startup command. |
fixed this issue by changing the zip command to
after it, the app runs perfect and deploying is fast too |
going by the deployment logs in azure, a lot of time taken is azure not being very smart about handling zip deploys, and the workflow staying connected during that. WHen you deploy a zip file it puts it in a /tmp directory, then extracts it to /tmp/zipdeploy/extracted, THEN copies the files over to your destination. it would be a whole lot faster if it just extracted into the target directly |
Here is the workflow which runs fast.
|
only zip and deploy what you need.
|
Or you can deploy include the node_modules only when there is a change to the package.json |
I'm using a workflow file adapted from "build and deploy a Node.js Web app to Azure using publish profile".
(side remark) : I had issues with symbolic links too (see #54 (comment))
Upon analysis, it seems that the whole copy of the
node_modules
folders to the webroot of the webapp takes ages (10-12 minutes for the Azure Webapp deploy step !) It's very inefficient to process and send many little files over network.=> Shouldn't the final
npm install
(andnpm run build
– I'm using typescript) commands be executed on the target machine instead of a github action container ?IMHO, the workflow should be like this for the "nodeJS with publish profile" scenario :
npm install
,npm run build
andnpm start
should be done on the targeted runtime machineazure/webapps-deploy
Related questions :
.deployment
file, deployment hooks, etc.references : https://github.com/projectkudu/kudu/wiki/Customizing-deployments and https://github.com/projectkudu/kudu/wiki/Deployment-hooks
The text was updated successfully, but these errors were encountered: