Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Upd network resource name and cli outputs #53

Open
wants to merge 33 commits into
base: 2018-09-01-preview
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c1c473f
change the API version to 2018-09-01-preview
vipul-modi Sep 19, 2018
9f9ff83
Use secret resource for the ACR password. The ACR server name should …
vipul-modi Sep 20, 2018
5237849
add description and windows file for private registry
vipul-modi Sep 20, 2018
b36acb5
counter with service fabric volume driver
vipul-modi Sep 21, 2018
03ed157
Add SF Volume Disk Counter Sample and template
Sep 21, 2018
9758a5c
Add linux sfmesh counter sf block store app
ashishnegi Sep 22, 2018
4b118da
Merge pull request #27 from ashishnegi/prv-preview/sfblkstore/linux
Oct 8, 2018
8981db5
Merge pull request #26 from wangcai0124/SFVolDiskCounterSample-2018-0…
Oct 8, 2018
62bc69a
Updating for new gateway, network and secret resources
vipul-modi Oct 25, 2018
ab8af8d
fix the network specification
vipul-modi Oct 26, 2018
1622b8f
Output the public IP address
vipul-modi Oct 29, 2018
60abaea
updated linux templates
jeffj6123 Oct 30, 2018
fe34acb
initial readme for helloworld
Oct 31, 2018
70a2544
Merge branch '2018-09-01-preview' of https://github.com/Azure-Samples…
Oct 31, 2018
2777b71
Merge pull request #34 from jeffj6123/2018-09-01-preview
Nov 1, 2018
5d9a15f
rename the templates
vipul-modi Nov 1, 2018
b1f7ab0
private registry scenario documentation and template files
vipul-modi Nov 1, 2018
2583f61
updating the instructions.
vipul-modi Nov 2, 2018
91502f9
minor edits
vipul-modi Nov 5, 2018
325cf37
Jejarry/windowsvisualobject (#37)
jeffj6123 Nov 6, 2018
92a7474
Mesh ingress gateway sample template (#36)
kavyako Nov 7, 2018
00ea6ff
2018 09 01 preview (#40)
mattrowmsft Nov 7, 2018
0f416fb
added the stateful one (#41)
jeffj6123 Nov 7, 2018
fe059f8
Service Fabric Reliable volume templates for counter application
Nov 7, 2018
f4081f2
Service Fabric Reliable Volume the counter templates are checked in i…
Nov 7, 2018
53780f5
Fixed linux visualObjects network address Prefixes (#42)
jeffj6123 Nov 9, 2018
5ff6994
Fix os type mismatch in counter windows sample (#43)
wangcai0124 Nov 9, 2018
1eff07f
Flush data to disk in counter app and remove duplicate code (#48)
ashishnegi Nov 20, 2018
e8adc63
Update counter template link at README.md (#47)
wangcai0124 Nov 20, 2018
34d0b65
Copy doc from MicrosoftDocs/azure-docs to Azure-Samples
Nov 21, 2018
9d866f8
Merge pull request #51 from wangcai0124/2018-09-01-preview
dkkapur Nov 26, 2018
1950ffe
readme for visual objects
Nov 26, 2018
1707e5f
Upd network resource name and cli outputs
athinanthny Nov 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/counter/src/counterService/Counter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Microsoft.ServiceFabricMesh.Samples.Counter.Service
using System;
using System.Globalization;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -103,7 +104,12 @@ private static void WriteCounterValue(string stateFilePath, long value)
{
try
{
File.WriteAllText(stateFilePath, value.ToString());
using (var file = new FileStream(stateFilePath, FileMode.OpenOrCreate, FileAccess.Write))
{
var bytes = Encoding.ASCII.GetBytes(value.ToString());
file.Write(bytes, 0, bytes.Length);
file.Flush();
}
}
catch(Exception e)
{
Expand Down
3 changes: 2 additions & 1 deletion templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This command will output all information about one network resource. To get the
|Sample|Scenario Description|Deploy to Azure - Linux|Deploy to Azure - Windows|
|------------|--------------------|-----------------------|-------------------------|
| [Hello World App](./helloworld) | Deploy a single container microservices application from public or private container registry and connect to the service endpoint. | <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fservice-fabric-mesh%2Fmaster%2Ftemplates%2Fhelloworld%2Fmesh_rp.linux.json" target="_blank"><img src="https://azuredeploy.net/deploybutton.png"/></a> | <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fservice-fabric-mesh%2Fmaster%2Ftemplates%2Fhelloworld%2Fmesh_rp.windows.json" target="_blank"><img src="https://azuredeploy.net/deploybutton.png"/></a> |
| [Counter App](./counter) | Store state by mounting Azure Files based volume inside the container. <br><br> **Note:** This template requires an Azure Files file share to already be provisioned [Instructions](https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-create-file-share) | <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fservice-fabric-mesh%2Fmaster%2Ftemplates%2Fcounter%2Fmesh_rp.linux.json" target="_blank"><img src="https://azuredeploy.net/deploybutton.png"/></a> | <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fservice-fabric-mesh%2Fmaster%2Ftemplates%2Fcounter%2Fmesh_rp.windows.json" target="_blank"><img src="https://azuredeploy.net/deploybutton.png"/></a> |
| [Counter App](./counter) | Store state by mounting Azure Files based volume inside the container. <br><br> **Note:** This template requires an Azure Files file share to already be provisioned [Instructions](https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-create-file-share) | <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fservice-fabric-mesh%2F2018-09-01-preview%2Ftemplates%2Fcounter%2Fcounter.azurefilesvolume.linux.json" target="_blank"><img src="https://azuredeploy.net/deploybutton.png"/></a> | <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fservice-fabric-mesh%2F2018-09-01-preview%2Ftemplates%2Fcounter%2Fcounter.azurefilesvolume.windows.json" target="_blank"><img src="https://azuredeploy.net/deploybutton.png"/></a> |
| [Counter App (Service Fabric VolumeDisk)](./counter) | Store state on Service Fabric Volume Disk based volume inside the container. | | <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fservice-fabric-mesh%2Fmaster%2Ftemplates%2FcounterSFVolumeDisk%2Fsfvd_mesh_rp.windows.json" target="_blank"><img src="https://azuredeploy.net/deploybutton.png"/></a> |
| [Voting App](./voting) | Create an application with a frontend and backend service that uses DNS-based resolution. | <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fservice-fabric-mesh%2Fmaster%2Ftemplates%2Fvoting%2Fmesh_rp.linux.json" target="_blank"><img src="https://azuredeploy.net/deploybutton.png"/></a> | <a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure-Samples%2Fservice-fabric-mesh%2Fmaster%2Ftemplates%2Fvoting%2Fmesh_rp.windows.json" target="_blank"><img src="https://azuredeploy.net/deploybutton.png"/></a> |
| [Visual Objects App](./visualobjects) | Scale and upgrade microservices within an application. | [Look here](./visualobjects/) | [Look here](./visualobjects/) |
192 changes: 192 additions & 0 deletions templates/counter/counter.azurefilesvolume.linux.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
"$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]",
"metadata": {
"description": "Location of the resources (e.g. westus, eastus, westeurope)."
}
},
"fileShareName": {
"type": "string",
"metadata": {
"description": "Name of the Azure Files file share that provides the volume for the container."
}
},
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Name of the Azure storage account that contains the file share."
}
},
"storageAccountKey": {
"type": "securestring",
"metadata": {
"description": "Access key for the Azure storage account that contains the file share."
}
},
"stateFolderName": {
"type": "string",
"defaultValue": "CounterService",
"metadata": {
"description": "Folder in which to store the state. Provide a empty value to create a unique folder for each container to store the state. A non-empty value will retain the state across deployments, however if more than one applications are using the same folder, the counter may update more frequently."
}
}
},
"resources": [
{
"apiVersion": "2018-09-01-preview",
"name": "counterAzureFileShareAccountKey",
"type": "Microsoft.ServiceFabricMesh/secrets",
"location": "[parameters('location')]",
"dependsOn": [],
"properties": {
"kind": "inlinedValue",
"contentType": "text/plain",
"description": "Access key for the Azure storage account that contains the file share."
}
},
{
"apiVersion": "2018-09-01-preview",
"name": "counterAzureFileShareAccountKey/v1",
"type": "Microsoft.ServiceFabricMesh/secrets/values",
"location": "[parameters('location')]",
"dependsOn": [
"Microsoft.ServiceFabricMesh/secrets/counterAzureFileShareAccountKey"
],
"properties": {
"value": "[parameters('storageAccountKey')]"
}
},
{
"apiVersion": "2018-09-01-preview",
"name": "counterVolume",
"type": "Microsoft.ServiceFabricMesh/volumes",
"location": "[parameters('location')]",
"dependsOn": [
"Microsoft.ServiceFabricMesh/secrets/counterAzureFileShareAccountKey/values/v1"
],
"properties": {
"description": "Azure Files storage volume for counter App.",
"provider": "SFAzureFile",
"azureFileParameters": {
"shareName": "[parameters('fileShareName')]",
"accountName": "[parameters('storageAccountName')]",
"accountKey": "[resourceId('Microsoft.ServiceFabricMesh/secrets/values','counterAzureFileShareAccountKey','v1')]"
}
}
},
{
"apiVersion": "2018-09-01-preview",
"name": "counterNetwork",
"type": "Microsoft.ServiceFabricMesh/networks",
"location": "[parameters('location')]",
"dependsOn": [],
"properties": {
"kind": "Local",
"description": "Azure Service Fabric Mesh Counter Application network.",
"networkAddressPrefix": "10.0.0.0/24"
}
},
{
"apiVersion": "2018-09-01-preview",
"name": "counterApp",
"type": "Microsoft.ServiceFabricMesh/applications",
"location": "[parameters('location')]",
"dependsOn": [
"Microsoft.ServiceFabricMesh/networks/counterNetwork",
"Microsoft.ServiceFabricMesh/volumes/counterVolume"
],
"properties": {
"description": "Azure Service Fabric Mesh Counter Application.",
"services": [
{
"name": "counterService",
"properties": {
"description": "A web service that serves the counter value stored in the Azure Files volume.",
"osType": "linux",
"codePackages": [
{
"name": "counterCode",
"image": "seabreeze/azure-mesh-counter:0.1-alpine",
"volumeRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/volumes', 'counterVolume')]",
"destinationPath": "/app/data"
}
],
"endpoints": [
{
"name": "counterServiceListener",
"port": 80
}
],
"environmentVariables": [
{
"name": "STATE_FOLDER_NAME",
"value": "[parameters('stateFolderName')]"
}
],
"resources": {
"requests": {
"cpu": 0.5,
"memoryInGB": 0.5
}
}
}
],
"replicaCount": 1,
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'counterNetwork')]",
"endpointRefs": [
{
"name": "counterServiceListener"
}
]
}
]
}
}
]
}
},
{
"apiVersion": "2018-09-01-preview",
"name": "counterGateway",
"type": "Microsoft.ServiceFabricMesh/gateways",
"location": "[parameters('location')]",
"dependsOn": [
"Microsoft.ServiceFabricMesh/networks/counterNetwork"
],
"properties": {
"description": "Service Fabric Mesh Gateway for counter sample.",
"sourceNetwork": {
"name": "Open"
},
"destinationNetwork": {
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'counterNetwork')]"
},
"tcp": [
{
"name": "web",
"port": 80,
"destination": {
"applicationName": "counterApp",
"serviceName": "counterService",
"endpointName": "counterServiceListener"
}
}
]
}
}
],
"outputs": {
"publicIPAddress": {
"value": "[reference('counterGateway').ipAddress]",
"type": "string"
}
}
}
Loading