I recently tried to deploy an Azure node.js worker role for the first time, having previously always deployed to a full VM. The first step in doing so is to run the following powershell command to add the scaffolding files:
After which, you will find a file name download.ps1 in the root of your application. After scanning the code it appeared that this file was responsible for setting up the runtime environment for your application. What wasn’t clear was what this runtime environment consisted of. Google must have the answer, I thought, so off I went…..nothing….a few hits on github for people that had added this same file to their repos but nothing else.
After a bit of playing and poking, this is the story:
download.ps1 is used to download node.exe, so it’s pretty important, if you want your app to run. The script is called from Setup_Worker.cmd (if you’re deploying a worker role) or Setup_Web.cmd (if you’re deploying a web role). It takes the following paramters:
%RUNTIMEURL% is defined and initialised in your ServiceDefinition.csdef. I can’t find where ‘%RUNTIMEURLOVERRIDE%’ is defined and indeed, running the script without this parameter works fine.
You can try it yourself by remote desktopping to your instance and running the following command from the APPROOT directory of your deployment:
powershell .\download.ps1 'http://az413943.vo.msecnd.net/node/0.6.20.exe'
A problem with download.ps1 can result in the following symptoms:
- Your role fails to start and keeps recycling.
- Your role fails to run startup tasks with an exit code of 1
- C:\resource\WAHostBootstrapper.log has the following error logged: Program “E:\approot\node.cmd” .\startup.js exited with 1. Working Directory = E:\approot\
- node.exe is not present on your vm