Skip to content

Instantly share code, notes, and snippets.

@torumakabe
Created November 16, 2021 03:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save torumakabe/f08a5a1c45d40290aca8350b824cdd3d to your computer and use it in GitHub Desktop.
Save torumakabe/f08a5a1c45d40290aca8350b824cdd3d to your computer and use it in GitHub Desktop.
Sample ARM template for Azure Container Apps (Cron with Dapr & KEDA)
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"defaultValue": "canadacentral",
"type": "String"
},
"environment_name": {
"defaultValue": "containerapps-env",
"type": "String"
}
},
"variables": {},
"resources": [
{
"name": "dapr-cron-handler-with-keda",
"type": "Microsoft.Web/containerApps",
"apiVersion": "2021-03-01",
"kind": "containerapp",
"location": "[parameters('location')]",
"properties": {
"kubeEnvironmentId": "[resourceId('Microsoft.Web/kubeEnvironments', parameters('environment_name'))]",
"configuration": {
},
"template": {
"containers": [
{
"image": "torumakabe/dapr-cron-handler:1.0.1",
"name": "dapr-cron-handler",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
},
"command": [
"/dapr-cron-handler",
"-w",
"60"
]
}
],
"scale": {
"minReplicas": 0,
"maxReplicas": 1,
"rules": [
{
"name": "cron",
"custom": {
"type": "cron",
"metadata": {
"timezone": "UTC",
"start": "50 * * * *",
"end": "10 * * * *",
"desiredReplicas": "1"
}
}
}
]
},
"dapr": {
"enabled": true,
"appPort": 8080,
"appId": "dapr-cron-handler-with-keda",
"components": [
{
"name": "cron",
"type": "bindings.cron",
"version": "v1",
"metadata": [
{
"name": "schedule",
"value": "0 0 * * * *"
}
]
}
]
}
}
}
}
]
}
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"defaultValue": "canadacentral",
"type": "String"
},
"environment_name": {
"defaultValue": "containerapps-env",
"type": "String"
}
},
"variables": {},
"resources": [
{
"name": "dapr-cron-handler",
"type": "Microsoft.Web/containerApps",
"apiVersion": "2021-03-01",
"kind": "containerapp",
"location": "[parameters('location')]",
"properties": {
"kubeEnvironmentId": "[resourceId('Microsoft.Web/kubeEnvironments', parameters('environment_name'))]",
"configuration": {
},
"template": {
"containers": [
{
"image": "torumakabe/dapr-cron-handler:1.0.1",
"name": "dapr-cron-handler",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
},
"command": [
"/dapr-cron-handler",
"-w",
"3"
]
}
],
"scale": {
"minReplicas": 1,
"maxReplicas": 1
},
"dapr": {
"enabled": true,
"appPort": 8080,
"appId": "dapr-cron-handler",
"components": [
{
"name": "cron",
"type": "bindings.cron",
"version": "v1",
"metadata": [
{
"name": "schedule",
"value": "0 0 * * * *"
}
]
}
]
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment