Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
235 lines (235 sloc)
7.63 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.2", | |
"parameters": { | |
"siteName": { | |
"type": "string" | |
}, | |
"hostingPlanName": { | |
"type": "string" | |
}, | |
"siteLocation": { | |
"type": "string" | |
}, | |
"sku": { | |
"type": "string", | |
"allowedValues": [ | |
"Free", | |
"Shared", | |
"Basic", | |
"Standard", | |
"Premium" | |
], | |
"defaultValue": "Free" | |
}, | |
"Worker Size": { | |
"type": "string", | |
"allowedValues": [ | |
"1", | |
"2", | |
"3" | |
], | |
"defaultValue": "1" | |
}, | |
"Deploy App Insights": { | |
"type": "bool", | |
"defaultValue": true | |
}, | |
"Email Service": { | |
"type": "string", | |
"allowedValues": [ | |
"Not configured", | |
"Mailgun", | |
"Gmail", | |
"SendGrid" | |
], | |
"defaultValue": "Not configured" | |
}, | |
"storageAccountType": { | |
"type": "string", | |
"defaultValue": "Standard_LRS", | |
"allowedValues": [ | |
"Standard_LRS", | |
"Standard_GRS", | |
"Standard_ZRS", | |
"Premium_LRS" | |
] | |
}, | |
"Email Username": { | |
"type": "string", | |
"defaultValue": "" | |
}, | |
"Email Password": { | |
"type": "string", | |
"defaultValue": "" | |
}, | |
"Email From Address": { | |
"type": "string", | |
"defaultValue": "" | |
}, | |
"repoUrl": { | |
"type": "string" | |
}, | |
"branch": { | |
"type": "string" | |
} | |
}, | |
"variables": { | |
"storageAccountName": "[concat('ghoststore', uniquestring(resourceGroup().id))]", | |
"storageAccountId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]", | |
"skuMapping": "[if(equals(parameters('sku'), 'Free'), 'F', if(equals(parameters('sku'), 'Shared'), 'D', if(equals(parameters('sku'), 'Basic'), 'B', if(equals(parameters('sku'), 'Standard'), 'S', if(equals(parameters('sku'), 'Premium'), 'P', 'F')))))]", | |
"sku": "[concat(variables('skuMapping'), parameters('Worker Size'))]", | |
"appInsightsName": "[concat(parameters('siteName'), '-insights')]", | |
"siteProperties": { | |
"netFrameworkVersion": "v4.7", | |
"use32BitWorkerProcess": false, | |
"httpsonly": true, | |
"webSocketsEnabled": true, | |
"alwaysOn": true, | |
"requestTracingEnabled": true, | |
"httpLoggingEnabled": true, | |
"logsDirectorySizeLimit": 40, | |
"detailedErrorLoggingEnabled": true, | |
"remoteDebuggingEnabled": true | |
} | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"apiVersion": "2018-11-01", | |
"name": "[variables('storageAccountName')]", | |
"location": "[parameters('siteLocation')]", | |
"sku": { | |
"name": "[parameters('storageAccountType')]" | |
}, | |
"kind": "StorageV2", | |
"properties": {} | |
}, | |
{ | |
"name": "[parameters('hostingPlanName')]", | |
"type": "Microsoft.Web/serverfarms", | |
"location": "[parameters('siteLocation')]", | |
"apiVersion": "2018-02-01", | |
"sku": { | |
"name": "[variables('sku')]" | |
}, | |
"dependsOn": [ | |
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" | |
], | |
"properties": { | |
"name": "[parameters('hostingPlanName')]", | |
"numberOfWorkers": 1 | |
} | |
}, | |
{ | |
"name": "[parameters('siteName')]", | |
"type": "Microsoft.Web/sites", | |
"location": "[parameters('siteLocation')]", | |
"apiVersion": "2018-11-01", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]" | |
], | |
"tags": { | |
"[concat('hidden-related:', resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName')))]": "Resource", | |
"displayName": "[parameters('siteName')]" | |
}, | |
"properties": { | |
"name": "[parameters('siteName')]", | |
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]" | |
}, | |
"resources": [ | |
{ | |
"apiVersion": "2018-11-01", | |
"name": "web", | |
"type": "config", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]" | |
], | |
"properties": "[variables('siteProperties')]" | |
}, | |
{ | |
"apiVersion": "2018-11-01", | |
"name": "logs", | |
"type": "config", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]" | |
], | |
"properties": { | |
"applicationLogs": { | |
"fileSystem": { | |
"level": "Warning" | |
} | |
}, | |
"httpLogs": { | |
"fileSystem": { | |
"retentionInMb": 40, | |
"retentionInDays": 30, | |
"enabled": true | |
} | |
}, | |
"failedRequestsTracing": { | |
"enabled": true | |
}, | |
"detailedErrorMessages": { | |
"enabled": true | |
} | |
} | |
}, | |
{ | |
"name": "appsettings", | |
"type": "config", | |
"apiVersion": "2018-11-01", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]", | |
"[resourceId('Microsoft.Insights/components', variables('appInsightsName'))]", | |
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" | |
], | |
"properties": { | |
"url": "[concat('https://', reference(resourceId('Microsoft.Web/sites', parameters('siteName'))).hostNames[0])]", | |
"mail__transport": "SMTP", | |
"mail__options__service": "[parameters('Email Service')]", | |
"mail__options__auth__user": "[parameters('Email Username')]", | |
"mail__options__auth__pass": "[parameters('Email Password')]", | |
"mail__from": "[parameters('Email From Address')]", | |
"WEBSITE_NODE_DEFAULT_VERSION": "~10", | |
"NODE_ENV": "production", | |
"APPINSIGHTS_INSTRUMENTATION_KEY": "[reference(concat('Microsoft.Insights/components/', variables('appInsightsName'))).InstrumentationKey]", | |
"AZURE_STORAGE_CONNECTION_STRING": "[concat('DefaultEndpointsProtocol=https;AccountName=',variables('storageAccountName'),';AccountKey=',concat(listKeys(variables('storageAccountId'), '2018-11-01').keys[0].value))]" | |
} | |
}, | |
{ | |
"name": "web", | |
"type": "sourcecontrols", | |
"apiVersion": "2018-11-01", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]", | |
"[resourceId('Microsoft.Web/sites/config', parameters('siteName'), 'appsettings')]" | |
], | |
"properties": { | |
"repoUrl": "[parameters('repoUrl')]", | |
"branch": "[parameters('branch')]", | |
"isManualIntegration": true, | |
"deploymentRollbackEnabled": true | |
} | |
} | |
] | |
}, | |
{ | |
"name": "[variables('appInsightsName')]", | |
"type": "Microsoft.Insights/components", | |
"location": "[parameters('siteLocation')]", | |
"apiVersion": "2014-04-01", | |
"condition": "[parameters('Deploy App Insights')]", | |
"dependsOn": [ | |
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]" | |
], | |
"tags": { | |
"displayName": "[variables('appInsightsName')]" | |
}, | |
"properties": { | |
"ApplicationId": "[resourceId('Microsoft.Web/sites', parameters('siteName'))]", | |
"Application_Type": "Node.JS" | |
} | |
} | |
] | |
} |