Skip to content

Commit

Permalink
Fix bicep compile issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mburumaxwell committed May 13, 2024
1 parent 505ab4a commit f4aa4ae
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
18 changes: 7 additions & 11 deletions server/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ param githubToken string = ''
@description('Tag of the docker images.')
param imageTag string = '#{IMAGE_TAG}#'

var fileShares = [
{ name: 'certs' }
{ name: 'distributed-locks', writeable: true }
{ name: 'working-dir', writeable: true }
]
var fileShares = ['certs', 'distributed-locks', 'working-dir']

// dependabot is not available as of 2023-Sep-25 so we change just for the public deployment
var storageAccountName = replace(replace((name == 'dependabot' ? 'dependabotstore' : name), '-', ''), '_', '') // remove underscores and hyphens
Expand Down Expand Up @@ -133,13 +129,13 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
name: 'default'

resource shares 'shares' = [for fs in fileShares: {
name: fs.name
name: fs
properties: {
accessTier: contains(fs, 'accessTier') ? fs.accessTier : 'TransactionOptimized'
accessTier: 'TransactionOptimized'
// container apps does not support NFS
// https://github.com/microsoft/azure-container-apps/issues/717
// enabledProtocols: contains(fs, 'enabledProtocols') ? fs.enabledProtocols : 'SMB'
shareQuota: contains(fs, 'shareQuota') ? fs.shareQuota : 1
shareQuota: 1
}
}]
}
Expand Down Expand Up @@ -219,13 +215,13 @@ resource appEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' = {
}

resource storages 'storages' = [for fs in fileShares: {
name: fs.name
name: fs
properties: {
azureFile: {
accountName: storageAccount.name
accountKey: storageAccount.listKeys().keys[0].value
shareName: fs.name
accessMode: contains(fs, 'writeable') && bool(fs.writeable) ? 'ReadWrite' : 'ReadOnly'
shareName: fs
accessMode: 'ReadWrite'
}
}
}]
Expand Down
36 changes: 19 additions & 17 deletions server/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,9 @@
}
],
"fileShares": [
{
"name": "certs"
},
{
"name": "distributed-locks",
"writeable": true
},
{
"name": "working-dir",
"writeable": true
}
"certs",
"distributed-locks",
"working-dir"
],
"storageAccountName": "[replace(replace(if(equals(parameters('name'), 'dependabot'), 'dependabotstore', parameters('name')), '-', ''), '_', '')]",
"sqlServerAdministratorLogin": "[uniqueString(resourceGroup().id)]",
Expand Down Expand Up @@ -169,10 +161,10 @@
},
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"apiVersion": "2022-09-01",
"name": "[format('{0}/{1}/{2}', variables('storageAccountName'), 'default', variables('fileShares')[copyIndex()].name)]",
"name": "[format('{0}/{1}/{2}', variables('storageAccountName'), 'default', variables('fileShares')[copyIndex()])]",
"properties": {
"accessTier": "[if(contains(variables('fileShares')[copyIndex()], 'accessTier'), variables('fileShares')[copyIndex()].accessTier, 'TransactionOptimized')]",
"shareQuota": "[if(contains(variables('fileShares')[copyIndex()], 'shareQuota'), variables('fileShares')[copyIndex()].shareQuota, 1)]"
"accessTier": "TransactionOptimized",
"shareQuota": 1
},
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
Expand All @@ -185,13 +177,13 @@
},
"type": "Microsoft.App/managedEnvironments/storages",
"apiVersion": "2023-05-01",
"name": "[format('{0}/{1}', parameters('name'), variables('fileShares')[copyIndex()].name)]",
"name": "[format('{0}/{1}', parameters('name'), variables('fileShares')[copyIndex()])]",
"properties": {
"azureFile": {
"accountName": "[variables('storageAccountName')]",
"accountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2022-09-01').keys[0].value]",
"shareName": "[variables('fileShares')[copyIndex()].name]",
"accessMode": "[if(and(contains(variables('fileShares')[copyIndex()], 'writeable'), bool(variables('fileShares')[copyIndex()].writeable)), 'ReadWrite', 'ReadOnly')]"
"shareName": "[variables('fileShares')[copyIndex()]]",
"accessMode": "ReadWrite"
}
},
"dependsOn": [
Expand Down Expand Up @@ -553,6 +545,16 @@
"memory": "0.5Gi"
},
"probes": [
{
"type": "Startup",
"httpGet": {
"port": 8080,
"path": "/liveness"
},
"initialDelaySeconds": 10,
"timeoutSeconds": 100,
"failureThreshold": 10
},
{
"type": "Liveness",
"httpGet": {
Expand Down

0 comments on commit f4aa4ae

Please sign in to comment.