Created
January 2, 2019 09:31
-
-
Save PawelHaracz/f21ec7f3614ccb38348c85213c54ac82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"location": { | |
"type": "string", | |
"defaultValue": "[resourceGroup().location]" | |
}, | |
"registryPassword": { | |
"type": "SecureString" | |
}, | |
"registryUserName": { | |
"type": "string" | |
}, | |
"registryServer": { | |
"type": "string" | |
} | |
}, | |
"resources": [ | |
{ | |
"apiVersion": "2018-09-01-preview", | |
"name": "qbank-network-linux", | |
"type": "Microsoft.ServiceFabricMesh/networks", | |
"location": "[parameters('location')]", | |
"dependsOn": [], | |
"properties": { | |
"kind": "Local", | |
"description": "Service Fabric Mesh Network for QurstionsApi.", | |
"networkAddressPrefix": "10.128.0.0/16" | |
} | |
}, | |
{ | |
"apiVersion": "2018-09-01-preview", | |
"name": "qbank-linux", | |
"type": "Microsoft.ServiceFabricMesh/applications", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"Microsoft.ServiceFabricMesh/networks/qbank-network-linux" | |
], | |
"properties": { | |
"services": [ | |
{ | |
"name": "qbank-questions-service", | |
"properties": { | |
"description": "Qbank service", | |
"osType": "Linux", | |
"codePackages": [ | |
{ | |
"name": "QuestionsApi", | |
"image": "[concat(parameters('registryServer'),'/qbank.questions:59-beta')]", | |
"imageRegistryCredential": { | |
"server": "[parameters('registryServer')]", | |
"username": "[parameters('registryUserName')]", | |
"password": "[parameters('registryPassword')]" | |
}, | |
"endpoints": [ | |
{ | |
"name": "questions-api-listener", | |
"port": 80 | |
} | |
], | |
"resources": { | |
"requests": { | |
"cpu": 1, | |
"memoryInGB": 1 | |
} | |
}, | |
"environmentVariables": [], | |
"autoScalingPolicies": [ | |
{ | |
"name": "Questions-AutoScale-CPU-WorkerRule", | |
"trigger": { | |
"kind": "AverageLoad", | |
"metric": { | |
"kind": "Resource", | |
"name": "cpu" | |
}, | |
"lowerLoadThreshold": "0.2", | |
"upperLoadThreshold": "0.8", | |
"scaleIntervalInSeconds": "60" | |
}, | |
"mechanism": { | |
"kind": "AddRemoveReplica", | |
"minCount": "1", | |
"maxCount": "40", | |
"scaleIncrement": "1" | |
} | |
}, | |
{ | |
"name": "Questions-AutoScale-Memory-WorkerRule", | |
"trigger": { | |
"kind": "AverageLoad", | |
"metric": { | |
"kind": "Resource", | |
"name": "memoryInGB" | |
}, | |
"lowerLoadThreshold": "0.2", | |
"upperLoadThreshold": "0.8", | |
"scaleIntervalInSeconds": "60" | |
}, | |
"mechanism": { | |
"kind": "AddRemoveReplica", | |
"minCount": "1", | |
"maxCount": "40", | |
"scaleIncrement": "1" | |
} | |
} | |
] | |
} | |
], | |
"replicaCount": 1, | |
"networkRefs": [ | |
{ | |
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'qbank-network-linux')]", | |
"endpointRefs": [ | |
{ | |
"name": "questions-api-listener" | |
} | |
] | |
} | |
] | |
} | |
} | |
] | |
} | |
}, | |
{ | |
"apiVersion": "2018-09-01-preview", | |
"name": "QbankGateway", | |
"type": "Microsoft.ServiceFabricMesh/gateways", | |
"location": "[parameters('location')]", | |
"dependsOn": [ | |
"Microsoft.ServiceFabricMesh/networks/qbank-network-linux" | |
], | |
"properties": { | |
"description": "Service Fabric Mesh Gateway for Qbank.", | |
"sourceNetwork": { | |
"name": "Open" | |
}, | |
"destinationNetwork": { | |
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'qbank-network-linux')]" | |
}, | |
"tcp": [ | |
{ | |
"name": "web", | |
"port": 80, | |
"destination": { | |
"applicationName": "qbank-linux", | |
"serviceName": "qbank-questions-service", | |
"endpointName": "questions-api-listener" | |
} | |
} | |
] | |
} | |
} | |
], | |
"outputs": { | |
"publicIPAddress": { | |
"value": "[reference('QbankGateway').ipAddress]", | |
"type": "string" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment