Skip to content

Instantly share code, notes, and snippets.

@markheath
Created October 24, 2018 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markheath/c8002ad95d35676b9b233c1cf3c5c831 to your computer and use it in GitHub Desktop.
Save markheath/c8002ad95d35676b9b233c1cf3c5c831 to your computer and use it in GitHub Desktop.
Service Fabric Mesh voting app.
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"voteReplicaCount":{
"defaultValue": "1",
"type": "string",
"metadata": {
"description": "The number of service replicas for the vote service."
}
},
"resultReplicaCount":{
"defaultValue": "1",
"type": "string",
"metadata": {
"description": "The number of service replicas for the result service."
}
},
"workerReplicaCount":{
"defaultValue": "1",
"type": "string",
"metadata": {
"description": "The number of service replicas for the worker service."
}
}
},
"resources": [
{
"apiVersion": "2018-07-01-preview",
"name": "votingApp",
"type": "Microsoft.ServiceFabricMesh/applications",
"location": "[resourceGroup().location]",
"dependsOn": [
"Microsoft.ServiceFabricMesh/networks/votingNetwork"
],
"properties": {
"services": [
{
"name": "vote",
"properties": {
"description": "vote service",
"osType": "Windows",
"codePackages": [
{
"name": "vote",
"image": "dockersamples/examplevotingapp_vote:dotnet-nanoserver",
"endpoints": [
{
"name": "VoteListener",
"port": 80
}
],
"environmentVariables": [
],
"resources": {
"requests": {
"cpu": "0.5",
"memoryInGB": "1"
}
}
}
],
"replicaCount": "[parameters('voteReplicaCount')]",
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'votingNetwork')]"
}
]
}
},
{
"name": "result",
"properties": {
"description": "result service.",
"osType": "Windows",
"codePackages": [
{
"name": "result",
"image": "dockersamples/examplevotingapp_result:dotnet-nanoserver",
"endpoints": [
{
"name": "ResultListener",
"port": 20002
}
],
"environmentVariables": [
{
"name": "ConnectionStrings:ResultData",
"value": "Server=db;Port=4000;Database=votes;User=root;SslMode=None"
},
{
"name": "ASPNETCORE_URLS",
"value": "http://+:20002"
}
],
"resources": {
"requests": {
"cpu": "0.5",
"memoryInGB": "1"
}
}
}
],
"replicaCount": "[parameters('resultReplicaCount')]",
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'votingNetwork')]"
}
]
}
},
{
"name": "worker",
"properties": {
"description": "worker service.",
"osType": "Windows",
"codePackages": [
{
"name": "worker",
"image": "dockersamples/examplevotingapp_worker:dotnet-nanoserver",
"endpoints": [
],
"environmentVariables": [
{
"name": "ConnectionStrings:VoteData",
"value": "Server=db;Port=4000;Database=votes;User=root;SslMode=None"
}
],
"resources": {
"requests": {
"cpu": "0.5",
"memoryInGB": "1"
}
}
}
],
"replicaCount": "[parameters('workerReplicaCount')]",
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'votingNetwork')]"
}
]
}
},
{
"name": "message-queue",
"properties": {
"description": "message-queue service.",
"osType": "Windows",
"codePackages": [
{
"name": "message-queue",
"image": "registry.hub.docker.com/library/nats:nanoserver",
"endpoints": [
{
"name": "MessageQueueListener",
"port": 4222
}
],
"environmentVariables": [
],
"resources": {
"requests": {
"cpu": "0.5",
"memoryInGB": "1"
}
}
}
],
"replicaCount": "1",
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'votingNetwork')]"
}
]
}
},
{
"name": "db",
"properties": {
"description": "db service.",
"osType": "Windows",
"codePackages": [
{
"name": "tidb",
"image": "dockersamples/tidb:nanoserver",
"endpoints": [
{
"name": "DbListener",
"port": 4000
}
],
"environmentVariables": [
],
"resources": {
"requests": {
"cpu": "0.5",
"memoryInGB": "1"
}
}
}
],
"replicaCount": "1",
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'votingNetwork')]"
}
]
}
}
],
"description": "Sample voting app. https://github.com/sixeyed/example-voting-app"
}
},
{
"apiVersion": "2018-07-01-preview",
"name": "votingNetwork",
"type": "Microsoft.ServiceFabricMesh/networks",
"location": "[resourceGroup().location]",
"dependsOn": [],
"properties": {
"description": "votingNetwork description.",
"addressPrefix": "10.0.0.4/22",
"ingressConfig": {
"layer4": [
{
"name": "VoteIngress",
"publicPort": "8081",
"applicationName": "votingApp",
"serviceName": "vote",
"endpointName": "VoteListener"
},
{
"name": "ResultIngress",
"publicPort": "8082",
"applicationName": "votingApp",
"serviceName": "result",
"endpointName": "ResultListener"
}
]
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment