简体   繁体   English

Node.js Azure WebJob:如何通过持续交付从Visual Studio Team Services进行部署

[英]Node.js Azure WebJob: How to deploy from Visual Studio Team Services with Continuous Delivery

We have an existing Web App in Azure that we are deploying a Node.js webjob to. 我们在Azure中有一个现有的Web应用程序,正在将Node.js Web作业部署到该Web应用程序。

We are currently deploying the webjob during the build (CI) process by copying the run.js and node_modules folder into the web app's app_data/jobs/continuous directory as per the only tutorial I found, then building and deploying the WebApp itself using CD. 当前,我们正在构建(CI)过程中部署Webjob,方法是按照我发现的唯一教程,将run.js和node_modules文件夹复制到Web应用程序的app_data / jobs / continuous目录中,然后使用CD构建和部署WebApp本身。

While this works, it seems a little hacky, and it takes a really long time to deploy the web app now due to the huge number of files in the node_modules directory. 尽管此方法有效,但似乎有点不合常规,并且由于node_modules目录中的文件数量巨大,现在部署Web应用程序花费的时间非常长。

Is there a more automated approach, ie deploying the node.js webjob to an existing web app? 有没有更自动化的方法,即将node.js Webjob部署到现有的Web应用程序? I can find all kinds of tutorials for this scenario re: asp.net projects but only the one for node.js webjobs, which is described in para 2 above) 我可以在以下场景找到各种教程:asp.net项目,但是只有node.js webjobs的教程,这在上面的第2段中进行了描述)

Update 更新资料

I am using the instructions in Amit's blog: http://blog.amitapple.com/post/74215124623/deploy-azure-webjobs/#.VyC06DArKHs 我正在使用Amit博客中的说明: http//blog.amitapple.com/post/74215124623/deploy-azure-webjobs/#.VyC06DArKHs

Generally, if you are using Git to deploy your ASP.NET application to Azure Web Apps service, you can leverage npm manage file package.json to install the node modules via deployment task. 通常,如果使用Git将ASP.NET应用程序部署到Azure Web Apps服务,则可以利用npm管理文件package.json通过部署任务安装节点模块。

You can try the following steps: 您可以尝试以下步骤:

  1. Add a package.json file in your root directory path with the content including your needed dependencies. 在根目录路径中添加一个package.json文件,其内容包括所需的依赖项。 https://docs.npmjs.com/files/package.json#dependencies . https://docs.npmjs.com/files/package.json#dependencies
  2. If you have the project in Visual Studio, you can right click the wwwroot , then click Add => "New item", then under the Client-side tab, select the NPM Configuration File to add. 如果您在Visual Studio中拥有该项目,则可以右键单击wwwroot ,然后单击Add =>“ New item”,然后在Client-side选项卡下,选择要添加的NPM Configuration File 在此处输入图片说明在此处输入图片说明 After creating and config the npm configuration file, the Azure deployment task will install the dependencies automatically. 创建并配置npm配置文件后,Azure部署任务将自动安装依赖项。
  3. Create the webjob script and folder in your root directory in your repo or project. 在仓库或项目的根目录中创建webjob脚本和文件夹。 EG app_data\\jobs\\continuous\\testwebjob\\run.js . EG app_data\\jobs\\continuous\\testwebjob\\run.js You can directly require the module, it will find the module in the node_modules in root directory. 您可以直接require该模块,它将在根目录的node_modules中找到该模块。

Afterall, your root directory of your project will have the similar structure: 毕竟,您项目的根目录将具有类似的结构: 在此处输入图片说明

Any further concern, please feel free to let me know. 如有任何其他疑问,请随时告诉我。

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

相关问题 如何在Visual Studio Online中将node.js应用程序部署到Azure? - How to deploy a node.js app to Azure in Visual Studio Online? 如何从 Visual Studio 2019 将 Node.js 应用部署到 Azure 应用服务? - How do I deploy a Node.js app to a Azure App Service from Visual Studio 2019? 如何使用 Visual Studio Team Services Client for Node.js (vso-node-api) 创建工作项? - How to create work items using Visual Studio Team Services Client for Node.js (vso-node-api)? 如何在VSTS中设置Node.js Web作业的持续集成 - How do I set up continuous integration of a Node.js webjob in VSTS 如何将纯Angular应用程序从Visual Studio Team System部署到Azure网站 - How to deploy a pure Angular application from Visual Studio Team System to Azure websites Visual Studio Team Services上npm的升级节点 - Upgrade node for npm at Visual Studio Team Services 如何在 MS Team app studio 中构建 Node.js 应用程序? - How to build Node.js app in MS Team app studio? Node.js项目zip无法上载为Azure WebJob - Node.js project zip failed to upload as Azure WebJob Webjob中使用的Azure队列存储:如何通知用户? (node.js) - Azure Queue Storage used in Webjob: How to notify user? (node.js) 内部服务器错误500,在Azure中托管来自Visual Studio 2017的Node.js Express 4应用程序模板 - Internal server error 500, hosting Node.js Express 4 application template from Visual Studio 2017 in Azure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM