Skip to content

Instantly share code, notes, and snippets.

@anthonychu
Last active July 18, 2018 17:00
Show Gist options
  • Save anthonychu/01f84d2d483588060f5af748e3e904da to your computer and use it in GitHub Desktop.
Save anthonychu/01f84d2d483588060f5af748e3e904da to your computer and use it in GitHub Desktop.
Service Fabric Mesh TensorFlow Fruit Deployment
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "eastus",
"metadata": {
"description": "Location of the resources."
}
},
"workerReplicas": {
"type": "int",
"defaultValue": 1
},
"webImage": {
"type": "string",
"defaultValue": "anthonychu/imageclassifierweb:0.7"
},
"workerImage": {
"type": "string",
"defaultValue": "anthonychu/imageclassifierworker:0.4"
}
},
"resources": [
{
"apiVersion": "2018-07-01-preview",
"name": "ImageClassifier",
"type": "Microsoft.ServiceFabricMesh/applications",
"location": "[parameters('location')]",
"dependsOn": [
],
"properties": {
"description": "Image Classifier App",
"services": [
{
"name": "ImageClassifierWeb",
"properties": {
"description": "Image Classifier Web service",
"osType": "linux",
"codePackages": [
{
"name": "ImageClassifierWeb.Code",
"image": "[parameters('webImage')]",
"endpoints": [
{
"name": "Endpoint1",
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1
}
}
}
],
"replicaCount": 1,
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'ImageClassifierNetwork')]"
}
]
}
},
{
"name": "ImageClassifierWorker",
"properties": {
"description": "Image Classifier Worker service",
"osType": "linux",
"codePackages": [
{
"name": "ImageClassifierWorker.Code",
"image": "[parameters('workerImage')]",
"volumeRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/volumes', 'fruitshare')]",
"destinationPath": "/app/assets/images"
}
],
"environmentVariables": [
{
"name": "API_BASE_URL",
"value": "http://ImageClassifierWeb"
}
],
"resources": {
"requests": {
"cpu": 0.5,
"memoryInGB": 0.5
}
}
}
],
"replicaCount": "[parameters('workerReplicas')]",
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'ImageClassifierNetwork')]"
}
]
}
}
]
}
}
]
}
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "eastus",
"metadata": {
"description": "Location of the resources."
}
},
"workerReplicas": {
"type": "int",
"defaultValue": 3
},
"webImage": {
"type": "string",
"defaultValue": "anthonychu/imageclassifierweb:0.7"
},
"workerImage": {
"type": "string",
"defaultValue": "anthonychu/imageclassifierworker:0.4"
}
},
"resources": [
{
"apiVersion": "2018-07-01-preview",
"name": "ImageClassifier",
"type": "Microsoft.ServiceFabricMesh/applications",
"location": "[parameters('location')]",
"dependsOn": [
],
"properties": {
"description": "Image Classifier App",
"services": [
{
"name": "ImageClassifierWeb",
"properties": {
"description": "Image Classifier Web service",
"osType": "linux",
"codePackages": [
{
"name": "ImageClassifierWeb.Code",
"image": "[parameters('webImage')]",
"endpoints": [
{
"name": "Endpoint1",
"port": 80
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1
}
}
}
],
"replicaCount": 1,
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'ImageClassifierNetwork')]"
}
]
}
},
{
"name": "ImageClassifierWorker",
"properties": {
"description": "Image Classifier Worker service",
"osType": "linux",
"codePackages": [
{
"name": "ImageClassifierWorker.Code",
"image": "[parameters('workerImage')]",
"volumeRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/volumes', 'fruitshare')]",
"destinationPath": "/app/assets/images"
}
],
"environmentVariables": [
{
"name": "API_BASE_URL",
"value": "http://ImageClassifierWeb"
}
],
"resources": {
"requests": {
"cpu": 0.5,
"memoryInGB": 0.5
}
}
}
],
"replicaCount": "[parameters('workerReplicas')]",
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'ImageClassifierNetwork')]"
}
]
}
}
]
}
}
]
}
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "eastus",
"metadata": {
"description": "Location of the resources."
}
},
"shareName": {
"type": "string",
"defaultValue": "fruit"
},
"accountName": {
"type": "string",
"defaultValue": ""
},
"accountKey": {
"type": "securestring",
"defaultValue": ""
}
},
"resources": [
{
"apiVersion": "2018-07-01-preview",
"name": "fruitshare",
"type": "Microsoft.ServiceFabricMesh/volumes",
"location": "[parameters('location')]",
"properties": {
"description": "File share backed by Azure Files storage.",
"provider": "SFAzureFile",
"azureFileParameters": {
"shareName": "[parameters('shareName')]",
"accountName": "[parameters('accountName')]",
"accountKey": "[parameters('accountKey')]"
}
}
},
{
"apiVersion": "2018-07-01-preview",
"name": "ImageClassifierNetwork",
"type": "Microsoft.ServiceFabricMesh/networks",
"location": "[parameters('location')]",
"dependsOn": [],
"properties": {
"description": "Private network for application",
"addressPrefix": "10.0.0.4/22",
"ingressConfig": {
"qosLevel": "bronze",
"layer4": [
{
"publicPort": "80",
"applicationName": "ImageClassifier",
"serviceName": "ImageClassifierWeb",
"endpointName": "Endpoint1"
}
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment