0

We are currently moving a self-hosted koa app to IISNode on Azure WebSites..

In self-hosting, we initiallize the application by calling node --harmony ./bin/application Requests then go to ./index.js.

However we could not find how to setup IISNode to call "bin/application" at initialization time.

Any ideas? Thanks

JoaoCC
  • 624
  • 6
  • 15

2 Answers2

1

Not sure this is the same scenario, but I ran into something that sounds like this when express.js started using ./bin/www as the entry point for express.js apps. Initially it broke everything, but now we look for the "scripts" entry in the package.json to tell Azure how to configure IISNode for the application. For express, it generates a "scripts" entry that looks like this:

"scripts": { "start": "node ./bin/www" },

When Azure sees this, it generates a web.config on the server that uses ./bin/www for the entry point.

So... I'd say first off, try adding a "scripts" entry to the package.json that points to your ./bin/application file, and try deploying that to Azure. Hopefully that 'just works'. If it doesn't, try adding a web.config to the root of your application, using https://gist.github.com/Blackmist/8677359708fd30779c77 as the contents. This should point IISNode to the ./bin/application file as the entrypoint, and is what Azure Websites should automatically generate when it sees the "scripts" entry in the package.json file.

The other problem you'll run into is using Node.js v0.11.13, which I don't believe is included in Azure websites by default, and passing the --harmony switches. http://azure.microsoft.com/en-us/documentation/articles/nodejs-specify-node-version-azure-apps/ has a section on including a version of node.js as part of your website. In the iisnode.yml file, you'd want to have a line similar to the following:

nodeProcessCommandLine: d:\home\site\wwwroot\bin\node.exe --harmony

I believe this should make this work.

Larry Franks
  • 421
  • 3
  • 4
  • Hi Larry, I couldn't get the scripts section in packages.json to be reflected in web.config. Could you provide a sample of the deployment scripts you use to get this working? – SergioC Sep 16 '14 at 09:52
  • I didn't use a custom deployment script. I manually created the web.config at the root of my application and included it as part of the deployment. – Larry Franks Sep 17 '14 at 12:22
0

You can setup custom deployment scripts for Azure Websites.

This blog post contains details on how to use it: http://blog.amitapple.com/post/38417491924/azurewebsitecustomdeploymentpart1/#.VBcrnPldXIc

Zain Rizvi
  • 23,586
  • 22
  • 91
  • 133