From a4222dbf43010e08ae495cb9fbe8eedb8392dbe5 Mon Sep 17 00:00:00 2001 From: Elad Iwanir <13205761+eladiw@users.noreply.github.com> Date: Sun, 5 Apr 2020 13:04:08 +0300 Subject: [PATCH 1/5] Supporting Windows and Linux web apps. Linux by default --- azuredeploy.json | 128 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 116 insertions(+), 12 deletions(-) diff --git a/azuredeploy.json b/azuredeploy.json index 7e5f0ed..0111da1 100644 --- a/azuredeploy.json +++ b/azuredeploy.json @@ -7,13 +7,24 @@ "defaultValue": "[concat('HealthBot', uniqueString(resourceGroup().name, utcNow('F')))]", "metadata":{ "description": "Web site name. Has to be unique." - + + } + }, + "serverKind": { + "type": "string", + "defaultValue": "linux", + "allowedValues": [ + "linux", + "windows" + ], + "metadata": { + "description": "Host type: Linux or Windows" } }, "skuName": { "type": "string", "defaultValue": "P1V2", - "allowedValues": [ + "allowedValues": [ "B1", "S1", "P1V2" @@ -44,7 +55,7 @@ "webchatSecret": { "type": "securestring", "metadata":{ - "description": "Healthbot webchat secret." + "description": "Healthbot webchat secret." } } }, @@ -53,21 +64,33 @@ "skuCode": "[parameters('skuName')]", "numberOfWorkers": "[parameters('numberOfInstances')]", "linuxFxVersion": "NODE|lts", - "hostingPlanName": "[concat('hpn-', parameters('siteName'))]", + "hostingPlanNameLinux": "[concat('hpn-', parameters('siteName'))]", + "hostingPlanNameWin": "[concat('hpn-win-', parameters('siteName'))]", "repoURL": "https://github.com/microsoft/HealthBotContainerSample.git", - "branch": "master" + "branch": "master", + "kind": "[if(equals(parameters('serverKind'), 'windows'), 'app', 'linux')]", + "linuxSiteName": "[concat(parameters('siteName'), 'linux')]", + "windowsSiteName": "[concat(parameters('siteName'), 'windows')]", + "WinSkuCode": "[parameters('skuName')]", + "WinSku": "Standard", + "workerSize": "0", + "workerSizeId": "0", + "hostingEnvironment": "", + "nodeVersion": "12.13.0", + "currentStack": "node" }, "resources": [ { "apiVersion": "2018-02-01", - "name": "[parameters('siteName')]", + "name": "[variables('linuxSiteName')]", + "condition": "[equals(parameters('serverKind'),'linux')]", "type": "Microsoft.Web/sites", "location": "[parameters('siteLocation')]", "dependsOn": [ - "[resourceId('Microsoft.Web/serverfarms/', variables('hostingPlanName'))]" + "[resourceId('Microsoft.Web/serverfarms/', variables('hostingPlanNameLinux'))]" ], "properties": { - "name": "[parameters('siteName')]", + "name": "[variables('linuxSiteName')]", "siteConfig": { "linuxFxVersion": "[variables('linuxFxVersion')]", "alwaysOn": "[variables('alwaysOn')]", @@ -82,17 +105,18 @@ } ] }, - "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]", + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanNameLinux'))]", "clientAffinityEnabled": false }, "resources": [ { "type": "sourcecontrols", + "condition": "[equals(parameters('serverKind'),'linux')]", "apiVersion": "2018-02-01", "name": "web", "location": "[parameters('siteLocation')]", "dependsOn": [ - "[resourceId('Microsoft.Web/sites', parameters('siteName'))]" + "[resourceId('Microsoft.Web/sites', variables('linuxSiteName'))]" ], "properties": { "repoUrl": "[variables('repoURL')]", @@ -104,7 +128,8 @@ }, { "apiVersion": "2018-02-01", - "name": "[variables('hostingPlanName')]", + "condition": "[equals(parameters('serverKind'),'linux')]", + "name": "[variables('hostingPlanNameLinux')]", "type": "Microsoft.Web/serverfarms", "location": "[parameters('siteLocation')]", "kind": "linux", @@ -112,10 +137,89 @@ "Name": "[variables('skuCode')]" }, "properties": { - "name": "[variables('hostingPlanName')]", + "name": "[variables('hostingPlanNameLinux')]", "numberOfWorkers": "[variables('numberOfWorkers')]", "reserved": true } + }, + { + "apiVersion": "2018-11-01", + "condition": "[equals(parameters('serverKind'),'windows')]", + "name": "[variables('windowsSiteName')]", + "type": "Microsoft.Web/sites", + "location": "[parameters('siteLocation')]", + "tags": null, + "dependsOn": [ + "[concat('Microsoft.Web/serverfarms/', variables('hostingPlanNameWin'))]" + ], + "properties": { + "name": "[variables('windowsSiteName')]", + "siteConfig": { + "appSettings": [ + { + "name": "APP_SECRET", + "value": "[parameters('appSecret')]" + }, + { + "name": "WEBCHAT_SECRET", + "value": "[parameters('webchatSecret')]" + }, + { + "name": "WEBSITE_NODE_DEFAULT_VERSION", + "value": "[variables('nodeVersion')]" + } + ], + "metadata": [ + { + "name": "CURRENT_STACK", + "value": "[variables('currentStack')]" + } + ], + "nodeVersion": "[parameters('nodeVersion')]", + "alwaysOn": "[variables('alwaysOn')]" + }, + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanNameWin'))]", + "hostingEnvironment": "[variables('hostingEnvironment')]", + "clientAffinityEnabled": true + }, + "resources": [ + { + "type": "sourcecontrols", + "condition": "[equals(parameters('serverKind'),'windows')]", + "apiVersion": "2018-11-01", + "name": "web", + "location": "[parameters('siteLocation')]", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', variables('windowsSiteName'))]" + ], + "properties": { + "repoUrl": "[variables('repoURL')]", + "branch": "[variables('branch')]", + "isManualIntegration": true + } + } + ] + }, + { + "apiVersion": "2018-11-01", + "name": "[variables('hostingPlanNameWin')]", + "condition": "[equals(parameters('serverKind'),'windows')]", + "type": "Microsoft.Web/serverfarms", + "location": "[parameters('siteLocation')]", + "kind": "", + "tags": null, + "dependsOn": [], + "properties": { + "name": "[variables('hostingPlanNameWin')]", + "workerSize": "[variables('workerSize')]", + "workerSizeId": "[variables('workerSizeId')]", + "numberOfWorkers": "[variables('numberOfWorkers')]", + "hostingEnvironment": "[variables('hostingEnvironment')]" + }, + "sku": { + "Tier": "[variables('WinSku')]", + "Name": "[variables('WinSkuCode')]" + } } ] } \ No newline at end of file From 39a17494c2cdaa3ddc6ac5929bceb0e66d32ac1a Mon Sep 17 00:00:00 2001 From: Elad Iwanir <13205761+eladiw@users.noreply.github.com> Date: Mon, 6 Apr 2020 12:09:56 +0300 Subject: [PATCH 2/5] bug fix --- azuredeploy.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azuredeploy.json b/azuredeploy.json index 0111da1..6948065 100644 --- a/azuredeploy.json +++ b/azuredeploy.json @@ -175,7 +175,7 @@ "value": "[variables('currentStack')]" } ], - "nodeVersion": "[parameters('nodeVersion')]", + "nodeVersion": "[variables('nodeVersion')]", "alwaysOn": "[variables('alwaysOn')]" }, "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanNameWin'))]", From 6d3239eff60a2fcf364bbfd12cb37c19b683fae6 Mon Sep 17 00:00:00 2001 From: Elad Iwanir <13205761+eladiw@users.noreply.github.com> Date: Mon, 6 Apr 2020 13:09:20 +0300 Subject: [PATCH 3/5] update readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 30caa9f..50534bb 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ A simple web page to hand off users to the Microsoft Health bot [![Deploy to Azure](https://azuredeploy.net/deploybutton.png)](https://azuredeploy.net/) +Note: to enable online file editing in the portal please choose "Windows", otherwise we recommend you to go with the default (Linux) + 2.Set the following environment variables: `APP_SECRET` @@ -48,7 +50,7 @@ In some cases it is required to set the endpoint URI so that it points to a spec Pass your preferred geographic endpoint URI by setting the environment variable: `DIRECTLINE_ENDPOINT_URI` in your deployment. If no variable is found it will default to `directline.botframework.com` -**Note:** If you are deploying the code sample using the "Deploy to Azure" option, you should add the above secrets to the application settings for your App Service. +**Note:** If you are deploying the code sample using the "Deploy to Azure" option, you should add the above secrets to the application settings for your App Service. ## Agent webchat If the agent webchat sample is also required, [switch to the live agent handoff branch](https://github.com/Microsoft/HealthBotContainerSample/tree/live_agent_handoff) From 74d0f0d74cef36d2710b48612ed49e94eb3114ac Mon Sep 17 00:00:00 2001 From: Elad Iwanir <13205761+eladiw@users.noreply.github.com> Date: Mon, 6 Apr 2020 13:13:52 +0300 Subject: [PATCH 4/5] adding doc --- azuredeploy.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azuredeploy.json b/azuredeploy.json index 6948065..f7b8d45 100644 --- a/azuredeploy.json +++ b/azuredeploy.json @@ -18,7 +18,7 @@ "windows" ], "metadata": { - "description": "Host type: Linux or Windows" + "description": "Host type: Linux or Windows. (Linux is recommended)" } }, "skuName": { From d01f91a1467b609d08e1f4693cc11c6b8cd27729 Mon Sep 17 00:00:00 2001 From: Elad Iwanir <13205761+eladiw@users.noreply.github.com> Date: Mon, 6 Apr 2020 13:56:53 +0300 Subject: [PATCH 5/5] update readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 50534bb..0332eaf 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ A simple web page to hand off users to the Microsoft Health bot [![Deploy to Azure](https://azuredeploy.net/deploybutton.png)](https://azuredeploy.net/) -Note: to enable online file editing in the portal please choose "Windows", otherwise we recommend you to go with the default (Linux) +Note: It is recommended you use the default Linux host type when deploying the container. +However, if you wish to enable online file editing using the App Service Editor, select 'Windows'. 2.Set the following environment variables: