From f4aa4aeff913a4e3bd2a636cc869f0c5c65d26f2 Mon Sep 17 00:00:00 2001 From: Maxwell Weru Date: Mon, 13 May 2024 10:39:29 +0300 Subject: [PATCH] Fix bicep compile issue --- server/main.bicep | 18 +++++++----------- server/main.json | 36 +++++++++++++++++++----------------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/server/main.bicep b/server/main.bicep index c20b647b..8409aa60 100644 --- a/server/main.bicep +++ b/server/main.bicep @@ -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 @@ -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 } }] } @@ -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' } } }] diff --git a/server/main.json b/server/main.json index 6e60946c..3babaf67 100644 --- a/server/main.json +++ b/server/main.json @@ -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)]", @@ -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'))]" @@ -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": [ @@ -553,6 +545,16 @@ "memory": "0.5Gi" }, "probes": [ + { + "type": "Startup", + "httpGet": { + "port": 8080, + "path": "/liveness" + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 100, + "failureThreshold": 10 + }, { "type": "Liveness", "httpGet": {