简体   繁体   English

如何将NodeJS项目部署到Azure网站?

[英]How to deploy NodeJS project to Azure websites?

We have a NodeJs project we are building with TeamCity, then using FTP, uploading the built files to our Azure web app (.azurewebsites). 我们有一个正在使用TeamCity构建的NodeJs项目,然后使用FTP,将构建的文件上传到我们的Azure Web应用程序(.azurewebsites)。 The project contains thousands of files, so the FTP upload times are very slow (takes a very long time). 该项目包含数千个文件,因此FTP上载时间非常慢(需要很长时间)。 We would prefer to package the build as a ZIP file, then upload the ZIP with FTP (much faster). 我们希望将构建版本打包为ZIP文件,然后通过FTP上传ZIP(速度更快)。 However, how do we unzip the ZIP file on Azure using script? 但是,如何使用脚本在Azure上解压缩ZIP文件?

Or is there a better way to deploy our build to our Azure web app? 还是有更好的方法将我们的构建部署到我们的Azure Web应用程序?

NOTES : 注意事项

  • This is an Azure web app service, does not live on a VM 这是Azure Web应用程序服务,不存在于VM上
  • Our process needs to be automated with script to support CI/CD 我们的流程需要使用脚本自动化以支持CI / CD
  • Deployments with Git and other repos are not feasible 用Git和其他仓库进行部署是不可行的

You can use the Kudu API or MsBuild to deploy an app (web app or Function) to Azure App service. 您可以使用Kudu API或MsBuild将应用程序(Web应用程序或功能)部署到Azure应用程序服务。 The deployment is usually done in 2 parts: 部署通常分为两部分:

  1. Deploy the app service using ARM templates 使用ARM模板部署应用程序服务
  2. Deploy the code/App using one of these methods 使用以下方法之一部署代码/应用程序

If you're using VSTS, there are templates for both steps and make it a 2min process to setup. 如果您使用的是VSTS,则这两个步骤都有模板,并且设置过程需要2分钟。 If you're not using VSTS, the Kudu API is he best way to solve the problem. 如果您不使用VSTS,则Kudu API是解决问题的最佳方法。

You can find more information here : https://github.com/projectkudu/kudu/wiki/REST-API 您可以在这里找到更多信息: https : //github.com/projectkudu/kudu/wiki/REST-API

You can also use the Azure PowerShell Management cmdlets to achieve the same. 您还可以使用Azure PowerShell Management cmdlet实现相同的目的。 However, this is at the moment only supported on Windows 但是,目前仅在Windows上支持

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM