NodeRole is the way smarx deploys node apps to Windows Azure. Note that these days, there's (built-in support for running Node.js in Windows Azure)[http://www.windowsazure.com/en-us/develop/nodejs/], which you may prefer to use.
The code works by downloading prerequisites (node, the iisnode module, and the C++ runtime required) at runtime, installing them in the VMs in Windows Azure, and then synchronizing code from either a git repository or a blob container. This way, changes can be made rapidly without having to redeploy. Dependencies are installed by running npm, the Node package manager.
To use it, do the following:
- Create an app with a server.js in it. The app must listen on the port specified by the
PORTenvironment variable (e.g.
listen(process.env.PORT || 3000), which will default to port 3000 if simply being run from the command line).
- Push that code to a public git repository or to a container within Windows Azure blob storage.
- Build NodeRole (by running
buildfrom the command line).
- Configure the application (by editing
*.cscfg) with either a GitUrl (full URL to your git repository) or the pair of DataConnectionString and ContainerName. You can specify both a git URL and a blob container, and both will be sync'd to the same directory.
- Run the app locally with the Windows Azure compute emulator with
runfrom the command line, making sure that you've modified
ServiceConfiguration.Local.cscfg, which is used when running locally.
- Deploy the app to Windows Azure, using
noderole\bin\release\app.publish, with appropriate settings in the
As an alternative to downloading and building yourself, you can click on "downloads" above and download a pre-built package and deploy that. (You can still modify
*.cscfg to use your own app code.)