diff --git a/.deployment b/.deployment new file mode 100644 index 0000000..34ecd16 --- /dev/null +++ b/.deployment @@ -0,0 +1,2 @@ +[config] +command = powershell -NoProfile -NoLogo -ExecutionPolicy Unrestricted -Command "& "$pwd\Deploy-SolrAzureAppService.ps1 %solrVersion%" 2>&1 | echo" \ No newline at end of file diff --git a/Deploy-SolrAzureAppService.ps1 b/Deploy-SolrAzureAppService.ps1 new file mode 100644 index 0000000..1df21cd --- /dev/null +++ b/Deploy-SolrAzureAppService.ps1 @@ -0,0 +1,18 @@ +Param( + $solrVersion +) + +$solrName = "solr-$solrVersion" + +Write-Output 'Copy wwwroot folder' +xcopy wwwroot ..\wwwroot /Y + +Write-Output 'Setting Security to TLS 1.2' +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +Write-Output 'Prevent the progress meter from trying to access the console' +$global:progressPreference = 'SilentlyContinue' + +Write-Output 'Downloading Solr $solrVersion' +$downloadSource = "https://archive.apache.org/dist/lucene/solr/$solrVersion/$solrName.zip" +Start-BitsTransfer -Source $downloadSource -Destination \wwwroot\solr.zip +Expand-Archive \wwwroot\solr.zip -DestinationPath \wwwroot\$solrName diff --git a/README.md b/README.md index 883de28..e487bea 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -# Solr-AzureAppService \ No newline at end of file +# Solr-AzureAppService + +[![Deploy to Azure](https://azuredeploy.net/deploybutton.png)](https://azuredeploy.net/) \ No newline at end of file diff --git a/azuredeploy.json b/azuredeploy.json new file mode 100644 index 0000000..8772b24 --- /dev/null +++ b/azuredeploy.json @@ -0,0 +1,84 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "hostingPlanName": { + "type": "string", + "minLength": 1, + "defaultValue": "SolrAppServicePlan" + }, + "siteLocation": { + "type": "string", + "defaultValue": "East US 2" + }, + "siteName": { + "type": "string", + "defaultValue": "SolrAppService" + }, + "solrVersion": { + "type": "string", + "defaultValue": "6.6.2" + }, + "skuName": { + "defaultValue": "S1", + "allowedValues": [ + "B1", + "B2", + "B3", + "S1", + "S2", + "S3", + "P1", + "P2", + "P3", + "P4" + ], + "type": "string" + } + }, + "resources": [ + { + "apiVersion": "2016-09-01", + "name": "[parameters('hostingPlanName')]", + "type": "Microsoft.Web/serverfarms", + "location": "[parameters('siteLocation')]", + "sku": { + "name": "[parameters('skuName')]" + }, + "properties": { + "name": "[parameters('hostingPlanName')]" + } + }, + { + "apiVersion": "2016-08-01", + "name": "[parameters('siteName')]", + "type": "Microsoft.Web/sites", + "location": "[parameters('siteLocation')]", + "dependsOn": [ + "[resourceId('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]" + ], + "properties": { + "name": "[parameters('siteName')]", + "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]", + "clientAffinityEnabled": false + }, + "resources": [ + { + "name": "web", + "type": "config", + "apiVersion": "2016-08-01", + "dependsOn": [ + "[resourceId('Microsoft.Web/sites', parameters('siteName'))]" + ], + "properties": { + "alwaysOn": true, + "javaVersion": "11", + "javaContainer": "TOMCAT", + "javaContainerVersion": "9.0", + "solrVersion": "[parameters('solrVersion')]" + } + } + ] + } + ] +} \ No newline at end of file