diff --git a/Nodejs/Product/Nodejs/Nodejs.csproj b/Nodejs/Product/Nodejs/Nodejs.csproj index 57244ab22..a3f8a0934 100644 --- a/Nodejs/Product/Nodejs/Nodejs.csproj +++ b/Nodejs/Product/Nodejs/Nodejs.csproj @@ -1025,19 +1025,11 @@ - - - - - - - - @@ -1053,12 +1045,6 @@ - - - - - - @@ -1075,12 +1061,10 @@ - - @@ -1191,7 +1175,6 @@ - Designer @@ -1237,11 +1220,8 @@ Designer - - - Designer @@ -1293,20 +1273,15 @@ PreserveNewest Designer - - Designer - Designer - - Designer @@ -1322,6 +1297,7 @@ Designer + @@ -1331,28 +1307,19 @@ - - - - - Designer + - - - - - @@ -1362,11 +1329,8 @@ Designer - - - Designer diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ChangeConfig.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ChangeConfig.ps1 deleted file mode 100644 index 044634574..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ChangeConfig.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -$configFile = $args[0] - -Write-Host "Adding iisnode section to config file '$configFile'" -$config = New-Object System.Xml.XmlDocument -$config.load($configFile) -$xpath = $config.CreateNavigator() -$parentElement = $xpath.SelectSingleNode("//configuration/configSections/sectionGroup[@name='system.webServer']") -$iisnodeElement = $parentElement.SelectSingleNode("//section[@name='iisnode']") -if ($iisnodeElement) { - Write-Host "Removing existing iisnode section from config file '$configFile'" - $iisnodeElement.DeleteSelf() -} - -$parentElement.AppendChild("
") -$config.Save($configFile) diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ExpressApp.njsproj b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ExpressApp.njsproj index b1d3ff1aa..f485c6bf6 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ExpressApp.njsproj +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ExpressApp.njsproj @@ -10,7 +10,7 @@ 2.0 $guid1$ . - bin\www + app.js . @@ -30,7 +30,6 @@ - @@ -52,10 +51,6 @@ $endif$ - - - - diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ExpressApp.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ExpressApp.vstemplate index 725ee2bc2..0024143c6 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ExpressApp.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/ExpressApp.vstemplate @@ -31,13 +31,6 @@ layout.pug error.pug - - www - ChangeConfig.ps1 - download.ps1 - setup_web.cmd - node.cmd - Web.config Web.Debug.config app.js diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/Web.config b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/Web.config index 6d3bd5e81..c677e871b 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/Web.config +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/Web.config @@ -18,12 +18,12 @@ - + - + - - + + - + + + + + + + - + - - - + + + \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/app.js b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/app.js index 06c4e6382..ba91434fe 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/app.js +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/app.js @@ -1,4 +1,5 @@ 'use strict'; +var debug = require('debug'); var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); @@ -57,5 +58,8 @@ app.use(function (err, req, res, next) { }); }); +app.set('port', process.env.PORT || 3000); -module.exports = app; +var server = app.listen(app.get('port'), function () { + debug('Express server listening on port ' + server.address().port); +}); diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/download.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/download.ps1 deleted file mode 100644 index 9e46b09ad..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/download.ps1 +++ /dev/null @@ -1,87 +0,0 @@ -$runtimeUrl = $args[0] -$overrideUrl = $args[1] -$current = [string] (Get-Location -PSProvider FileSystem) -$client = New-Object System.Net.WebClient - -function downloadWithRetry { - param([string]$url, [string]$dest, [int]$retry) - Write-Host - Write-Host "Attempt: $retry" - Write-Host - trap { - Write-Host $_.Exception.ToString() - if ($retry -lt 5) { - $retry=$retry+1 - Write-Host - Write-Host "Waiting 5 seconds and retrying" - Write-Host - Start-Sleep -s 5 - downloadWithRetry $url $dest $retry $client - } - else { - Write-Host "Download failed" - throw "Max number of retries downloading [5] exceeded" - } - } - $client.downloadfile($url, $dest) -} - -function download($url, $dest) { - Write-Host "Downloading $url" - downloadWithRetry $url $dest 1 -} - -function copyOnVerify($file, $output) { - Write-Host "Verifying $file" - $verify = Get-AuthenticodeSignature $file - Out-Host -InputObject $verify - if ($verify.Status -ne "Valid") { - throw "Invalid signature for runtime package $file" - } - else { - mv $file $output - } -} - -if ($overrideUrl) { - Write-Host "Using override url: $overrideUrl" - $url = $overrideUrl -} -else { - $url = $runtimeUrl -} - -foreach($singleUrl in $url -split ";") -{ - $suffix = Get-Random - $downloaddir = $current + "\sandbox" + $suffix - mkdir $downloaddir - $dest = $downloaddir + "\sandbox.exe" - download $singleUrl $dest - $final = $downloaddir + "\runtime.exe" - copyOnVerify $dest $final - if (Test-Path -LiteralPath $final) - { - cd $downloaddir - if ($host.Version.Major -eq 3) - { - .\runtime.exe -y | Out-Null - .\setup.cmd - } - else - { - Start-Process -FilePath $final -ArgumentList -y -Wait - $cmd = $downloaddir + "\setup.cmd" - Start-Process -FilePath $cmd -Wait - } - } - else - { - throw "Unable to verify package" - } - cd $current - if (Test-Path -LiteralPath $downloaddir) - { - Remove-Item -LiteralPath $downloaddir -Force -Recurse - } -} diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/iisnode.yml b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/iisnode.yml deleted file mode 100644 index 85cc78139..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/iisnode.yml +++ /dev/null @@ -1,144 +0,0 @@ -# The optional iisnode.yml file provides overrides of the iisnode configuration settings specified in web.config. - -# node_env - determines the environment (production, development, staging, ...) in which -# child node processes run; if nonempty, is propagated to the child node processes as their NODE_ENV -# environment variable; the default is the value of the IIS worker process'es NODE_ENV -# environment variable - -node_env: - -# nodeProcessCommandLine - command line starting the node executable; in shared -# hosting environments this setting would typically be locked at the machine scope. - -# nodeProcessCommandLine: "C:\Program Files\nodejs\node.exe" - -# interceptor - fully qualified file name of a Node.js application that will run instead of an actual application -# the request targets; the fully qualified file name of the actual application file is provided as the first parameter -# to the interceptor application; default interceptor supports iisnode logging - -# interceptor: "c:\Program Files\iisnode\interceptor.js" - -# nodeProcessCountPerApplication - number of node.exe processes that IIS will start per application; -# setting this value to 0 results in creating one node.exe process per each processor on the machine - -nodeProcessCountPerApplication: 1 - -# maxConcurrentRequestsPerProcess - maximum number of reqeusts one node process can -# handle at a time - -maxConcurrentRequestsPerProcess: 1024 - -# maxNamedPipeConnectionRetry - number of times IIS will retry to establish a named pipe connection with a -# node process in order to send a new HTTP request - -maxNamedPipeConnectionRetry: 100 - -# namedPipeConnectionRetryDelay - delay in milliseconds between connection retries - -namedPipeConnectionRetryDelay: 250 - -# maxNamedPipeConnectionPoolSize - maximum number of named pipe connections that will be kept in a connection pool; -# connection pooling helps improve the performance of applications that process a large number of short lived HTTP requests - -maxNamedPipeConnectionPoolSize: 512 - -# maxNamedPipePooledConnectionAge - age of a pooled connection in milliseconds after which the connection is not reused for -# subsequent requests - -maxNamedPipePooledConnectionAge: 30000 - -# asyncCompletionThreadCount - size of the IO thread pool maintained by the IIS module to process asynchronous IO; setting it -# to 0 (default) results in creating one thread per each processor on the machine - -asyncCompletionThreadCount: 0 - -# initialRequestBufferSize - initial size in bytes of a memory buffer allocated for a new HTTP request - -initialRequestBufferSize: 4096 - -# maxRequestBufferSize - maximum size in bytes of a memory buffer allocated per request; this is a hard limit of -# the serialized form of HTTP request or response headers block - -maxRequestBufferSize: 65536 - -# watchedFiles - semi-colon separated list of files that will be watched for changes; a change to a file causes the application to recycle; -# each entry consists of an optional directory name plus required file name which are relative to the directory where the main application entry point -# is located; wild cards are allowed in the file name portion only; for example: "*.js;node_modules\foo\lib\options.json;app_data\*.config.json" - -watchedFiles: *.js;iisnode.yml - -# uncFileChangesPollingInterval - applications are recycled when the underlying *.js file is modified; if the file resides -# on a UNC share, the only reliable way to detect such modifications is to periodically poll for them; this setting -# controls the polling interval - -uncFileChangesPollingInterval: 5000 - -# gracefulShutdownTimeout - when a Node.js file is modified, all node processes handling running this application are recycled; -# this setting controls the time (in milliseconds) given for currently active requests to gracefully finish before the -# process is terminated; during this time, all new requests are already dispatched to a new node process based on the fresh version -# of the application - -gracefulShutdownTimeout: 60000 - -# loggingEnabled - controls whether stdout and stderr streams from node processes are captured and made available over HTTP - -loggingEnabled: true - -# logDirectory - directory name relative to the main application file that will store files with stdout and stderr captures; -# individual log file names have unique file names; log files are created lazily (i.e. when the process actually writes something -# to stdout or stderr); an HTML index of all log files is also maintained as index.html in that directory; -# by default, if your application is at http://foo.com/bar.js, logs will be accessible at http://foo.com/iisnode; -# SECURITY NOTE: if log files contain sensitive information, this setting should be modified to contain enough entropy to be considered -# cryptographically secure; in most situations, a GUID is sufficient - -logDirectory: iisnode - -# debuggingEnabled - controls whether the built-in debugger is available - -debuggingEnabled: true - -# debuggerPortRange - range of TCP ports that can be used for communication between the node-inspector debugger and the debugee; iisnode -# will round robin through this port range for subsequent debugging sessions and pick the next available (free) port to use from the range - -debuggerPortRange: 5058-6058 - -# debuggerPathSegment - URL path segment used to access the built-in node-inspector debugger; given a Node.js application at -http://foo.com/bar/baz.js, the debugger can be accessed at http://foo.com/bar/baz.js/{debuggerPathSegment}, by default -http://foo.com/bar/baz.js/debug - -debuggerPathSegment: debug - -# debugHeaderEnabled - boolean indicating whether iisnode should attach the iisnode-debug HTTP response header with -# diagnostics information to all responses - -debugHeaderEnabled: false - -# maxLogFileSizeInKB - maximum size of a single log file in KB; once a log file exceeds this limit a new log file is created - -maxLogFileSizeInKB: 128 - -# maxTotalLogFileSizeInKB - maximum total size of all log files in the logDirectory; once exceeded, old log files are removed - -maxTotalLogFileSizeInKB: 1024 - -# maxLogFiles - maximum number of log files in the logDirectory; once exceeded, old log files are removed - -maxLogFiles: 20 - -devErrorsEnabled: true - -# flushResponse - controls whether each HTTP response body chunk is immediately flushed by iisnode; flushing each body chunk incurs -# CPU cost but may improve latency in streaming scenarios - -flushResponse: false - -# enableXFF - controls whether iisnode adds or modifies the X-Forwarded-For request HTTP header with the IP address of the remote host - -enableXFF: false - -# promoteServerVars - comma delimited list of IIS server variables that will be propagated to the node.exe process in the form of -# x-iisnode- -# HTTP request headers; for a list of IIS server variables available see -# http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx; for example "AUTH_USER,AUTH_TYPE" - -promoteServerVars: diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/node.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/node.cmd deleted file mode 100644 index c69a72af9..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/node.cmd +++ /dev/null @@ -1 +0,0 @@ -node.exe %1 %2 %3 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/package.json b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/package.json index fb9c0fc43..09a03ac25 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/package.json +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "private": true, "scripts": { - "start": "node ./bin/www" + "start": "node app" }, "description": "$projectname$", "author": { @@ -17,5 +17,8 @@ "morgan": "^1.7.0", "pug": "^2.0.0-beta6", "serve-favicon": "^2.3.0" + }, + "engines": { + "node": "~6.10.x" } } diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/setup_web.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/setup_web.cmd deleted file mode 100644 index f02e6d5c4..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/setup_web.cmd +++ /dev/null @@ -1,57 +0,0 @@ -@echo on - -cd /d "%~dp0" - -if "%EMULATED%"=="true" if DEFINED APPCMD goto emulator_setup -if "%EMULATED%"== "true" exit /b 0 - -echo Granting permissions for Network Service to the web root directory... -icacls ..\ /grant "Network Service":(OI)(CI)W -if %ERRORLEVEL% neq 0 goto error -echo OK - -echo Configuring powershell permissions -powershell -c "set-executionpolicy unrestricted" - -echo Downloading and installing runtime components -powershell .\download.ps1 '%RUNTIMEURL%' '%RUNTIMEURLOVERRIDE%' -if %ERRORLEVEL% neq 0 goto error - -echo SUCCESS -exit /b 0 - -:error -echo FAILED -exit /b -1 - -:emulator_setup -echo Running in emulator adding iisnode to application host config -FOR /F "tokens=1,2 delims=/" %%a in ("%APPCMD%") DO set FN=%%a&set OPN=%%b -if "%OPN%"=="%OPN:apphostconfig:=%" ( - echo "Could not parse appcmd '%appcmd% for configuration file, exiting" - goto error -) - -set IISNODE_BINARY_DIRECTORY=%programfiles(x86)%\iisnode-dev\release\x64 -set IISNODE_SCHEMA=%programfiles(x86)%\iisnode-dev\release\x64\iisnode_schema.xml - -if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto start -set IISNODE_BINARY_DIRECTORY=%programfiles%\iisnode-dev\release\x86 -set IISNODE_SCHEMA=%programfiles%\iisnode-dev\release\x86\iisnode_schema_x86.xml - - -:start -set - -echo Using iisnode binaries location '%IISNODE_BINARY_DIRECTORY%' -echo installing iisnode module using AppCMD alias %appcmd% -%appcmd% install module /name:"iisnode" /image:"%IISNODE_BINARY_DIRECTORY%\iisnode.dll" - -set apphostconfigfile=%OPN:apphostconfig:=% -powershell -c "set-executionpolicy unrestricted" -powershell .\ChangeConfig.ps1 %apphostconfigfile% -if %ERRORLEVEL% neq 0 goto error - -copy /y "%IISNODE_SCHEMA%" "%programfiles%\IIS Express\config\schema\iisnode_schema.xml" -if %ERRORLEVEL% neq 0 goto error -exit /b 0 diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/www b/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/www deleted file mode 100644 index bb78b8403..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureExpress4App/www +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env node -var debug = require('debug')('$safeprojectname$'); -var app = require('../app'); - -app.set('port', process.env.PORT || 3000); - -var server = app.listen(app.get('port'), function() { - debug('Express server listening on port ' + server.address().port); -}); diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/AzureNodejsApp.njsproj b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/AzureNodejsApp.njsproj index 2021dee4a..af0ac60f8 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/AzureNodejsApp.njsproj +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/AzureNodejsApp.njsproj @@ -32,10 +32,6 @@ - - - - diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/AzureNodejsApp.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/AzureNodejsApp.vstemplate index ae59f60fd..fd22cf941 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/AzureNodejsApp.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/AzureNodejsApp.vstemplate @@ -20,12 +20,6 @@ README.md Web.config Web.Debug.config - - ChangeConfig.ps1 - download.ps1 - setup_web.cmd - node.cmd - diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/ChangeConfig.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/ChangeConfig.ps1 deleted file mode 100644 index 044634574..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/ChangeConfig.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -$configFile = $args[0] - -Write-Host "Adding iisnode section to config file '$configFile'" -$config = New-Object System.Xml.XmlDocument -$config.load($configFile) -$xpath = $config.CreateNavigator() -$parentElement = $xpath.SelectSingleNode("//configuration/configSections/sectionGroup[@name='system.webServer']") -$iisnodeElement = $parentElement.SelectSingleNode("//section[@name='iisnode']") -if ($iisnodeElement) { - Write-Host "Removing existing iisnode section from config file '$configFile'" - $iisnodeElement.DeleteSelf() -} - -$parentElement.AppendChild("
") -$config.Save($configFile) diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/Web.config b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/Web.config index 095b2ba60..def524481 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/Web.config +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/Web.config @@ -5,7 +5,7 @@ --> - + - - - + + + + + + @@ -56,10 +62,10 @@ - + - \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/download.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/download.ps1 deleted file mode 100644 index 9e46b09ad..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/download.ps1 +++ /dev/null @@ -1,87 +0,0 @@ -$runtimeUrl = $args[0] -$overrideUrl = $args[1] -$current = [string] (Get-Location -PSProvider FileSystem) -$client = New-Object System.Net.WebClient - -function downloadWithRetry { - param([string]$url, [string]$dest, [int]$retry) - Write-Host - Write-Host "Attempt: $retry" - Write-Host - trap { - Write-Host $_.Exception.ToString() - if ($retry -lt 5) { - $retry=$retry+1 - Write-Host - Write-Host "Waiting 5 seconds and retrying" - Write-Host - Start-Sleep -s 5 - downloadWithRetry $url $dest $retry $client - } - else { - Write-Host "Download failed" - throw "Max number of retries downloading [5] exceeded" - } - } - $client.downloadfile($url, $dest) -} - -function download($url, $dest) { - Write-Host "Downloading $url" - downloadWithRetry $url $dest 1 -} - -function copyOnVerify($file, $output) { - Write-Host "Verifying $file" - $verify = Get-AuthenticodeSignature $file - Out-Host -InputObject $verify - if ($verify.Status -ne "Valid") { - throw "Invalid signature for runtime package $file" - } - else { - mv $file $output - } -} - -if ($overrideUrl) { - Write-Host "Using override url: $overrideUrl" - $url = $overrideUrl -} -else { - $url = $runtimeUrl -} - -foreach($singleUrl in $url -split ";") -{ - $suffix = Get-Random - $downloaddir = $current + "\sandbox" + $suffix - mkdir $downloaddir - $dest = $downloaddir + "\sandbox.exe" - download $singleUrl $dest - $final = $downloaddir + "\runtime.exe" - copyOnVerify $dest $final - if (Test-Path -LiteralPath $final) - { - cd $downloaddir - if ($host.Version.Major -eq 3) - { - .\runtime.exe -y | Out-Null - .\setup.cmd - } - else - { - Start-Process -FilePath $final -ArgumentList -y -Wait - $cmd = $downloaddir + "\setup.cmd" - Start-Process -FilePath $cmd -Wait - } - } - else - { - throw "Unable to verify package" - } - cd $current - if (Test-Path -LiteralPath $downloaddir) - { - Remove-Item -LiteralPath $downloaddir -Force -Recurse - } -} diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/iisnode.yml b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/iisnode.yml deleted file mode 100644 index 85cc78139..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/iisnode.yml +++ /dev/null @@ -1,144 +0,0 @@ -# The optional iisnode.yml file provides overrides of the iisnode configuration settings specified in web.config. - -# node_env - determines the environment (production, development, staging, ...) in which -# child node processes run; if nonempty, is propagated to the child node processes as their NODE_ENV -# environment variable; the default is the value of the IIS worker process'es NODE_ENV -# environment variable - -node_env: - -# nodeProcessCommandLine - command line starting the node executable; in shared -# hosting environments this setting would typically be locked at the machine scope. - -# nodeProcessCommandLine: "C:\Program Files\nodejs\node.exe" - -# interceptor - fully qualified file name of a Node.js application that will run instead of an actual application -# the request targets; the fully qualified file name of the actual application file is provided as the first parameter -# to the interceptor application; default interceptor supports iisnode logging - -# interceptor: "c:\Program Files\iisnode\interceptor.js" - -# nodeProcessCountPerApplication - number of node.exe processes that IIS will start per application; -# setting this value to 0 results in creating one node.exe process per each processor on the machine - -nodeProcessCountPerApplication: 1 - -# maxConcurrentRequestsPerProcess - maximum number of reqeusts one node process can -# handle at a time - -maxConcurrentRequestsPerProcess: 1024 - -# maxNamedPipeConnectionRetry - number of times IIS will retry to establish a named pipe connection with a -# node process in order to send a new HTTP request - -maxNamedPipeConnectionRetry: 100 - -# namedPipeConnectionRetryDelay - delay in milliseconds between connection retries - -namedPipeConnectionRetryDelay: 250 - -# maxNamedPipeConnectionPoolSize - maximum number of named pipe connections that will be kept in a connection pool; -# connection pooling helps improve the performance of applications that process a large number of short lived HTTP requests - -maxNamedPipeConnectionPoolSize: 512 - -# maxNamedPipePooledConnectionAge - age of a pooled connection in milliseconds after which the connection is not reused for -# subsequent requests - -maxNamedPipePooledConnectionAge: 30000 - -# asyncCompletionThreadCount - size of the IO thread pool maintained by the IIS module to process asynchronous IO; setting it -# to 0 (default) results in creating one thread per each processor on the machine - -asyncCompletionThreadCount: 0 - -# initialRequestBufferSize - initial size in bytes of a memory buffer allocated for a new HTTP request - -initialRequestBufferSize: 4096 - -# maxRequestBufferSize - maximum size in bytes of a memory buffer allocated per request; this is a hard limit of -# the serialized form of HTTP request or response headers block - -maxRequestBufferSize: 65536 - -# watchedFiles - semi-colon separated list of files that will be watched for changes; a change to a file causes the application to recycle; -# each entry consists of an optional directory name plus required file name which are relative to the directory where the main application entry point -# is located; wild cards are allowed in the file name portion only; for example: "*.js;node_modules\foo\lib\options.json;app_data\*.config.json" - -watchedFiles: *.js;iisnode.yml - -# uncFileChangesPollingInterval - applications are recycled when the underlying *.js file is modified; if the file resides -# on a UNC share, the only reliable way to detect such modifications is to periodically poll for them; this setting -# controls the polling interval - -uncFileChangesPollingInterval: 5000 - -# gracefulShutdownTimeout - when a Node.js file is modified, all node processes handling running this application are recycled; -# this setting controls the time (in milliseconds) given for currently active requests to gracefully finish before the -# process is terminated; during this time, all new requests are already dispatched to a new node process based on the fresh version -# of the application - -gracefulShutdownTimeout: 60000 - -# loggingEnabled - controls whether stdout and stderr streams from node processes are captured and made available over HTTP - -loggingEnabled: true - -# logDirectory - directory name relative to the main application file that will store files with stdout and stderr captures; -# individual log file names have unique file names; log files are created lazily (i.e. when the process actually writes something -# to stdout or stderr); an HTML index of all log files is also maintained as index.html in that directory; -# by default, if your application is at http://foo.com/bar.js, logs will be accessible at http://foo.com/iisnode; -# SECURITY NOTE: if log files contain sensitive information, this setting should be modified to contain enough entropy to be considered -# cryptographically secure; in most situations, a GUID is sufficient - -logDirectory: iisnode - -# debuggingEnabled - controls whether the built-in debugger is available - -debuggingEnabled: true - -# debuggerPortRange - range of TCP ports that can be used for communication between the node-inspector debugger and the debugee; iisnode -# will round robin through this port range for subsequent debugging sessions and pick the next available (free) port to use from the range - -debuggerPortRange: 5058-6058 - -# debuggerPathSegment - URL path segment used to access the built-in node-inspector debugger; given a Node.js application at -http://foo.com/bar/baz.js, the debugger can be accessed at http://foo.com/bar/baz.js/{debuggerPathSegment}, by default -http://foo.com/bar/baz.js/debug - -debuggerPathSegment: debug - -# debugHeaderEnabled - boolean indicating whether iisnode should attach the iisnode-debug HTTP response header with -# diagnostics information to all responses - -debugHeaderEnabled: false - -# maxLogFileSizeInKB - maximum size of a single log file in KB; once a log file exceeds this limit a new log file is created - -maxLogFileSizeInKB: 128 - -# maxTotalLogFileSizeInKB - maximum total size of all log files in the logDirectory; once exceeded, old log files are removed - -maxTotalLogFileSizeInKB: 1024 - -# maxLogFiles - maximum number of log files in the logDirectory; once exceeded, old log files are removed - -maxLogFiles: 20 - -devErrorsEnabled: true - -# flushResponse - controls whether each HTTP response body chunk is immediately flushed by iisnode; flushing each body chunk incurs -# CPU cost but may improve latency in streaming scenarios - -flushResponse: false - -# enableXFF - controls whether iisnode adds or modifies the X-Forwarded-For request HTTP header with the IP address of the remote host - -enableXFF: false - -# promoteServerVars - comma delimited list of IIS server variables that will be propagated to the node.exe process in the form of -# x-iisnode- -# HTTP request headers; for a list of IIS server variables available see -# http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx; for example "AUTH_USER,AUTH_TYPE" - -promoteServerVars: diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/node.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/node.cmd deleted file mode 100644 index c69a72af9..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/node.cmd +++ /dev/null @@ -1 +0,0 @@ -node.exe %1 %2 %3 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/package.json b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/package.json index 09139b9b6..cee29666d 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/package.json +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/package.json @@ -2,7 +2,12 @@ "name": "$npmsafeprojectname$", "version": "0.0.0", "description": "$projectname$", - "main": "server.js", + "scripts": { + "start": "node server" + }, + "engines": { + "node": "~6.10.x" + }, "author": { "name": "$username$" } diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/setup_web.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/setup_web.cmd deleted file mode 100644 index f02e6d5c4..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsApp/setup_web.cmd +++ /dev/null @@ -1,57 +0,0 @@ -@echo on - -cd /d "%~dp0" - -if "%EMULATED%"=="true" if DEFINED APPCMD goto emulator_setup -if "%EMULATED%"== "true" exit /b 0 - -echo Granting permissions for Network Service to the web root directory... -icacls ..\ /grant "Network Service":(OI)(CI)W -if %ERRORLEVEL% neq 0 goto error -echo OK - -echo Configuring powershell permissions -powershell -c "set-executionpolicy unrestricted" - -echo Downloading and installing runtime components -powershell .\download.ps1 '%RUNTIMEURL%' '%RUNTIMEURLOVERRIDE%' -if %ERRORLEVEL% neq 0 goto error - -echo SUCCESS -exit /b 0 - -:error -echo FAILED -exit /b -1 - -:emulator_setup -echo Running in emulator adding iisnode to application host config -FOR /F "tokens=1,2 delims=/" %%a in ("%APPCMD%") DO set FN=%%a&set OPN=%%b -if "%OPN%"=="%OPN:apphostconfig:=%" ( - echo "Could not parse appcmd '%appcmd% for configuration file, exiting" - goto error -) - -set IISNODE_BINARY_DIRECTORY=%programfiles(x86)%\iisnode-dev\release\x64 -set IISNODE_SCHEMA=%programfiles(x86)%\iisnode-dev\release\x64\iisnode_schema.xml - -if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto start -set IISNODE_BINARY_DIRECTORY=%programfiles%\iisnode-dev\release\x86 -set IISNODE_SCHEMA=%programfiles%\iisnode-dev\release\x86\iisnode_schema_x86.xml - - -:start -set - -echo Using iisnode binaries location '%IISNODE_BINARY_DIRECTORY%' -echo installing iisnode module using AppCMD alias %appcmd% -%appcmd% install module /name:"iisnode" /image:"%IISNODE_BINARY_DIRECTORY%\iisnode.dll" - -set apphostconfigfile=%OPN:apphostconfig:=% -powershell -c "set-executionpolicy unrestricted" -powershell .\ChangeConfig.ps1 %apphostconfigfile% -if %ERRORLEVEL% neq 0 goto error - -copy /y "%IISNODE_SCHEMA%" "%programfiles%\IIS Express\config\schema\iisnode_schema.xml" -if %ERRORLEVEL% neq 0 goto error -exit /b 0 diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/Worker.njsproj b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/Worker.njsproj index 037429b00..a30c4e7d3 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/Worker.njsproj +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/Worker.njsproj @@ -32,9 +32,6 @@ - - - diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/Worker.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/Worker.vstemplate index 2b5dcf4dd..74e0acbc0 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/Worker.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/Worker.vstemplate @@ -18,11 +18,8 @@ startup.js worker.js - download.ps1 - setup_worker.cmd package.json README.md - node.cmd diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/download.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/download.ps1 deleted file mode 100644 index 65a63c61d..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/download.ps1 +++ /dev/null @@ -1,87 +0,0 @@ -$runtimeUrl = $args[0] -$overrideUrl = $args[1] -$current = [string] (Get-Location -PSProvider FileSystem) -$client = New-Object System.Net.WebClient - -function downloadWithRetry { - param([string]$url, [string]$dest, [int]$retry) - Write-Host - Write-Host "Attempt: $retry" - Write-Host - trap { - Write-Host $_.Exception.ToString() - if ($retry -lt 5) { - $retry=$retry+1 - Write-Host - Write-Host "Waiting 5 seconds and retrying" - Write-Host - Start-Sleep -s 5 - downloadWithRetry $url $dest $retry $client - } - else { - Write-Host "Download failed" - throw "Max number of retries downloading [5] exceeded" - } - } - $client.downloadfile($url, $dest) -} - -function download($url, $dest) { - Write-Host "Downloading $url" - downloadWithRetry $url $dest 1 -} - -function copyOnVerify($file, $output) { - Write-Host "Verifying $file" - $verify = Get-AuthenticodeSignature $file - Out-Host -InputObject $verify - if ($verify.Status -ne "Valid") { - throw "Invalid signature for runtime package $file" - } - else { - mv $file $output - } -} - -if ($overrideUrl) { - Write-Host "Using override url: $overrideUrl" - $url = $overrideUrl -} -else { - $url = $runtimeUrl -} - -foreach($singleUrl in $url -split ";") -{ - $suffix = Get-Random - $downloaddir = $current + "\sandbox" + $suffix - mkdir $downloaddir - $dest = $downloaddir + "\sandbox.exe" - download $singleUrl $dest - $final = $downloaddir + "\runtime.exe" - copyOnVerify $dest $final - if (Test-Path -LiteralPath $final) - { - cd $downloaddir - if ($host.Version.Major -eq 3) - { - .\runtime.exe -y | Out-Null - .\setup.cmd - } - else - { - Start-Process -FilePath $final -ArgumentList -y -Wait - $cmd = $downloaddir + "\setup.cmd" - Start-Process -FilePath $cmd -Wait - } - } - else - { - throw "Unable to verify package" - } - cd $current - if (Test-Path -LiteralPath $downloaddir) - { - Remove-Item -LiteralPath $downloaddir -Force -Recurse - } -} diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/node.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/node.cmd deleted file mode 100644 index c69a72af9..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/node.cmd +++ /dev/null @@ -1 +0,0 @@ -node.exe %1 %2 %3 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/package.json b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/package.json index 3e6fffe1f..619b85393 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/package.json +++ b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/package.json @@ -2,8 +2,13 @@ "name": "$npmsafeprojectname$", "version": "0.0.0", "description": "$projectname$", - "main": "worker.js", + "scripts": { + "start": "node worker" + }, "author": { "name": "$username$" + }, + "engines": { + "node": "~6.10.2" } } diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/setup_worker.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/setup_worker.cmd deleted file mode 100644 index 46cdeef9c..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/AzureNodejsWorker/setup_worker.cmd +++ /dev/null @@ -1,23 +0,0 @@ -@echo off - -echo Granting permissions for Network Service to the deployment directory... -icacls . /grant "Users":(OI)(CI)F -if %ERRORLEVEL% neq 0 goto error -echo OK - -if "%EMULATED%"=="true" exit /b 0 - -echo Configuring powershell permissions -powershell -c "set-executionpolicy unrestricted" - -echo Downloading runtime components -powershell .\download.ps1 '%RUNTIMEURL%' '%RUNTIMEURLOVERRIDE%' -if %ERRORLEVEL% neq 0 goto error - -echo SUCCESS -exit /b 0 - -:error - -echo FAILED -exit /b -1 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/CloudService/CloudService.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/CloudService/CloudService.vstemplate index 0810218a6..dbdb06d75 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/CloudService/CloudService.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/CloudService/CloudService.vstemplate @@ -1 +1,30 @@ - JavaScript CloudServiceProject Microsoft.CloudServiceProject.CloudService_js 3.5 30 1 true AzureCloudService true cloudservice.ico true Enabled true ServiceDefinition.csdef ServiceConfiguration.Local.cscfg ServiceConfiguration.Cloud.cscfg Microsoft.NodejsTools.ProjectWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Microsoft.NodejsTools.ProjectWizard.CloudServiceWizard \ No newline at end of file + + + + + JavaScript + CloudServiceProject + Microsoft.CloudServiceProject.CloudService_js + 3.5 + 30 + 1 + true + AzureCloudService + true + cloudservice.ico + true + Enabled + true + + + + ServiceDefinition.csdef + ServiceConfiguration.Local.cscfg + ServiceConfiguration.Cloud.cscfg + + + + Microsoft.NodejsTools.ProjectWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + Microsoft.NodejsTools.ProjectWizard.CloudServiceWizard + + \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/ExpressApp.njsproj b/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/ExpressApp.njsproj index 605979a67..4ed8cb05a 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/ExpressApp.njsproj +++ b/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/ExpressApp.njsproj @@ -10,7 +10,7 @@ 2.0 $guid1$ . - bin\www + app.js . @@ -30,7 +30,6 @@ - diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/ExpressApp.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/ExpressApp.vstemplate index 62ce08210..c9bad1656 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/ExpressApp.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/ExpressApp.vstemplate @@ -1,6 +1,6 @@ - + JavaScript @@ -31,9 +31,6 @@ layout.pug error.pug - - www - app.js package.json README.md diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/app.js b/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/app.js index 06c4e6382..ba91434fe 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/app.js +++ b/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/app.js @@ -1,4 +1,5 @@ 'use strict'; +var debug = require('debug'); var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); @@ -57,5 +58,8 @@ app.use(function (err, req, res, next) { }); }); +app.set('port', process.env.PORT || 3000); -module.exports = app; +var server = app.listen(app.get('port'), function () { + debug('Express server listening on port ' + server.address().port); +}); diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/package.json b/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/package.json index fb9c0fc43..6aecd5f45 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/package.json +++ b/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "private": true, "scripts": { - "start": "node ./bin/www" + "start": "node app" }, "description": "$projectname$", "author": { diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/www b/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/www deleted file mode 100644 index bb78b8403..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/Express4App/www +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env node -var debug = require('debug')('$safeprojectname$'); -var app = require('../app'); - -app.set('port', process.env.PORT || 3000); - -var server = app.listen(app.get('port'), function() { - debug('Express server listening on port ' + server.address().port); -}); diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/ChangeConfig.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/ChangeConfig.ps1 deleted file mode 100644 index 044634574..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/ChangeConfig.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -$configFile = $args[0] - -Write-Host "Adding iisnode section to config file '$configFile'" -$config = New-Object System.Xml.XmlDocument -$config.load($configFile) -$xpath = $config.CreateNavigator() -$parentElement = $xpath.SelectSingleNode("//configuration/configSections/sectionGroup[@name='system.webServer']") -$iisnodeElement = $parentElement.SelectSingleNode("//section[@name='iisnode']") -if ($iisnodeElement) { - Write-Host "Removing existing iisnode section from config file '$configFile'" - $iisnodeElement.DeleteSelf() -} - -$parentElement.AppendChild("
") -$config.Save($configFile) diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/TypeScriptExpressApp.njsproj b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/TypeScriptExpressApp.njsproj index af008873d..7e634a79b 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/TypeScriptExpressApp.njsproj +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/TypeScriptExpressApp.njsproj @@ -10,7 +10,7 @@ 2.0 $guid1$ . - bin\www + app.js . @@ -45,13 +45,9 @@ $if$ ($dev14$ == true) $endif$ + - - - - - diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/TypeScriptExpressApp.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/TypeScriptExpressApp.vstemplate index df2ff9eec..5f97317d0 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/TypeScriptExpressApp.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/TypeScriptExpressApp.vstemplate @@ -29,6 +29,7 @@ index.pug layout.pug + error.pug @@ -55,11 +56,6 @@ README.md Web.config Web.Debug.config - ChangeConfig.ps1 - download.ps1 - setup_web.cmd - node.cmd - www typings.json diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/app.ts b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/app.ts index 57b684216..3eb0cf893 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/app.ts +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/app.ts @@ -1,4 +1,5 @@ -import express = require('express'); +import debug = require('debug'); +import express = require('express'); import path = require('path'); import routes from './routes/index'; @@ -46,5 +47,8 @@ app.use((err: any, req, res, next) => { }); }); +app.set('port', process.env.PORT || 3000); -module.exports = app; +var server = app.listen(app.get('port'), function () { + debug('Express server listening on port ' + server.address().port); +}); diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/download.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/download.ps1 deleted file mode 100644 index 9e46b09ad..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/download.ps1 +++ /dev/null @@ -1,87 +0,0 @@ -$runtimeUrl = $args[0] -$overrideUrl = $args[1] -$current = [string] (Get-Location -PSProvider FileSystem) -$client = New-Object System.Net.WebClient - -function downloadWithRetry { - param([string]$url, [string]$dest, [int]$retry) - Write-Host - Write-Host "Attempt: $retry" - Write-Host - trap { - Write-Host $_.Exception.ToString() - if ($retry -lt 5) { - $retry=$retry+1 - Write-Host - Write-Host "Waiting 5 seconds and retrying" - Write-Host - Start-Sleep -s 5 - downloadWithRetry $url $dest $retry $client - } - else { - Write-Host "Download failed" - throw "Max number of retries downloading [5] exceeded" - } - } - $client.downloadfile($url, $dest) -} - -function download($url, $dest) { - Write-Host "Downloading $url" - downloadWithRetry $url $dest 1 -} - -function copyOnVerify($file, $output) { - Write-Host "Verifying $file" - $verify = Get-AuthenticodeSignature $file - Out-Host -InputObject $verify - if ($verify.Status -ne "Valid") { - throw "Invalid signature for runtime package $file" - } - else { - mv $file $output - } -} - -if ($overrideUrl) { - Write-Host "Using override url: $overrideUrl" - $url = $overrideUrl -} -else { - $url = $runtimeUrl -} - -foreach($singleUrl in $url -split ";") -{ - $suffix = Get-Random - $downloaddir = $current + "\sandbox" + $suffix - mkdir $downloaddir - $dest = $downloaddir + "\sandbox.exe" - download $singleUrl $dest - $final = $downloaddir + "\runtime.exe" - copyOnVerify $dest $final - if (Test-Path -LiteralPath $final) - { - cd $downloaddir - if ($host.Version.Major -eq 3) - { - .\runtime.exe -y | Out-Null - .\setup.cmd - } - else - { - Start-Process -FilePath $final -ArgumentList -y -Wait - $cmd = $downloaddir + "\setup.cmd" - Start-Process -FilePath $cmd -Wait - } - } - else - { - throw "Unable to verify package" - } - cd $current - if (Test-Path -LiteralPath $downloaddir) - { - Remove-Item -LiteralPath $downloaddir -Force -Recurse - } -} diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/error.pug b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/error.pug new file mode 100644 index 000000000..fbe842c7e --- /dev/null +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/error.pug @@ -0,0 +1,6 @@ +extends layout + +block content + h1= message + h2= error.status + pre #{error.stack} \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/iisnode.yml b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/iisnode.yml deleted file mode 100644 index 85cc78139..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/iisnode.yml +++ /dev/null @@ -1,144 +0,0 @@ -# The optional iisnode.yml file provides overrides of the iisnode configuration settings specified in web.config. - -# node_env - determines the environment (production, development, staging, ...) in which -# child node processes run; if nonempty, is propagated to the child node processes as their NODE_ENV -# environment variable; the default is the value of the IIS worker process'es NODE_ENV -# environment variable - -node_env: - -# nodeProcessCommandLine - command line starting the node executable; in shared -# hosting environments this setting would typically be locked at the machine scope. - -# nodeProcessCommandLine: "C:\Program Files\nodejs\node.exe" - -# interceptor - fully qualified file name of a Node.js application that will run instead of an actual application -# the request targets; the fully qualified file name of the actual application file is provided as the first parameter -# to the interceptor application; default interceptor supports iisnode logging - -# interceptor: "c:\Program Files\iisnode\interceptor.js" - -# nodeProcessCountPerApplication - number of node.exe processes that IIS will start per application; -# setting this value to 0 results in creating one node.exe process per each processor on the machine - -nodeProcessCountPerApplication: 1 - -# maxConcurrentRequestsPerProcess - maximum number of reqeusts one node process can -# handle at a time - -maxConcurrentRequestsPerProcess: 1024 - -# maxNamedPipeConnectionRetry - number of times IIS will retry to establish a named pipe connection with a -# node process in order to send a new HTTP request - -maxNamedPipeConnectionRetry: 100 - -# namedPipeConnectionRetryDelay - delay in milliseconds between connection retries - -namedPipeConnectionRetryDelay: 250 - -# maxNamedPipeConnectionPoolSize - maximum number of named pipe connections that will be kept in a connection pool; -# connection pooling helps improve the performance of applications that process a large number of short lived HTTP requests - -maxNamedPipeConnectionPoolSize: 512 - -# maxNamedPipePooledConnectionAge - age of a pooled connection in milliseconds after which the connection is not reused for -# subsequent requests - -maxNamedPipePooledConnectionAge: 30000 - -# asyncCompletionThreadCount - size of the IO thread pool maintained by the IIS module to process asynchronous IO; setting it -# to 0 (default) results in creating one thread per each processor on the machine - -asyncCompletionThreadCount: 0 - -# initialRequestBufferSize - initial size in bytes of a memory buffer allocated for a new HTTP request - -initialRequestBufferSize: 4096 - -# maxRequestBufferSize - maximum size in bytes of a memory buffer allocated per request; this is a hard limit of -# the serialized form of HTTP request or response headers block - -maxRequestBufferSize: 65536 - -# watchedFiles - semi-colon separated list of files that will be watched for changes; a change to a file causes the application to recycle; -# each entry consists of an optional directory name plus required file name which are relative to the directory where the main application entry point -# is located; wild cards are allowed in the file name portion only; for example: "*.js;node_modules\foo\lib\options.json;app_data\*.config.json" - -watchedFiles: *.js;iisnode.yml - -# uncFileChangesPollingInterval - applications are recycled when the underlying *.js file is modified; if the file resides -# on a UNC share, the only reliable way to detect such modifications is to periodically poll for them; this setting -# controls the polling interval - -uncFileChangesPollingInterval: 5000 - -# gracefulShutdownTimeout - when a Node.js file is modified, all node processes handling running this application are recycled; -# this setting controls the time (in milliseconds) given for currently active requests to gracefully finish before the -# process is terminated; during this time, all new requests are already dispatched to a new node process based on the fresh version -# of the application - -gracefulShutdownTimeout: 60000 - -# loggingEnabled - controls whether stdout and stderr streams from node processes are captured and made available over HTTP - -loggingEnabled: true - -# logDirectory - directory name relative to the main application file that will store files with stdout and stderr captures; -# individual log file names have unique file names; log files are created lazily (i.e. when the process actually writes something -# to stdout or stderr); an HTML index of all log files is also maintained as index.html in that directory; -# by default, if your application is at http://foo.com/bar.js, logs will be accessible at http://foo.com/iisnode; -# SECURITY NOTE: if log files contain sensitive information, this setting should be modified to contain enough entropy to be considered -# cryptographically secure; in most situations, a GUID is sufficient - -logDirectory: iisnode - -# debuggingEnabled - controls whether the built-in debugger is available - -debuggingEnabled: true - -# debuggerPortRange - range of TCP ports that can be used for communication between the node-inspector debugger and the debugee; iisnode -# will round robin through this port range for subsequent debugging sessions and pick the next available (free) port to use from the range - -debuggerPortRange: 5058-6058 - -# debuggerPathSegment - URL path segment used to access the built-in node-inspector debugger; given a Node.js application at -http://foo.com/bar/baz.js, the debugger can be accessed at http://foo.com/bar/baz.js/{debuggerPathSegment}, by default -http://foo.com/bar/baz.js/debug - -debuggerPathSegment: debug - -# debugHeaderEnabled - boolean indicating whether iisnode should attach the iisnode-debug HTTP response header with -# diagnostics information to all responses - -debugHeaderEnabled: false - -# maxLogFileSizeInKB - maximum size of a single log file in KB; once a log file exceeds this limit a new log file is created - -maxLogFileSizeInKB: 128 - -# maxTotalLogFileSizeInKB - maximum total size of all log files in the logDirectory; once exceeded, old log files are removed - -maxTotalLogFileSizeInKB: 1024 - -# maxLogFiles - maximum number of log files in the logDirectory; once exceeded, old log files are removed - -maxLogFiles: 20 - -devErrorsEnabled: true - -# flushResponse - controls whether each HTTP response body chunk is immediately flushed by iisnode; flushing each body chunk incurs -# CPU cost but may improve latency in streaming scenarios - -flushResponse: false - -# enableXFF - controls whether iisnode adds or modifies the X-Forwarded-For request HTTP header with the IP address of the remote host - -enableXFF: false - -# promoteServerVars - comma delimited list of IIS server variables that will be propagated to the node.exe process in the form of -# x-iisnode- -# HTTP request headers; for a list of IIS server variables available see -# http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx; for example "AUTH_USER,AUTH_TYPE" - -promoteServerVars: diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/node.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/node.cmd deleted file mode 100644 index c69a72af9..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/node.cmd +++ /dev/null @@ -1 +0,0 @@ -node.exe %1 %2 %3 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/package.json b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/package.json index dbb3d4e38..32d0467d2 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/package.json +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/package.json @@ -3,16 +3,18 @@ "version": "0.0.0", "private": true, "scripts": { - "start": "node ./bin/www" + "start": "node app" }, "description": "$projectname$", "author": { "name": "$username$" }, - "main": "app.js", "dependencies": { "debug": "^2.2.0", "express": "^4.14.0", "pug": "^2.0.0-beta6" + }, + "engines": { + "node": "~6.10.x" } } diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/setup_web.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/setup_web.cmd deleted file mode 100644 index f02e6d5c4..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/setup_web.cmd +++ /dev/null @@ -1,57 +0,0 @@ -@echo on - -cd /d "%~dp0" - -if "%EMULATED%"=="true" if DEFINED APPCMD goto emulator_setup -if "%EMULATED%"== "true" exit /b 0 - -echo Granting permissions for Network Service to the web root directory... -icacls ..\ /grant "Network Service":(OI)(CI)W -if %ERRORLEVEL% neq 0 goto error -echo OK - -echo Configuring powershell permissions -powershell -c "set-executionpolicy unrestricted" - -echo Downloading and installing runtime components -powershell .\download.ps1 '%RUNTIMEURL%' '%RUNTIMEURLOVERRIDE%' -if %ERRORLEVEL% neq 0 goto error - -echo SUCCESS -exit /b 0 - -:error -echo FAILED -exit /b -1 - -:emulator_setup -echo Running in emulator adding iisnode to application host config -FOR /F "tokens=1,2 delims=/" %%a in ("%APPCMD%") DO set FN=%%a&set OPN=%%b -if "%OPN%"=="%OPN:apphostconfig:=%" ( - echo "Could not parse appcmd '%appcmd% for configuration file, exiting" - goto error -) - -set IISNODE_BINARY_DIRECTORY=%programfiles(x86)%\iisnode-dev\release\x64 -set IISNODE_SCHEMA=%programfiles(x86)%\iisnode-dev\release\x64\iisnode_schema.xml - -if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto start -set IISNODE_BINARY_DIRECTORY=%programfiles%\iisnode-dev\release\x86 -set IISNODE_SCHEMA=%programfiles%\iisnode-dev\release\x86\iisnode_schema_x86.xml - - -:start -set - -echo Using iisnode binaries location '%IISNODE_BINARY_DIRECTORY%' -echo installing iisnode module using AppCMD alias %appcmd% -%appcmd% install module /name:"iisnode" /image:"%IISNODE_BINARY_DIRECTORY%\iisnode.dll" - -set apphostconfigfile=%OPN:apphostconfig:=% -powershell -c "set-executionpolicy unrestricted" -powershell .\ChangeConfig.ps1 %apphostconfigfile% -if %ERRORLEVEL% neq 0 goto error - -copy /y "%IISNODE_SCHEMA%" "%programfiles%\IIS Express\config\schema\iisnode_schema.xml" -if %ERRORLEVEL% neq 0 goto error -exit /b 0 diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/www b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/www deleted file mode 100644 index bb78b8403..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureExpressApp/www +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env node -var debug = require('debug')('$safeprojectname$'); -var app = require('../app'); - -app.set('port', process.env.PORT || 3000); - -var server = app.listen(app.get('port'), function() { - debug('Express server listening on port ' + server.address().port); -}); diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/Worker.njsproj b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/Worker.njsproj index c7ae817fe..c869d4f43 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/Worker.njsproj +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/Worker.njsproj @@ -35,9 +35,6 @@ - - - diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/Worker.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/Worker.vstemplate index fac27eb69..c449e89e4 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/Worker.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/Worker.vstemplate @@ -18,11 +18,8 @@ server.ts startup.ts - download.ps1 - setup_worker.cmd package.json README.md - node.cmd diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/download.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/download.ps1 deleted file mode 100644 index 65a63c61d..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/download.ps1 +++ /dev/null @@ -1,87 +0,0 @@ -$runtimeUrl = $args[0] -$overrideUrl = $args[1] -$current = [string] (Get-Location -PSProvider FileSystem) -$client = New-Object System.Net.WebClient - -function downloadWithRetry { - param([string]$url, [string]$dest, [int]$retry) - Write-Host - Write-Host "Attempt: $retry" - Write-Host - trap { - Write-Host $_.Exception.ToString() - if ($retry -lt 5) { - $retry=$retry+1 - Write-Host - Write-Host "Waiting 5 seconds and retrying" - Write-Host - Start-Sleep -s 5 - downloadWithRetry $url $dest $retry $client - } - else { - Write-Host "Download failed" - throw "Max number of retries downloading [5] exceeded" - } - } - $client.downloadfile($url, $dest) -} - -function download($url, $dest) { - Write-Host "Downloading $url" - downloadWithRetry $url $dest 1 -} - -function copyOnVerify($file, $output) { - Write-Host "Verifying $file" - $verify = Get-AuthenticodeSignature $file - Out-Host -InputObject $verify - if ($verify.Status -ne "Valid") { - throw "Invalid signature for runtime package $file" - } - else { - mv $file $output - } -} - -if ($overrideUrl) { - Write-Host "Using override url: $overrideUrl" - $url = $overrideUrl -} -else { - $url = $runtimeUrl -} - -foreach($singleUrl in $url -split ";") -{ - $suffix = Get-Random - $downloaddir = $current + "\sandbox" + $suffix - mkdir $downloaddir - $dest = $downloaddir + "\sandbox.exe" - download $singleUrl $dest - $final = $downloaddir + "\runtime.exe" - copyOnVerify $dest $final - if (Test-Path -LiteralPath $final) - { - cd $downloaddir - if ($host.Version.Major -eq 3) - { - .\runtime.exe -y | Out-Null - .\setup.cmd - } - else - { - Start-Process -FilePath $final -ArgumentList -y -Wait - $cmd = $downloaddir + "\setup.cmd" - Start-Process -FilePath $cmd -Wait - } - } - else - { - throw "Unable to verify package" - } - cd $current - if (Test-Path -LiteralPath $downloaddir) - { - Remove-Item -LiteralPath $downloaddir -Force -Recurse - } -} diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/node.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/node.cmd deleted file mode 100644 index c69a72af9..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/node.cmd +++ /dev/null @@ -1 +0,0 @@ -node.exe %1 %2 %3 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/package.json b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/package.json index 09139b9b6..d3a341847 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/package.json +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/package.json @@ -2,8 +2,13 @@ "name": "$npmsafeprojectname$", "version": "0.0.0", "description": "$projectname$", - "main": "server.js", + "scripts": { + "start": "node server" + }, "author": { "name": "$username$" + }, + "engines": { + "node": "~6.10.x" } } diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/setup_worker.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/setup_worker.cmd deleted file mode 100644 index 46cdeef9c..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorker/setup_worker.cmd +++ /dev/null @@ -1,23 +0,0 @@ -@echo off - -echo Granting permissions for Network Service to the deployment directory... -icacls . /grant "Users":(OI)(CI)F -if %ERRORLEVEL% neq 0 goto error -echo OK - -if "%EMULATED%"=="true" exit /b 0 - -echo Configuring powershell permissions -powershell -c "set-executionpolicy unrestricted" - -echo Downloading runtime components -powershell .\download.ps1 '%RUNTIMEURL%' '%RUNTIMEURLOVERRIDE%' -if %ERRORLEVEL% neq 0 goto error - -echo SUCCESS -exit /b 0 - -:error - -echo FAILED -exit /b -1 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/Worker.njsproj b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/Worker.njsproj index d49a9d9e7..d8e2b2f48 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/Worker.njsproj +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/Worker.njsproj @@ -35,9 +35,6 @@ - - - diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/Worker.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/Worker.vstemplate index 20374474a..e4cd9edf8 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/Worker.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/Worker.vstemplate @@ -18,11 +18,8 @@ server.ts startup.ts - download.ps1 - setup_worker.cmd package.json README.md - node.cmd diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/download.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/download.ps1 deleted file mode 100644 index 65a63c61d..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/download.ps1 +++ /dev/null @@ -1,87 +0,0 @@ -$runtimeUrl = $args[0] -$overrideUrl = $args[1] -$current = [string] (Get-Location -PSProvider FileSystem) -$client = New-Object System.Net.WebClient - -function downloadWithRetry { - param([string]$url, [string]$dest, [int]$retry) - Write-Host - Write-Host "Attempt: $retry" - Write-Host - trap { - Write-Host $_.Exception.ToString() - if ($retry -lt 5) { - $retry=$retry+1 - Write-Host - Write-Host "Waiting 5 seconds and retrying" - Write-Host - Start-Sleep -s 5 - downloadWithRetry $url $dest $retry $client - } - else { - Write-Host "Download failed" - throw "Max number of retries downloading [5] exceeded" - } - } - $client.downloadfile($url, $dest) -} - -function download($url, $dest) { - Write-Host "Downloading $url" - downloadWithRetry $url $dest 1 -} - -function copyOnVerify($file, $output) { - Write-Host "Verifying $file" - $verify = Get-AuthenticodeSignature $file - Out-Host -InputObject $verify - if ($verify.Status -ne "Valid") { - throw "Invalid signature for runtime package $file" - } - else { - mv $file $output - } -} - -if ($overrideUrl) { - Write-Host "Using override url: $overrideUrl" - $url = $overrideUrl -} -else { - $url = $runtimeUrl -} - -foreach($singleUrl in $url -split ";") -{ - $suffix = Get-Random - $downloaddir = $current + "\sandbox" + $suffix - mkdir $downloaddir - $dest = $downloaddir + "\sandbox.exe" - download $singleUrl $dest - $final = $downloaddir + "\runtime.exe" - copyOnVerify $dest $final - if (Test-Path -LiteralPath $final) - { - cd $downloaddir - if ($host.Version.Major -eq 3) - { - .\runtime.exe -y | Out-Null - .\setup.cmd - } - else - { - Start-Process -FilePath $final -ArgumentList -y -Wait - $cmd = $downloaddir + "\setup.cmd" - Start-Process -FilePath $cmd -Wait - } - } - else - { - throw "Unable to verify package" - } - cd $current - if (Test-Path -LiteralPath $downloaddir) - { - Remove-Item -LiteralPath $downloaddir -Force -Recurse - } -} diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/node.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/node.cmd deleted file mode 100644 index c69a72af9..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/node.cmd +++ /dev/null @@ -1 +0,0 @@ -node.exe %1 %2 %3 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/package.json b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/package.json index 09139b9b6..d3a341847 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/package.json +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/package.json @@ -2,8 +2,13 @@ "name": "$npmsafeprojectname$", "version": "0.0.0", "description": "$projectname$", - "main": "server.js", + "scripts": { + "start": "node server" + }, "author": { "name": "$username$" + }, + "engines": { + "node": "~6.10.x" } } diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/setup_worker.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/setup_worker.cmd deleted file mode 100644 index 46cdeef9c..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureNodejsWorkerRole/setup_worker.cmd +++ /dev/null @@ -1,23 +0,0 @@ -@echo off - -echo Granting permissions for Network Service to the deployment directory... -icacls . /grant "Users":(OI)(CI)F -if %ERRORLEVEL% neq 0 goto error -echo OK - -if "%EMULATED%"=="true" exit /b 0 - -echo Configuring powershell permissions -powershell -c "set-executionpolicy unrestricted" - -echo Downloading runtime components -powershell .\download.ps1 '%RUNTIMEURL%' '%RUNTIMEURLOVERRIDE%' -if %ERRORLEVEL% neq 0 goto error - -echo SUCCESS -exit /b 0 - -:error - -echo FAILED -exit /b -1 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/ChangeConfig.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/ChangeConfig.ps1 deleted file mode 100644 index 044634574..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/ChangeConfig.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -$configFile = $args[0] - -Write-Host "Adding iisnode section to config file '$configFile'" -$config = New-Object System.Xml.XmlDocument -$config.load($configFile) -$xpath = $config.CreateNavigator() -$parentElement = $xpath.SelectSingleNode("//configuration/configSections/sectionGroup[@name='system.webServer']") -$iisnodeElement = $parentElement.SelectSingleNode("//section[@name='iisnode']") -if ($iisnodeElement) { - Write-Host "Removing existing iisnode section from config file '$configFile'" - $iisnodeElement.DeleteSelf() -} - -$parentElement.AppendChild("
") -$config.Save($configFile) diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/TypeScriptWebApp.njsproj b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/TypeScriptWebApp.njsproj index 3c36f584a..0bd2a98b4 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/TypeScriptWebApp.njsproj +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/TypeScriptWebApp.njsproj @@ -38,10 +38,6 @@ - - - - diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/TypeScriptWebApp.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/TypeScriptWebApp.vstemplate index d059dfbae..d1fbe6590 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/TypeScriptWebApp.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/TypeScriptWebApp.vstemplate @@ -21,10 +21,6 @@ README.md Web.config Web.Debug.config - ChangeConfig.ps1 - download.ps1 - setup_web.cmd - node.cmd diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/download.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/download.ps1 deleted file mode 100644 index 9e46b09ad..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/download.ps1 +++ /dev/null @@ -1,87 +0,0 @@ -$runtimeUrl = $args[0] -$overrideUrl = $args[1] -$current = [string] (Get-Location -PSProvider FileSystem) -$client = New-Object System.Net.WebClient - -function downloadWithRetry { - param([string]$url, [string]$dest, [int]$retry) - Write-Host - Write-Host "Attempt: $retry" - Write-Host - trap { - Write-Host $_.Exception.ToString() - if ($retry -lt 5) { - $retry=$retry+1 - Write-Host - Write-Host "Waiting 5 seconds and retrying" - Write-Host - Start-Sleep -s 5 - downloadWithRetry $url $dest $retry $client - } - else { - Write-Host "Download failed" - throw "Max number of retries downloading [5] exceeded" - } - } - $client.downloadfile($url, $dest) -} - -function download($url, $dest) { - Write-Host "Downloading $url" - downloadWithRetry $url $dest 1 -} - -function copyOnVerify($file, $output) { - Write-Host "Verifying $file" - $verify = Get-AuthenticodeSignature $file - Out-Host -InputObject $verify - if ($verify.Status -ne "Valid") { - throw "Invalid signature for runtime package $file" - } - else { - mv $file $output - } -} - -if ($overrideUrl) { - Write-Host "Using override url: $overrideUrl" - $url = $overrideUrl -} -else { - $url = $runtimeUrl -} - -foreach($singleUrl in $url -split ";") -{ - $suffix = Get-Random - $downloaddir = $current + "\sandbox" + $suffix - mkdir $downloaddir - $dest = $downloaddir + "\sandbox.exe" - download $singleUrl $dest - $final = $downloaddir + "\runtime.exe" - copyOnVerify $dest $final - if (Test-Path -LiteralPath $final) - { - cd $downloaddir - if ($host.Version.Major -eq 3) - { - .\runtime.exe -y | Out-Null - .\setup.cmd - } - else - { - Start-Process -FilePath $final -ArgumentList -y -Wait - $cmd = $downloaddir + "\setup.cmd" - Start-Process -FilePath $cmd -Wait - } - } - else - { - throw "Unable to verify package" - } - cd $current - if (Test-Path -LiteralPath $downloaddir) - { - Remove-Item -LiteralPath $downloaddir -Force -Recurse - } -} diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/iisnode.yml b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/iisnode.yml deleted file mode 100644 index 85cc78139..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/iisnode.yml +++ /dev/null @@ -1,144 +0,0 @@ -# The optional iisnode.yml file provides overrides of the iisnode configuration settings specified in web.config. - -# node_env - determines the environment (production, development, staging, ...) in which -# child node processes run; if nonempty, is propagated to the child node processes as their NODE_ENV -# environment variable; the default is the value of the IIS worker process'es NODE_ENV -# environment variable - -node_env: - -# nodeProcessCommandLine - command line starting the node executable; in shared -# hosting environments this setting would typically be locked at the machine scope. - -# nodeProcessCommandLine: "C:\Program Files\nodejs\node.exe" - -# interceptor - fully qualified file name of a Node.js application that will run instead of an actual application -# the request targets; the fully qualified file name of the actual application file is provided as the first parameter -# to the interceptor application; default interceptor supports iisnode logging - -# interceptor: "c:\Program Files\iisnode\interceptor.js" - -# nodeProcessCountPerApplication - number of node.exe processes that IIS will start per application; -# setting this value to 0 results in creating one node.exe process per each processor on the machine - -nodeProcessCountPerApplication: 1 - -# maxConcurrentRequestsPerProcess - maximum number of reqeusts one node process can -# handle at a time - -maxConcurrentRequestsPerProcess: 1024 - -# maxNamedPipeConnectionRetry - number of times IIS will retry to establish a named pipe connection with a -# node process in order to send a new HTTP request - -maxNamedPipeConnectionRetry: 100 - -# namedPipeConnectionRetryDelay - delay in milliseconds between connection retries - -namedPipeConnectionRetryDelay: 250 - -# maxNamedPipeConnectionPoolSize - maximum number of named pipe connections that will be kept in a connection pool; -# connection pooling helps improve the performance of applications that process a large number of short lived HTTP requests - -maxNamedPipeConnectionPoolSize: 512 - -# maxNamedPipePooledConnectionAge - age of a pooled connection in milliseconds after which the connection is not reused for -# subsequent requests - -maxNamedPipePooledConnectionAge: 30000 - -# asyncCompletionThreadCount - size of the IO thread pool maintained by the IIS module to process asynchronous IO; setting it -# to 0 (default) results in creating one thread per each processor on the machine - -asyncCompletionThreadCount: 0 - -# initialRequestBufferSize - initial size in bytes of a memory buffer allocated for a new HTTP request - -initialRequestBufferSize: 4096 - -# maxRequestBufferSize - maximum size in bytes of a memory buffer allocated per request; this is a hard limit of -# the serialized form of HTTP request or response headers block - -maxRequestBufferSize: 65536 - -# watchedFiles - semi-colon separated list of files that will be watched for changes; a change to a file causes the application to recycle; -# each entry consists of an optional directory name plus required file name which are relative to the directory where the main application entry point -# is located; wild cards are allowed in the file name portion only; for example: "*.js;node_modules\foo\lib\options.json;app_data\*.config.json" - -watchedFiles: *.js;iisnode.yml - -# uncFileChangesPollingInterval - applications are recycled when the underlying *.js file is modified; if the file resides -# on a UNC share, the only reliable way to detect such modifications is to periodically poll for them; this setting -# controls the polling interval - -uncFileChangesPollingInterval: 5000 - -# gracefulShutdownTimeout - when a Node.js file is modified, all node processes handling running this application are recycled; -# this setting controls the time (in milliseconds) given for currently active requests to gracefully finish before the -# process is terminated; during this time, all new requests are already dispatched to a new node process based on the fresh version -# of the application - -gracefulShutdownTimeout: 60000 - -# loggingEnabled - controls whether stdout and stderr streams from node processes are captured and made available over HTTP - -loggingEnabled: true - -# logDirectory - directory name relative to the main application file that will store files with stdout and stderr captures; -# individual log file names have unique file names; log files are created lazily (i.e. when the process actually writes something -# to stdout or stderr); an HTML index of all log files is also maintained as index.html in that directory; -# by default, if your application is at http://foo.com/bar.js, logs will be accessible at http://foo.com/iisnode; -# SECURITY NOTE: if log files contain sensitive information, this setting should be modified to contain enough entropy to be considered -# cryptographically secure; in most situations, a GUID is sufficient - -logDirectory: iisnode - -# debuggingEnabled - controls whether the built-in debugger is available - -debuggingEnabled: true - -# debuggerPortRange - range of TCP ports that can be used for communication between the node-inspector debugger and the debugee; iisnode -# will round robin through this port range for subsequent debugging sessions and pick the next available (free) port to use from the range - -debuggerPortRange: 5058-6058 - -# debuggerPathSegment - URL path segment used to access the built-in node-inspector debugger; given a Node.js application at -http://foo.com/bar/baz.js, the debugger can be accessed at http://foo.com/bar/baz.js/{debuggerPathSegment}, by default -http://foo.com/bar/baz.js/debug - -debuggerPathSegment: debug - -# debugHeaderEnabled - boolean indicating whether iisnode should attach the iisnode-debug HTTP response header with -# diagnostics information to all responses - -debugHeaderEnabled: false - -# maxLogFileSizeInKB - maximum size of a single log file in KB; once a log file exceeds this limit a new log file is created - -maxLogFileSizeInKB: 128 - -# maxTotalLogFileSizeInKB - maximum total size of all log files in the logDirectory; once exceeded, old log files are removed - -maxTotalLogFileSizeInKB: 1024 - -# maxLogFiles - maximum number of log files in the logDirectory; once exceeded, old log files are removed - -maxLogFiles: 20 - -devErrorsEnabled: true - -# flushResponse - controls whether each HTTP response body chunk is immediately flushed by iisnode; flushing each body chunk incurs -# CPU cost but may improve latency in streaming scenarios - -flushResponse: false - -# enableXFF - controls whether iisnode adds or modifies the X-Forwarded-For request HTTP header with the IP address of the remote host - -enableXFF: false - -# promoteServerVars - comma delimited list of IIS server variables that will be propagated to the node.exe process in the form of -# x-iisnode- -# HTTP request headers; for a list of IIS server variables available see -# http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx; for example "AUTH_USER,AUTH_TYPE" - -promoteServerVars: diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/node.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/node.cmd deleted file mode 100644 index c69a72af9..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/node.cmd +++ /dev/null @@ -1 +0,0 @@ -node.exe %1 %2 %3 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/package.json b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/package.json index 6967d5c57..d3a341847 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/package.json +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/package.json @@ -2,8 +2,13 @@ "name": "$npmsafeprojectname$", "version": "0.0.0", "description": "$projectname$", - "main": "app.js", + "scripts": { + "start": "node server" + }, "author": { "name": "$username$" + }, + "engines": { + "node": "~6.10.x" } } diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/setup_web.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/setup_web.cmd deleted file mode 100644 index f02e6d5c4..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebApp/setup_web.cmd +++ /dev/null @@ -1,57 +0,0 @@ -@echo on - -cd /d "%~dp0" - -if "%EMULATED%"=="true" if DEFINED APPCMD goto emulator_setup -if "%EMULATED%"== "true" exit /b 0 - -echo Granting permissions for Network Service to the web root directory... -icacls ..\ /grant "Network Service":(OI)(CI)W -if %ERRORLEVEL% neq 0 goto error -echo OK - -echo Configuring powershell permissions -powershell -c "set-executionpolicy unrestricted" - -echo Downloading and installing runtime components -powershell .\download.ps1 '%RUNTIMEURL%' '%RUNTIMEURLOVERRIDE%' -if %ERRORLEVEL% neq 0 goto error - -echo SUCCESS -exit /b 0 - -:error -echo FAILED -exit /b -1 - -:emulator_setup -echo Running in emulator adding iisnode to application host config -FOR /F "tokens=1,2 delims=/" %%a in ("%APPCMD%") DO set FN=%%a&set OPN=%%b -if "%OPN%"=="%OPN:apphostconfig:=%" ( - echo "Could not parse appcmd '%appcmd% for configuration file, exiting" - goto error -) - -set IISNODE_BINARY_DIRECTORY=%programfiles(x86)%\iisnode-dev\release\x64 -set IISNODE_SCHEMA=%programfiles(x86)%\iisnode-dev\release\x64\iisnode_schema.xml - -if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto start -set IISNODE_BINARY_DIRECTORY=%programfiles%\iisnode-dev\release\x86 -set IISNODE_SCHEMA=%programfiles%\iisnode-dev\release\x86\iisnode_schema_x86.xml - - -:start -set - -echo Using iisnode binaries location '%IISNODE_BINARY_DIRECTORY%' -echo installing iisnode module using AppCMD alias %appcmd% -%appcmd% install module /name:"iisnode" /image:"%IISNODE_BINARY_DIRECTORY%\iisnode.dll" - -set apphostconfigfile=%OPN:apphostconfig:=% -powershell -c "set-executionpolicy unrestricted" -powershell .\ChangeConfig.ps1 %apphostconfigfile% -if %ERRORLEVEL% neq 0 goto error - -copy /y "%IISNODE_SCHEMA%" "%programfiles%\IIS Express\config\schema\iisnode_schema.xml" -if %ERRORLEVEL% neq 0 goto error -exit /b 0 diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/ChangeConfig.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/ChangeConfig.ps1 deleted file mode 100644 index 044634574..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/ChangeConfig.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -$configFile = $args[0] - -Write-Host "Adding iisnode section to config file '$configFile'" -$config = New-Object System.Xml.XmlDocument -$config.load($configFile) -$xpath = $config.CreateNavigator() -$parentElement = $xpath.SelectSingleNode("//configuration/configSections/sectionGroup[@name='system.webServer']") -$iisnodeElement = $parentElement.SelectSingleNode("//section[@name='iisnode']") -if ($iisnodeElement) { - Write-Host "Removing existing iisnode section from config file '$configFile'" - $iisnodeElement.DeleteSelf() -} - -$parentElement.AppendChild("
") -$config.Save($configFile) diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/TypeScriptWebApp.njsproj b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/TypeScriptWebApp.njsproj index 3c36f584a..0bd2a98b4 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/TypeScriptWebApp.njsproj +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/TypeScriptWebApp.njsproj @@ -38,10 +38,6 @@ - - - - diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/TypeScriptWebApp.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/TypeScriptWebApp.vstemplate index cbb05c420..1d6fafa7b 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/TypeScriptWebApp.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/TypeScriptWebApp.vstemplate @@ -22,10 +22,6 @@ README.md Web.config Web.Debug.config - ChangeConfig.ps1 - download.ps1 - setup_web.cmd - node.cmd diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/download.ps1 b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/download.ps1 deleted file mode 100644 index 9e46b09ad..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/download.ps1 +++ /dev/null @@ -1,87 +0,0 @@ -$runtimeUrl = $args[0] -$overrideUrl = $args[1] -$current = [string] (Get-Location -PSProvider FileSystem) -$client = New-Object System.Net.WebClient - -function downloadWithRetry { - param([string]$url, [string]$dest, [int]$retry) - Write-Host - Write-Host "Attempt: $retry" - Write-Host - trap { - Write-Host $_.Exception.ToString() - if ($retry -lt 5) { - $retry=$retry+1 - Write-Host - Write-Host "Waiting 5 seconds and retrying" - Write-Host - Start-Sleep -s 5 - downloadWithRetry $url $dest $retry $client - } - else { - Write-Host "Download failed" - throw "Max number of retries downloading [5] exceeded" - } - } - $client.downloadfile($url, $dest) -} - -function download($url, $dest) { - Write-Host "Downloading $url" - downloadWithRetry $url $dest 1 -} - -function copyOnVerify($file, $output) { - Write-Host "Verifying $file" - $verify = Get-AuthenticodeSignature $file - Out-Host -InputObject $verify - if ($verify.Status -ne "Valid") { - throw "Invalid signature for runtime package $file" - } - else { - mv $file $output - } -} - -if ($overrideUrl) { - Write-Host "Using override url: $overrideUrl" - $url = $overrideUrl -} -else { - $url = $runtimeUrl -} - -foreach($singleUrl in $url -split ";") -{ - $suffix = Get-Random - $downloaddir = $current + "\sandbox" + $suffix - mkdir $downloaddir - $dest = $downloaddir + "\sandbox.exe" - download $singleUrl $dest - $final = $downloaddir + "\runtime.exe" - copyOnVerify $dest $final - if (Test-Path -LiteralPath $final) - { - cd $downloaddir - if ($host.Version.Major -eq 3) - { - .\runtime.exe -y | Out-Null - .\setup.cmd - } - else - { - Start-Process -FilePath $final -ArgumentList -y -Wait - $cmd = $downloaddir + "\setup.cmd" - Start-Process -FilePath $cmd -Wait - } - } - else - { - throw "Unable to verify package" - } - cd $current - if (Test-Path -LiteralPath $downloaddir) - { - Remove-Item -LiteralPath $downloaddir -Force -Recurse - } -} diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/iisnode.yml b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/iisnode.yml deleted file mode 100644 index 85cc78139..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/iisnode.yml +++ /dev/null @@ -1,144 +0,0 @@ -# The optional iisnode.yml file provides overrides of the iisnode configuration settings specified in web.config. - -# node_env - determines the environment (production, development, staging, ...) in which -# child node processes run; if nonempty, is propagated to the child node processes as their NODE_ENV -# environment variable; the default is the value of the IIS worker process'es NODE_ENV -# environment variable - -node_env: - -# nodeProcessCommandLine - command line starting the node executable; in shared -# hosting environments this setting would typically be locked at the machine scope. - -# nodeProcessCommandLine: "C:\Program Files\nodejs\node.exe" - -# interceptor - fully qualified file name of a Node.js application that will run instead of an actual application -# the request targets; the fully qualified file name of the actual application file is provided as the first parameter -# to the interceptor application; default interceptor supports iisnode logging - -# interceptor: "c:\Program Files\iisnode\interceptor.js" - -# nodeProcessCountPerApplication - number of node.exe processes that IIS will start per application; -# setting this value to 0 results in creating one node.exe process per each processor on the machine - -nodeProcessCountPerApplication: 1 - -# maxConcurrentRequestsPerProcess - maximum number of reqeusts one node process can -# handle at a time - -maxConcurrentRequestsPerProcess: 1024 - -# maxNamedPipeConnectionRetry - number of times IIS will retry to establish a named pipe connection with a -# node process in order to send a new HTTP request - -maxNamedPipeConnectionRetry: 100 - -# namedPipeConnectionRetryDelay - delay in milliseconds between connection retries - -namedPipeConnectionRetryDelay: 250 - -# maxNamedPipeConnectionPoolSize - maximum number of named pipe connections that will be kept in a connection pool; -# connection pooling helps improve the performance of applications that process a large number of short lived HTTP requests - -maxNamedPipeConnectionPoolSize: 512 - -# maxNamedPipePooledConnectionAge - age of a pooled connection in milliseconds after which the connection is not reused for -# subsequent requests - -maxNamedPipePooledConnectionAge: 30000 - -# asyncCompletionThreadCount - size of the IO thread pool maintained by the IIS module to process asynchronous IO; setting it -# to 0 (default) results in creating one thread per each processor on the machine - -asyncCompletionThreadCount: 0 - -# initialRequestBufferSize - initial size in bytes of a memory buffer allocated for a new HTTP request - -initialRequestBufferSize: 4096 - -# maxRequestBufferSize - maximum size in bytes of a memory buffer allocated per request; this is a hard limit of -# the serialized form of HTTP request or response headers block - -maxRequestBufferSize: 65536 - -# watchedFiles - semi-colon separated list of files that will be watched for changes; a change to a file causes the application to recycle; -# each entry consists of an optional directory name plus required file name which are relative to the directory where the main application entry point -# is located; wild cards are allowed in the file name portion only; for example: "*.js;node_modules\foo\lib\options.json;app_data\*.config.json" - -watchedFiles: *.js;iisnode.yml - -# uncFileChangesPollingInterval - applications are recycled when the underlying *.js file is modified; if the file resides -# on a UNC share, the only reliable way to detect such modifications is to periodically poll for them; this setting -# controls the polling interval - -uncFileChangesPollingInterval: 5000 - -# gracefulShutdownTimeout - when a Node.js file is modified, all node processes handling running this application are recycled; -# this setting controls the time (in milliseconds) given for currently active requests to gracefully finish before the -# process is terminated; during this time, all new requests are already dispatched to a new node process based on the fresh version -# of the application - -gracefulShutdownTimeout: 60000 - -# loggingEnabled - controls whether stdout and stderr streams from node processes are captured and made available over HTTP - -loggingEnabled: true - -# logDirectory - directory name relative to the main application file that will store files with stdout and stderr captures; -# individual log file names have unique file names; log files are created lazily (i.e. when the process actually writes something -# to stdout or stderr); an HTML index of all log files is also maintained as index.html in that directory; -# by default, if your application is at http://foo.com/bar.js, logs will be accessible at http://foo.com/iisnode; -# SECURITY NOTE: if log files contain sensitive information, this setting should be modified to contain enough entropy to be considered -# cryptographically secure; in most situations, a GUID is sufficient - -logDirectory: iisnode - -# debuggingEnabled - controls whether the built-in debugger is available - -debuggingEnabled: true - -# debuggerPortRange - range of TCP ports that can be used for communication between the node-inspector debugger and the debugee; iisnode -# will round robin through this port range for subsequent debugging sessions and pick the next available (free) port to use from the range - -debuggerPortRange: 5058-6058 - -# debuggerPathSegment - URL path segment used to access the built-in node-inspector debugger; given a Node.js application at -http://foo.com/bar/baz.js, the debugger can be accessed at http://foo.com/bar/baz.js/{debuggerPathSegment}, by default -http://foo.com/bar/baz.js/debug - -debuggerPathSegment: debug - -# debugHeaderEnabled - boolean indicating whether iisnode should attach the iisnode-debug HTTP response header with -# diagnostics information to all responses - -debugHeaderEnabled: false - -# maxLogFileSizeInKB - maximum size of a single log file in KB; once a log file exceeds this limit a new log file is created - -maxLogFileSizeInKB: 128 - -# maxTotalLogFileSizeInKB - maximum total size of all log files in the logDirectory; once exceeded, old log files are removed - -maxTotalLogFileSizeInKB: 1024 - -# maxLogFiles - maximum number of log files in the logDirectory; once exceeded, old log files are removed - -maxLogFiles: 20 - -devErrorsEnabled: true - -# flushResponse - controls whether each HTTP response body chunk is immediately flushed by iisnode; flushing each body chunk incurs -# CPU cost but may improve latency in streaming scenarios - -flushResponse: false - -# enableXFF - controls whether iisnode adds or modifies the X-Forwarded-For request HTTP header with the IP address of the remote host - -enableXFF: false - -# promoteServerVars - comma delimited list of IIS server variables that will be propagated to the node.exe process in the form of -# x-iisnode- -# HTTP request headers; for a list of IIS server variables available see -# http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx; for example "AUTH_USER,AUTH_TYPE" - -promoteServerVars: diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/node.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/node.cmd deleted file mode 100644 index c69a72af9..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/node.cmd +++ /dev/null @@ -1 +0,0 @@ -node.exe %1 %2 %3 \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/package.json b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/package.json index 6967d5c57..d3a341847 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/package.json +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/package.json @@ -2,8 +2,13 @@ "name": "$npmsafeprojectname$", "version": "0.0.0", "description": "$projectname$", - "main": "app.js", + "scripts": { + "start": "node server" + }, "author": { "name": "$username$" + }, + "engines": { + "node": "~6.10.x" } } diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/setup_web.cmd b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/setup_web.cmd deleted file mode 100644 index f02e6d5c4..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptAzureWebRole/setup_web.cmd +++ /dev/null @@ -1,57 +0,0 @@ -@echo on - -cd /d "%~dp0" - -if "%EMULATED%"=="true" if DEFINED APPCMD goto emulator_setup -if "%EMULATED%"== "true" exit /b 0 - -echo Granting permissions for Network Service to the web root directory... -icacls ..\ /grant "Network Service":(OI)(CI)W -if %ERRORLEVEL% neq 0 goto error -echo OK - -echo Configuring powershell permissions -powershell -c "set-executionpolicy unrestricted" - -echo Downloading and installing runtime components -powershell .\download.ps1 '%RUNTIMEURL%' '%RUNTIMEURLOVERRIDE%' -if %ERRORLEVEL% neq 0 goto error - -echo SUCCESS -exit /b 0 - -:error -echo FAILED -exit /b -1 - -:emulator_setup -echo Running in emulator adding iisnode to application host config -FOR /F "tokens=1,2 delims=/" %%a in ("%APPCMD%") DO set FN=%%a&set OPN=%%b -if "%OPN%"=="%OPN:apphostconfig:=%" ( - echo "Could not parse appcmd '%appcmd% for configuration file, exiting" - goto error -) - -set IISNODE_BINARY_DIRECTORY=%programfiles(x86)%\iisnode-dev\release\x64 -set IISNODE_SCHEMA=%programfiles(x86)%\iisnode-dev\release\x64\iisnode_schema.xml - -if "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto start -set IISNODE_BINARY_DIRECTORY=%programfiles%\iisnode-dev\release\x86 -set IISNODE_SCHEMA=%programfiles%\iisnode-dev\release\x86\iisnode_schema_x86.xml - - -:start -set - -echo Using iisnode binaries location '%IISNODE_BINARY_DIRECTORY%' -echo installing iisnode module using AppCMD alias %appcmd% -%appcmd% install module /name:"iisnode" /image:"%IISNODE_BINARY_DIRECTORY%\iisnode.dll" - -set apphostconfigfile=%OPN:apphostconfig:=% -powershell -c "set-executionpolicy unrestricted" -powershell .\ChangeConfig.ps1 %apphostconfigfile% -if %ERRORLEVEL% neq 0 goto error - -copy /y "%IISNODE_SCHEMA%" "%programfiles%\IIS Express\config\schema\iisnode_schema.xml" -if %ERRORLEVEL% neq 0 goto error -exit /b 0 diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/ExpressApp.njsproj b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/ExpressApp.njsproj index b6bc09747..588318749 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/ExpressApp.njsproj +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/ExpressApp.njsproj @@ -10,7 +10,7 @@ 2.0 $guid1$ . - bin\www + app.js . @@ -37,7 +37,6 @@ - @@ -46,6 +45,7 @@ $if$ ($dev14$ == true) $endif$ + diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/ExpressApp.vstemplate b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/ExpressApp.vstemplate index 30d0de976..23fc8a319 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/ExpressApp.vstemplate +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/ExpressApp.vstemplate @@ -15,9 +15,6 @@ - - www - @@ -32,6 +29,7 @@ index.pug layout.pug + error.pug diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/app.ts b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/app.ts index 57b684216..3eb0cf893 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/app.ts +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/app.ts @@ -1,4 +1,5 @@ -import express = require('express'); +import debug = require('debug'); +import express = require('express'); import path = require('path'); import routes from './routes/index'; @@ -46,5 +47,8 @@ app.use((err: any, req, res, next) => { }); }); +app.set('port', process.env.PORT || 3000); -module.exports = app; +var server = app.listen(app.get('port'), function () { + debug('Express server listening on port ' + server.address().port); +}); diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/error.pug b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/error.pug new file mode 100644 index 000000000..fbe842c7e --- /dev/null +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/error.pug @@ -0,0 +1,6 @@ +extends layout + +block content + h1= message + h2= error.status + pre #{error.stack} \ No newline at end of file diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/package.json b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/package.json index 48db6e0cf..78297f534 100644 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/package.json +++ b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "private": true, "scripts": { - "start": "node ./bin/www" + "start": "node app" }, "description": "$projectname$", "author": { diff --git a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/www b/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/www deleted file mode 100644 index bb78b8403..000000000 --- a/Nodejs/Product/Nodejs/ProjectTemplates/TypeScriptExpressApp/www +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env node -var debug = require('debug')('$safeprojectname$'); -var app = require('../app'); - -app.set('port', process.env.PORT || 3000); - -var server = app.listen(app.get('port'), function() { - debug('Express server listening on port ' + server.address().port); -}); diff --git a/Nodejs/Product/Nodejs/VSPackage.resx b/Nodejs/Product/Nodejs/VSPackage.resx index 4f93faafb..5c056bd3f 100644 --- a/Nodejs/Product/Nodejs/VSPackage.resx +++ b/Nodejs/Product/Nodejs/VSPackage.resx @@ -301,10 +301,10 @@ Azure Cloud Service - Basic Node.js Express 4 Application. + A project for creating a scalable service that runs on Microsoft Azure. - Azure Cloud Service + Basic Node.js Express 4 Application. A basic Node.js Express 4 application.