0
votes

We have an existing Web App in Azure that we are deploying a Node.js webjob to.

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.

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.

Is there a more automated approach, i.e. deploying the node.js webjob to an existing web app? 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)

Update

I am using the instructions in Amit's blog: http://blog.amitapple.com/post/74215124623/deploy-azure-webjobs/#.VyC06DArKHs

1
Are both your WebApp files and WebJobs files in the same repository?David Ebbo
Yes they are, thanks.Gustyn

1 Answers

0
votes

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.

You can try the following steps:

  1. Add a package.json file in your root directory path with the content including your needed 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. enter image description hereenter image description here After creating and config the npm configuration file, the Azure deployment task will install the dependencies automatically.
  3. Create the webjob script and folder in your root directory in your repo or project. E.G. 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.

Afterall, your root directory of your project will have the similar structure: enter image description here

Any further concern, please feel free to let me know.