472 строки
15 KiB
JSON
472 строки
15 KiB
JSON
{
|
|
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"metadata": {
|
|
"_generator": {
|
|
"name": "bicep",
|
|
"version": "0.14.6.61914",
|
|
"templateHash": "14853070812822277948"
|
|
}
|
|
},
|
|
"parameters": {
|
|
"location": {
|
|
"type": "string",
|
|
"defaultValue": "[resourceGroup().location]"
|
|
},
|
|
"siteName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Name of azure web app"
|
|
}
|
|
},
|
|
"linuxFxVersion": {
|
|
"type": "string",
|
|
"defaultValue": "php|7.4",
|
|
"metadata": {
|
|
"description": "Stack settings"
|
|
}
|
|
},
|
|
"administratorLogin": {
|
|
"type": "string",
|
|
"defaultValue": "redcap_app",
|
|
"minLength": 1,
|
|
"metadata": {
|
|
"description": "Database administrator login name"
|
|
}
|
|
},
|
|
"administratorLoginPassword": {
|
|
"type": "securestring",
|
|
"minLength": 8,
|
|
"metadata": {
|
|
"description": "Password used for database administration and SendGrid email access"
|
|
}
|
|
},
|
|
"redcapAppZip": {
|
|
"type": "string",
|
|
"defaultValue": "",
|
|
"metadata": {
|
|
"description": "REDCap zip file URI."
|
|
}
|
|
},
|
|
"redcapCommunityUsername": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "REDCap Community site username for downloading the REDCap zip file."
|
|
}
|
|
},
|
|
"redcapCommunityPassword": {
|
|
"type": "securestring",
|
|
"metadata": {
|
|
"description": "REDCap Community site password for downloading the REDCap zip file."
|
|
}
|
|
},
|
|
"redcapAppZipVersion": {
|
|
"type": "string",
|
|
"defaultValue": "latest",
|
|
"metadata": {
|
|
"description": "REDCap zip file version to be downloaded from the REDCap Community site."
|
|
}
|
|
},
|
|
"fromEmailAddress": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Email address configured as the sending address in RedCAP"
|
|
}
|
|
},
|
|
"skuName": {
|
|
"type": "string",
|
|
"defaultValue": "S1",
|
|
"allowedValues": [
|
|
"F1",
|
|
"D1",
|
|
"B1",
|
|
"B2",
|
|
"B3",
|
|
"S1",
|
|
"S2",
|
|
"S3",
|
|
"P1v2",
|
|
"P2v2",
|
|
"P3v2",
|
|
"P1v3",
|
|
"P2v3",
|
|
"P3v3"
|
|
],
|
|
"metadata": {
|
|
"description": "Describes plan's pricing tier and capacity - this can be changed after deployment. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/"
|
|
}
|
|
},
|
|
"skuCapacity": {
|
|
"type": "int",
|
|
"defaultValue": 1,
|
|
"minValue": 1,
|
|
"metadata": {
|
|
"description": "Describes plan's instance count (how many distinct web servers will be deployed in the farm) - this can be changed after deployment"
|
|
}
|
|
},
|
|
"databaseStorageSizeGB": {
|
|
"type": "int",
|
|
"defaultValue": 32,
|
|
"metadata": {
|
|
"description": "Initial MySQL database storage size in GB "
|
|
}
|
|
},
|
|
"databaseStorageIops": {
|
|
"type": "int",
|
|
"defaultValue": 396,
|
|
"metadata": {
|
|
"description": "Initial MySQL databse storage IOPS"
|
|
}
|
|
},
|
|
"databaseStorageAutoGrow": {
|
|
"type": "string",
|
|
"defaultValue": "Enabled",
|
|
"allowedValues": [
|
|
"Enabled",
|
|
"Disabled"
|
|
]
|
|
},
|
|
"databseStorageAutoIoScaling": {
|
|
"type": "string",
|
|
"defaultValue": "Enabled",
|
|
"allowedValues": [
|
|
"Enabled",
|
|
"Disabled"
|
|
]
|
|
},
|
|
"mysqlVersion": {
|
|
"type": "string",
|
|
"defaultValue": "5.7",
|
|
"allowedValues": [
|
|
"5.6",
|
|
"5.7"
|
|
],
|
|
"metadata": {
|
|
"description": "MySQL version"
|
|
}
|
|
},
|
|
"storageType": {
|
|
"type": "string",
|
|
"defaultValue": "Standard_LRS",
|
|
"allowedValues": [
|
|
"Standard_LRS",
|
|
"Standard_ZRS",
|
|
"Standard_GRS",
|
|
"Standard_RAGRS",
|
|
"Premium_LRS"
|
|
],
|
|
"metadata": {
|
|
"description": "The default selected is 'Locally Redundant Storage' (3 copies in one region). See https://docs.microsoft.com/en-us/azure/storage/common/storage-redundancy for more information."
|
|
}
|
|
},
|
|
"storageContainerName": {
|
|
"type": "string",
|
|
"defaultValue": "redcap",
|
|
"metadata": {
|
|
"description": "Name of the container used to store backing files in the new storage account. This container is created automatically during deployment."
|
|
}
|
|
},
|
|
"repoURL": {
|
|
"type": "string",
|
|
"defaultValue": "https://github.com/microsoft/azure-redcap-paas.git",
|
|
"metadata": {
|
|
"description": "The path to the deployment source files on GitHub"
|
|
}
|
|
},
|
|
"branch": {
|
|
"type": "string",
|
|
"defaultValue": "main",
|
|
"metadata": {
|
|
"description": "The main branch of the application repo"
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"siteNameCleaned": "[replace(parameters('siteName'), ' ', '')]",
|
|
"databaseName": "[format('{0}_db', variables('siteNameCleaned'))]",
|
|
"uniqueServerName": "[format('{0}{1}', variables('siteNameCleaned'), uniqueString(resourceGroup().id))]",
|
|
"hostingPlanNameCleaned": "[format('{0}_serviceplan', variables('siteNameCleaned'))]",
|
|
"uniqueSendgridAccountName": "[format('{0}_sendgrid', variables('siteNameCleaned'))]",
|
|
"uniqueWebSiteName": "[format('{0}{1}', variables('siteNameCleaned'), uniqueString(resourceGroup().id))]",
|
|
"uniqueStorageName": "[format('storage{0}', uniqueString(resourceGroup().id))]",
|
|
"storageAccountId": "[format('{0}/providers/Microsoft.Storage/storageAccounts/{1}', resourceGroup().id, variables('uniqueStorageName'))]"
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Sendgrid.Email/accounts",
|
|
"apiVersion": "2015-01-01",
|
|
"name": "[variables('uniqueSendgridAccountName')]",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"displayName": "SendGrid"
|
|
},
|
|
"plan": {
|
|
"name": "free",
|
|
"publisher": "Sendgrid",
|
|
"product": "sendgrid_azure",
|
|
"promotionCode": ""
|
|
},
|
|
"properties": {
|
|
"password": "[parameters('administratorLoginPassword')]",
|
|
"acceptMarketingEmails": "0",
|
|
"email": ""
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts",
|
|
"apiVersion": "2016-01-01",
|
|
"name": "[variables('uniqueStorageName')]",
|
|
"location": "[parameters('location')]",
|
|
"sku": {
|
|
"name": "[parameters('storageType')]"
|
|
},
|
|
"tags": {
|
|
"displayName": "BackingStorage"
|
|
},
|
|
"kind": "Storage"
|
|
},
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts/blobServices",
|
|
"apiVersion": "2021-09-01",
|
|
"name": "[format('{0}/{1}', variables('uniqueStorageName'), 'default')]",
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Storage/storageAccounts', variables('uniqueStorageName'))]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
|
|
"apiVersion": "2021-09-01",
|
|
"name": "[format('{0}/{1}/{2}', variables('uniqueStorageName'), 'default', parameters('storageContainerName'))]",
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', variables('uniqueStorageName'), 'default')]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Web/serverfarms",
|
|
"apiVersion": "2016-09-01",
|
|
"name": "[variables('hostingPlanNameCleaned')]",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"displayName": "HostingPlan"
|
|
},
|
|
"sku": {
|
|
"name": "[parameters('skuName')]",
|
|
"capacity": "[parameters('skuCapacity')]"
|
|
},
|
|
"kind": "linux",
|
|
"properties": {
|
|
"name": "[variables('hostingPlanNameCleaned')]",
|
|
"reserved": true
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Web/sites",
|
|
"apiVersion": "2016-08-01",
|
|
"name": "[variables('uniqueWebSiteName')]",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"displayName": "WebApp"
|
|
},
|
|
"properties": {
|
|
"name": "[variables('uniqueWebSiteName')]",
|
|
"serverFarmId": "[variables('hostingPlanNameCleaned')]",
|
|
"siteConfig": {
|
|
"linuxFxVersion": "[parameters('linuxFxVersion')]",
|
|
"alwaysOn": true,
|
|
"connectionStrings": [
|
|
{
|
|
"name": "defaultConnection",
|
|
"connectionString": "[format('Database={0};Data Source={1}.mysql.database.azure.com;User Id={2}@{3};Password={4}', variables('databaseName'), variables('uniqueServerName'), parameters('administratorLogin'), variables('uniqueServerName'), parameters('administratorLoginPassword'))]",
|
|
"type": "MySql"
|
|
}
|
|
],
|
|
"appCommandLine": "/home/startup.sh",
|
|
"appSettings": [
|
|
{
|
|
"name": "StorageContainerName",
|
|
"value": "[parameters('storageContainerName')]"
|
|
},
|
|
{
|
|
"name": "StorageAccount",
|
|
"value": "[variables('uniqueStorageName')]"
|
|
},
|
|
{
|
|
"name": "StorageKey",
|
|
"value": "[concat(listKeys(variables('storageAccountId'), '2015-05-01-preview').key1)]"
|
|
},
|
|
{
|
|
"name": "redcapAppZip",
|
|
"value": "[parameters('redcapAppZip')]"
|
|
},
|
|
{
|
|
"name": "redcapCommunityUsername",
|
|
"value": "[parameters('redcapCommunityUsername')]"
|
|
},
|
|
{
|
|
"name": "redcapCommunityPassword",
|
|
"value": "[parameters('redcapCommunityPassword')]"
|
|
},
|
|
{
|
|
"name": "redcapAppZipVersion",
|
|
"value": "[parameters('redcapAppZipVersion')]"
|
|
},
|
|
{
|
|
"name": "DBHostName",
|
|
"value": "[format('{0}.mysql.database.azure.com', variables('uniqueServerName'))]"
|
|
},
|
|
{
|
|
"name": "DBName",
|
|
"value": "[variables('databaseName')]"
|
|
},
|
|
{
|
|
"name": "DBUserName",
|
|
"value": "[format('{0}@{1}', parameters('administratorLogin'), variables('uniqueServerName'))]"
|
|
},
|
|
{
|
|
"name": "DBPassword",
|
|
"value": "[parameters('administratorLoginPassword')]"
|
|
},
|
|
{
|
|
"name": "DBSslCa",
|
|
"value": "/home/site/wwwroot/DigiCertGlobalRootCA.crt.pem"
|
|
},
|
|
{
|
|
"name": "PHP_INI_SCAN_DIR",
|
|
"value": "/usr/local/etc/php/conf.d:/home/site"
|
|
},
|
|
{
|
|
"name": "from_email_address",
|
|
"value": "[parameters('fromEmailAddress')]"
|
|
},
|
|
{
|
|
"name": "smtp_fqdn_name",
|
|
"value": "[reference(resourceId('Sendgrid.Email/accounts', variables('uniqueSendgridAccountName')), '2015-01-01').smtpServer]"
|
|
},
|
|
{
|
|
"name": "smtp_port",
|
|
"value": "587"
|
|
},
|
|
{
|
|
"name": "smtp_user_name",
|
|
"value": "[reference(resourceId('Sendgrid.Email/accounts', variables('uniqueSendgridAccountName')), '2015-01-01').username]"
|
|
},
|
|
{
|
|
"name": "smtp_password",
|
|
"value": "[parameters('administratorLoginPassword')]"
|
|
},
|
|
{
|
|
"name": "SCM_DO_BUILD_DURING_DEPLOYMENT",
|
|
"value": "1"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanNameCleaned'))]",
|
|
"[resourceId('Sendgrid.Email/accounts', variables('uniqueSendgridAccountName'))]",
|
|
"[resourceId('Microsoft.Storage/storageAccounts', variables('uniqueStorageName'))]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Web/sites/sourcecontrols",
|
|
"apiVersion": "2015-08-01",
|
|
"name": "[format('{0}/{1}', variables('uniqueWebSiteName'), 'web')]",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"displayName": "CodeDeploy"
|
|
},
|
|
"properties": {
|
|
"repoUrl": "[parameters('repoURL')]",
|
|
"branch": "[parameters('branch')]",
|
|
"isManualIntegration": true
|
|
},
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.DBforMySQL/flexibleServers', variables('uniqueServerName'))]",
|
|
"[resourceId('Microsoft.Web/sites', variables('uniqueWebSiteName'))]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.DBforMySQL/flexibleServers",
|
|
"apiVersion": "2021-12-01-preview",
|
|
"name": "[variables('uniqueServerName')]",
|
|
"location": "[parameters('location')]",
|
|
"tags": {
|
|
"displayName": "MySQLAzure"
|
|
},
|
|
"properties": {
|
|
"version": "[parameters('mysqlVersion')]",
|
|
"administratorLogin": "[parameters('administratorLogin')]",
|
|
"administratorLoginPassword": "[parameters('administratorLoginPassword')]",
|
|
"storage": {
|
|
"storageSizeGB": "[parameters('databaseStorageSizeGB')]",
|
|
"iops": "[parameters('databaseStorageIops')]",
|
|
"autoGrow": "[parameters('databaseStorageAutoGrow')]",
|
|
"autoIoScaling": "[parameters('databseStorageAutoIoScaling')]"
|
|
},
|
|
"backup": {
|
|
"backupRetentionDays": 7,
|
|
"geoRedundantBackup": "Disabled"
|
|
},
|
|
"highAvailability": {
|
|
"mode": "Disabled"
|
|
},
|
|
"replicationRole": "None"
|
|
},
|
|
"sku": {
|
|
"name": "Standard_B1ms",
|
|
"tier": "Burstable"
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.DBforMySQL/flexibleServers/firewallRules",
|
|
"apiVersion": "2021-12-01-preview",
|
|
"name": "[format('{0}/{1}', variables('uniqueServerName'), 'AllowAzureIPs')]",
|
|
"properties": {
|
|
"startIpAddress": "0.0.0.0",
|
|
"endIpAddress": "0.0.0.0"
|
|
},
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.DBforMySQL/flexibleServers', variables('uniqueServerName'))]",
|
|
"[resourceId('Microsoft.DBforMySQL/flexibleServers/databases', variables('uniqueServerName'), variables('databaseName'))]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.DBforMySQL/flexibleServers/databases",
|
|
"apiVersion": "2021-12-01-preview",
|
|
"name": "[format('{0}/{1}', variables('uniqueServerName'), variables('databaseName'))]",
|
|
"properties": {
|
|
"charset": "utf8",
|
|
"collation": "utf8_general_ci"
|
|
},
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.DBforMySQL/flexibleServers', variables('uniqueServerName'))]"
|
|
]
|
|
}
|
|
],
|
|
"outputs": {
|
|
"MySQLHostName": {
|
|
"type": "string",
|
|
"value": "[format('{0}.mysql.database.azure.com', variables('uniqueServerName'))]"
|
|
},
|
|
"MySqlUserName": {
|
|
"type": "string",
|
|
"value": "[format('{0}@{1}', parameters('administratorLogin'), variables('uniqueServerName'))]"
|
|
},
|
|
"webSiteFQDN": {
|
|
"type": "string",
|
|
"value": "[format('{0}.azurewebsites.net', variables('uniqueWebSiteName'))]"
|
|
},
|
|
"storageAccountName": {
|
|
"type": "string",
|
|
"value": "[variables('uniqueStorageName')]"
|
|
},
|
|
"storageContainerName": {
|
|
"type": "string",
|
|
"value": "[parameters('storageContainerName')]"
|
|
},
|
|
"SendGrid": {
|
|
"type": "object",
|
|
"value": "[reference(resourceId('Sendgrid.Email/accounts', variables('uniqueSendgridAccountName')), '2015-01-01')]"
|
|
}
|
|
}
|
|
} |