├── 1 ├── ops │ ├── entrypoint.sh │ └── Dockerfile ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── readme.md ├── run.sh ├── SiloHost │ ├── src │ │ └── SiloEndpointConfiguration.cs │ └── SiloHost.csproj └── .vscode │ ├── tasks.json │ └── launch.json ├── 2 ├── run-client-local.sh ├── run-silo-local.sh ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── SiloHost │ └── src │ │ └── SiloEndpointConfiguration.cs ├── Interfaces │ ├── src │ │ └── IHelloWorld.cs │ └── Interfaces.csproj ├── Grains │ ├── src │ │ └── HelloWorld.cs │ └── Grains.csproj ├── .vscode │ ├── tasks.json │ └── launch.json └── Client │ ├── Client.csproj │ └── src │ └── HelloWorldClientHostedService.cs ├── 3 ├── ops │ ├── Client │ │ ├── entrypoint.sh │ │ └── Dockerfile │ └── SiloHost │ │ ├── entrypoint.sh │ │ └── Dockerfile ├── run-client-local.sh ├── run-silo-local.sh ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── SiloHost │ └── src │ │ └── SiloEndpointConfiguration.cs ├── Interfaces │ ├── src │ │ └── IHelloWorld.cs │ └── Interfaces.csproj ├── Grains │ ├── src │ │ └── HelloWorld.cs │ └── Grains.csproj ├── .dockerignore ├── run-client-docker.sh ├── run-silo-docker.sh ├── .vscode │ ├── tasks.json │ └── launch.json └── Client │ ├── Client.csproj │ └── src │ └── HelloWorldClientHostedService.cs ├── 4 ├── ops │ ├── Client │ │ ├── entrypoint.sh │ │ └── Dockerfile │ ├── SiloHost │ │ ├── entrypoint.sh │ │ └── Dockerfile │ └── Convenience │ │ ├── run-silo-2-local.sh │ │ ├── run-demo-client-docker.sh │ │ ├── run-silo-1-docker.sh │ │ └── run-silo-3-docker.sh ├── imgs │ └── cluster.png ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── run-demo-cluster.sh ├── SiloHost │ └── src │ │ └── SiloEndpointConfiguration.cs ├── stop-demo.sh ├── Interfaces │ ├── src │ │ └── IHelloWorld.cs │ └── Interfaces.csproj ├── run-client-local.sh ├── run-demo-clients.sh ├── Grains │ ├── src │ │ └── HelloWorld.cs │ └── Grains.csproj ├── run-client-docker.sh ├── run-silo-local.sh ├── .dockerignore ├── .vscode │ └── tasks.json ├── run-silo-docker.sh └── Client │ └── Client.csproj ├── 5 ├── ops │ ├── Client │ │ ├── entrypoint.sh │ │ └── Dockerfile │ ├── SiloHost │ │ ├── entrypoint.sh │ │ └── Dockerfile │ └── Convenience │ │ ├── run-silo-2-local.sh │ │ ├── run-demo-client-docker.sh │ │ ├── run-silo-1-docker.sh │ │ └── run-silo-3-docker.sh ├── UnitTests │ └── src │ │ └── UnitTests │ │ ├── Program.fs │ │ └── Tests.fs ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── run-demo-cluster.sh ├── SiloHost │ └── src │ │ └── SiloEndpointConfiguration.cs ├── stop-demo.sh ├── Interfaces │ ├── src │ │ └── IHelloWorld.cs │ └── Interfaces.csproj ├── run-client-local.sh ├── Library │ ├── Library.fsproj │ └── Library.fs ├── run-demo-clients.sh ├── Grains │ ├── src │ │ └── HelloWorld.cs │ └── Grains.csproj ├── run-silo-local.sh ├── .dockerignore ├── run-client-docker.sh ├── run-silo-docker.sh └── Client │ └── Client.csproj ├── 6 ├── ops │ ├── SiloHost │ │ ├── entrypoint.sh │ │ └── Dockerfile │ ├── Vegeta │ │ ├── Dockerfile │ │ └── vegeta.sh │ ├── Convenience │ │ ├── run-silo-2-local.sh │ │ ├── run-silo-1-docker.sh │ │ └── run-silo-3-docker.sh │ └── Api │ │ └── Dockerfile ├── run-demo-client.sh ├── UnitTests │ └── src │ │ └── UnitTests │ │ ├── Program.fs │ │ └── Tests.fs ├── imgs │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ └── 5.png ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── run-demo-load-test.sh ├── run-demo-cluster.sh ├── SiloHost │ └── src │ │ └── SiloEndpointConfiguration.cs ├── stop-demo.sh ├── run-client-local.sh ├── Api │ ├── src │ │ ├── appsettings.json │ │ └── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── Api.csproj ├── Library │ ├── Library.fsproj │ └── Library.fs ├── Interfaces │ ├── src │ │ └── IHelloWorld.cs │ └── Interfaces.csproj ├── run-silo-local.sh ├── .dockerignore ├── run-client-docker.sh ├── Grains │ ├── src │ │ └── HelloWorld.cs │ └── Grains.csproj └── run-silo-docker.sh ├── 7 ├── ops │ ├── SiloHost │ │ ├── entrypoint.sh │ │ └── Dockerfile │ ├── Vegeta │ │ ├── Dockerfile │ │ └── vegeta.sh │ ├── Convenience │ │ ├── run-silo-2-local.sh │ │ ├── run-silo-1-docker.sh │ │ └── run-silo-3-docker.sh │ └── Api │ │ └── Dockerfile ├── run-demo-client.sh ├── Library.UnitTests │ ├── Program.fs │ └── Tests.fs ├── imgs │ ├── 1.png │ └── 2.png ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── run-demo-load-test.sh ├── run-demo-cluster.sh ├── SiloHost │ ├── src │ │ └── SiloEndpointConfiguration.cs │ └── appsettings.json ├── stop-demo.sh ├── run-client-local.sh ├── Api │ ├── src │ │ ├── appsettings.json │ │ └── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── Api.csproj ├── Library │ ├── Library.fsproj │ └── Library.fs ├── Interfaces │ ├── src │ │ └── IHelloWorld.cs │ └── Interfaces.csproj ├── run-silo-local.sh ├── .dockerignore ├── run-client-docker.sh ├── run-silo-docker.sh └── Grains │ ├── Grains.csproj │ └── src │ └── HelloWorld.cs ├── 8 ├── ops │ ├── SiloHost │ │ ├── entrypoint.sh │ │ └── Dockerfile │ ├── Vegeta │ │ ├── Dockerfile │ │ └── vegeta.sh │ └── Api │ │ └── Dockerfile ├── run-demo-client.ps1 ├── run-demo-client.sh ├── Library.UnitTests │ ├── Program.fs │ └── Tests.fs ├── imgs │ ├── 1.png │ ├── 2.png │ └── 3.png ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── run-demo-load-test.ps1 ├── run-demo-load-test.sh ├── run-demo-cluster.ps1 ├── run-demo-cluster.sh ├── stop-demo.sh ├── stop-demo.ps1 ├── run-client-local.ps1 ├── Api │ ├── src │ │ ├── appsettings.json │ │ ├── OrleansSettings.cs │ │ └── Program.cs │ ├── Properties │ │ └── launchSettings.json │ └── Api.csproj ├── Library │ ├── Library.fsproj │ └── Library.fs ├── Interfaces │ ├── src │ │ └── IHelloWorld.cs │ └── Interfaces.csproj ├── SiloHost │ ├── src │ │ └── EcsMetadata.cs │ ├── appsettings.json │ └── Properties │ │ └── launchSettings.json ├── run-client-local.sh ├── Grains │ ├── Grains.csproj │ └── src │ │ └── HelloWorld.cs └── run-silo-local.sh ├── 1a ├── ops │ ├── entrypoint.sh │ └── Dockerfile ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── .vscode │ ├── tasks.json │ └── launch.json ├── run-silo-local.sh ├── Grains │ ├── Grains.fsproj │ └── src │ │ └── Library.fs ├── run-silo-docker.sh ├── readme.md └── SiloHost │ └── src │ └── Controllers │ └── DummyTestsController.fs ├── 1b ├── ops │ ├── entrypoint.sh │ └── Dockerfile ├── run-silo-local.sh ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── run-silo-docker.sh ├── .vscode │ ├── tasks.json │ └── launch.json ├── Grains │ ├── Grains.fsproj │ └── src │ │ ├── GrainActivatorHostedService.fs │ │ └── Library.fs ├── SiloHost │ ├── src │ │ └── Program.cs │ └── SiloHost.csproj └── readme.md ├── 1c ├── ops │ ├── entrypoint.sh │ └── Dockerfile ├── run-silo-local.sh ├── global.json ├── run-silo-docker.sh ├── .vscode │ ├── tasks.json │ └── launch.json ├── readme.md ├── Grains │ ├── src │ │ ├── YourGrainServiceClient.fs │ │ ├── GrainActivatorHostedService.fs │ │ ├── YourGrainService.fs │ │ └── Library.fs │ └── Grains.fsproj └── SiloHost │ ├── SiloHost.csproj │ └── src │ └── Program.cs ├── new-solution.sh ├── 3a ├── ops │ ├── Client │ │ ├── entrypoint.sh │ │ └── Dockerfile │ └── SiloHost │ │ ├── entrypoint.sh │ │ └── Dockerfile ├── img │ ├── 1.png │ └── 2.png ├── run-client-local.sh ├── run-silo-local.sh ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── SiloHost │ └── src │ │ └── SiloEndpointConfiguration.cs ├── Grains │ ├── src │ │ ├── HelloWorldState.cs │ │ └── HelloWorld.cs │ └── Grains.csproj ├── Interfaces │ ├── src │ │ └── IHelloWorld.cs │ └── Interfaces.csproj ├── run-client-docker.sh ├── run-silo-docker.sh ├── .vscode │ ├── tasks.json │ └── launch.json └── Client │ ├── Client.csproj │ └── src │ └── HelloWorldClientHostedService.cs ├── 3b ├── ops │ ├── Client │ │ ├── entrypoint.sh │ │ └── Dockerfile │ └── SiloHost │ │ └── entrypoint.sh ├── run-client-local.sh ├── run-silo-local.sh ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── img │ ├── tagged-metric.png │ ├── filtered-metrics.png │ ├── metrics-summary.png │ ├── docker-compose-output.png │ ├── Runtime.CpuUsage.Current.png │ ├── App.Requests.TimedOut.Current.png │ ├── Grain.Grains.HelloWorld.Current.png │ ├── App.Requests.Total.Requests.Current.png │ ├── Runtime.Memory.AvailableMemoryMb.Current.png │ └── App.Requests.Latency.Average.Millis.Current.png ├── SiloHost │ └── src │ │ └── SiloEndpointConfiguration.cs ├── Interfaces │ ├── src │ │ └── IHelloWorld.cs │ └── Interfaces.csproj ├── Grains │ ├── src │ │ └── HelloWorld.cs │ └── Grains.csproj ├── .dockerignore ├── run-client-docker.sh ├── .vscode │ ├── tasks.json │ └── launch.json ├── Client │ ├── Client.csproj │ └── src │ │ └── HelloWorldClientHostedService.cs └── run-silo-docker.sh ├── 3c ├── ops │ ├── Client │ │ ├── entrypoint.sh │ │ └── Dockerfile │ ├── SiloHost │ │ ├── entrypoint.sh │ │ └── Dockerfile │ └── Vegeta │ │ ├── Dockerfile │ │ └── vegeta.sh ├── run-client-local.sh ├── run-silo-local.sh ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── HelloWorld.lua ├── run-load-test.sh ├── readme.md ├── SiloHost │ ├── HelloWorld.lua │ └── src │ │ ├── SiloEndpointConfiguration.cs │ │ └── Controllers │ │ └── HelloWorldController.cs ├── Interfaces │ ├── src │ │ └── IHelloWorld.cs │ └── Interfaces.csproj ├── .dockerignore ├── run-client-docker.sh ├── run-silo-docker.sh ├── Grains │ ├── Grains.csproj │ └── src │ │ └── HelloWorld.cs ├── .vscode │ ├── tasks.json │ └── launch.json └── Client │ ├── Client.csproj │ └── src │ └── HelloWorldClientHostedService.cs ├── 4b ├── ops │ ├── Client │ │ ├── entrypoint.sh │ │ └── Dockerfile │ ├── SiloHost │ │ ├── entrypoint.sh │ │ └── Dockerfile │ └── Convenience │ │ ├── run-silo-2-local.sh │ │ ├── run-demo-client-docker.sh │ │ ├── run-silo-1-docker.sh │ │ └── run-silo-3-docker.sh ├── imgs │ └── cluster.png ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── UnitTests │ └── ArtificialTestRun.xml ├── run-demo-cluster.sh ├── SiloHost │ └── src │ │ └── SiloEndpointConfiguration.cs ├── stop-demo.sh ├── Interfaces │ ├── src │ │ ├── ICoordinator.cs │ │ ├── ITest1.cs │ │ ├── ITest2.cs │ │ └── TRX │ │ │ ├── TestDetails.cs │ │ │ ├── TestLists.cs │ │ │ ├── TestEntries.cs │ │ │ ├── TestCreatorParameters.cs │ │ │ └── TestSettings.cs │ └── Interfaces.csproj ├── readme.md ├── run-client-local.sh ├── run-demo-clients.sh ├── run-client-docker.sh ├── run-silo-local.sh ├── .dockerignore ├── Grains │ └── Grains.csproj ├── .vscode │ └── tasks.json ├── run-silo-docker.sh └── Client │ ├── Client.csproj │ └── src │ └── CoordinatorClientHostedService.cs ├── 5a ├── ops │ ├── Client │ │ ├── entrypoint.sh │ │ └── Dockerfile │ ├── SiloHost │ │ ├── entrypoint.sh │ │ └── Dockerfile │ └── Convenience │ │ ├── run-silo-2-local.sh │ │ ├── run-demo-client-docker.sh │ │ ├── run-silo-1-docker.sh │ │ └── run-silo-3-docker.sh ├── UnitTests │ └── src │ │ └── UnitTests │ │ ├── Program.fs │ │ └── Tests.fs ├── .devcontainer │ ├── Dockerfile │ └── devcontainer.json ├── run-demo-cluster.sh ├── docker-compose.yml ├── stop-demo.sh ├── run-client-local.sh ├── Library │ ├── Library.fsproj │ └── Library.fs ├── Interfaces │ ├── src │ │ └── IHelloWorld.fs │ └── Interfaces.fsproj ├── run-demo-clients.sh ├── Grains │ ├── src │ │ └── HelloWorld.fs │ └── Grains.fsproj ├── run-silo-local.sh ├── OrleansConfiguration │ └── OrleansConfiguration.fsproj ├── run-client-docker.sh ├── docker-compose.override.yml └── run-silo-docker.sh ├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .gitignore ├── .gitattributes └── .github └── workflows ├── solution1-build.yml ├── solution2-build.yml ├── solution3-build.yml ├── solution4-build.yml ├── solution8-build.yml ├── solution5-build.yml ├── solution6-build.yml └── solution7-build.yml /1/ops/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /1a/ops/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /1b/ops/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /1c/ops/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /new-solution.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cp -a ./1/ ./1c/ -------------------------------------------------------------------------------- /3/ops/Client/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /3/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /3a/ops/Client/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /3a/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /3b/ops/Client/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /3b/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /3c/ops/Client/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /3c/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /4/ops/Client/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /4/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /4b/ops/Client/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /4b/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /5/ops/Client/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /5/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /5a/ops/Client/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /5a/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /6/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /7/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /8/ops/SiloHost/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec "$@" -------------------------------------------------------------------------------- /8/run-demo-client.ps1: -------------------------------------------------------------------------------- 1 | ./run-client-docker.ps1 2 | 3 | -------------------------------------------------------------------------------- /6/run-demo-client.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./run-client-docker.sh -------------------------------------------------------------------------------- /7/run-demo-client.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./run-client-docker.sh -------------------------------------------------------------------------------- /8/run-demo-client.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./run-client-docker.sh -------------------------------------------------------------------------------- /7/Library.UnitTests/Program.fs: -------------------------------------------------------------------------------- 1 | module Program = let [] main _ = 0 2 | -------------------------------------------------------------------------------- /8/Library.UnitTests/Program.fs: -------------------------------------------------------------------------------- 1 | module Program = let [] main _ = 0 2 | -------------------------------------------------------------------------------- /1b/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /1c/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /2/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./Client/Client.csproj -------------------------------------------------------------------------------- /2/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /3/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./Client/Client.csproj -------------------------------------------------------------------------------- /3/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /3a/img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3a/img/1.png -------------------------------------------------------------------------------- /3a/img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3a/img/2.png -------------------------------------------------------------------------------- /3a/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./Client/Client.csproj -------------------------------------------------------------------------------- /3a/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /3b/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./Client/Client.csproj -------------------------------------------------------------------------------- /3b/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /3c/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./Client/Client.csproj -------------------------------------------------------------------------------- /3c/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /5/UnitTests/src/UnitTests/Program.fs: -------------------------------------------------------------------------------- 1 | module Program = let [] main _ = 0 2 | -------------------------------------------------------------------------------- /5a/UnitTests/src/UnitTests/Program.fs: -------------------------------------------------------------------------------- 1 | module Program = let [] main _ = 0 2 | -------------------------------------------------------------------------------- /6/UnitTests/src/UnitTests/Program.fs: -------------------------------------------------------------------------------- 1 | module Program = let [] main _ = 0 2 | -------------------------------------------------------------------------------- /6/imgs/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/6/imgs/1.png -------------------------------------------------------------------------------- /6/imgs/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/6/imgs/2.png -------------------------------------------------------------------------------- /6/imgs/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/6/imgs/3.png -------------------------------------------------------------------------------- /6/imgs/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/6/imgs/4.png -------------------------------------------------------------------------------- /6/imgs/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/6/imgs/5.png -------------------------------------------------------------------------------- /7/imgs/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/7/imgs/1.png -------------------------------------------------------------------------------- /7/imgs/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/7/imgs/2.png -------------------------------------------------------------------------------- /8/imgs/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/8/imgs/1.png -------------------------------------------------------------------------------- /8/imgs/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/8/imgs/2.png -------------------------------------------------------------------------------- /8/imgs/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/8/imgs/3.png -------------------------------------------------------------------------------- /4/imgs/cluster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/4/imgs/cluster.png -------------------------------------------------------------------------------- /4b/imgs/cluster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/4b/imgs/cluster.png -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /1/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /1a/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /1b/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="7.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /2/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /3/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /3a/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /3b/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /3b/img/tagged-metric.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3b/img/tagged-metric.png -------------------------------------------------------------------------------- /3c/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /4/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /5/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /5a/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /6/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /7/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /8/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="6.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} -------------------------------------------------------------------------------- /1/readme.md: -------------------------------------------------------------------------------- 1 | # readme 2 | 3 | This is the most basic setup: only one silo, localhost clustering, no clients, no grains. -------------------------------------------------------------------------------- /3b/img/filtered-metrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3b/img/filtered-metrics.png -------------------------------------------------------------------------------- /3b/img/metrics-summary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3b/img/metrics-summary.png -------------------------------------------------------------------------------- /4b/.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="5.0" 2 | FROM mcr.microsoft.com/vscode/devcontainers/dotnetcore:0-${VARIANT} 3 | -------------------------------------------------------------------------------- /3b/img/docker-compose-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3b/img/docker-compose-output.png -------------------------------------------------------------------------------- /8/run-demo-load-test.ps1: -------------------------------------------------------------------------------- 1 | docker build -t vegeta-loadtest -f ./ops/Vegeta/Dockerfile ./ ; 2 | docker run -it --rm vegeta-loadtest -------------------------------------------------------------------------------- /4b/UnitTests/ArtificialTestRun.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/4b/UnitTests/ArtificialTestRun.xml -------------------------------------------------------------------------------- /1/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t silo-host -f ./ops/Dockerfile ./ && 4 | docker run -it -p 8080:8080 --rm silo-host 5 | -------------------------------------------------------------------------------- /3b/img/Runtime.CpuUsage.Current.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3b/img/Runtime.CpuUsage.Current.png -------------------------------------------------------------------------------- /1c/global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "9.0.0", 4 | "rollForward": "latestMajor", 5 | "allowPrerelease": true 6 | } 7 | } -------------------------------------------------------------------------------- /3c/HelloWorld.lua: -------------------------------------------------------------------------------- 1 | function factorial (n) 2 | if n == 0 then 3 | return 1 4 | else 5 | return n * factorial(n-1) 6 | end 7 | end -------------------------------------------------------------------------------- /3c/run-load-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker build -t vegeta-loadtest -f ./ops/Vegeta/Dockerfile ./ && 3 | docker run -it --rm vegeta-loadtest -------------------------------------------------------------------------------- /3b/img/App.Requests.TimedOut.Current.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3b/img/App.Requests.TimedOut.Current.png -------------------------------------------------------------------------------- /3b/img/Grain.Grains.HelloWorld.Current.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3b/img/Grain.Grains.HelloWorld.Current.png -------------------------------------------------------------------------------- /3c/readme.md: -------------------------------------------------------------------------------- 1 | # readme 2 | 3 | Solution 3 + lua support + web api co-hosting. The lua grains are exposed through web api for future load testing. -------------------------------------------------------------------------------- /6/run-demo-load-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker build -t vegeta-loadtest -f ./ops/Vegeta/Dockerfile ./ && 3 | docker run -it --rm vegeta-loadtest -------------------------------------------------------------------------------- /7/run-demo-load-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker build -t vegeta-loadtest -f ./ops/Vegeta/Dockerfile ./ && 3 | docker run -it --rm vegeta-loadtest -------------------------------------------------------------------------------- /8/run-demo-load-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker build -t vegeta-loadtest -f ./ops/Vegeta/Dockerfile ./ && 3 | docker run -it --rm vegeta-loadtest -------------------------------------------------------------------------------- /3c/SiloHost/HelloWorld.lua: -------------------------------------------------------------------------------- 1 | function factorial (n) 2 | if n == 0 then 3 | return 1 4 | else 5 | return n * factorial(n-1) 6 | end 7 | end -------------------------------------------------------------------------------- /1b/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t silo-host-cluster -f ./ops/Dockerfile ./ && 4 | docker run -it -p 3000:8080 --rm silo-host-cluster -------------------------------------------------------------------------------- /1c/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t silo-host-cluster -f ./ops/Dockerfile ./ && 4 | docker run -it -p 3000:8080 --rm silo-host-cluster -------------------------------------------------------------------------------- /3b/img/App.Requests.Total.Requests.Current.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3b/img/App.Requests.Total.Requests.Current.png -------------------------------------------------------------------------------- /8/run-demo-cluster.ps1: -------------------------------------------------------------------------------- 1 | ./ops/Convenience/run-silo-1-docker.ps1 ; 2 | ./ops/Convenience/run-silo-3-docker.ps1 ; 3 | ./ops/Convenience/run-silo-2-local.ps1 4 | -------------------------------------------------------------------------------- /3b/img/Runtime.Memory.AvailableMemoryMb.Current.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3b/img/Runtime.Memory.AvailableMemoryMb.Current.png -------------------------------------------------------------------------------- /4/run-demo-cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-silo-1-docker.sh & 3 | ./ops/Convenience/run-silo-3-docker.sh & 4 | ./ops/Convenience/run-silo-2-local.sh -------------------------------------------------------------------------------- /4b/run-demo-cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-silo-1-docker.sh & 3 | ./ops/Convenience/run-silo-3-docker.sh & 4 | ./ops/Convenience/run-silo-2-local.sh -------------------------------------------------------------------------------- /5/run-demo-cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-silo-1-docker.sh & 3 | ./ops/Convenience/run-silo-3-docker.sh & 4 | ./ops/Convenience/run-silo-2-local.sh -------------------------------------------------------------------------------- /5a/run-demo-cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-silo-1-docker.sh & 3 | ./ops/Convenience/run-silo-3-docker.sh & 4 | ./ops/Convenience/run-silo-2-local.sh -------------------------------------------------------------------------------- /6/run-demo-cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-silo-1-docker.sh & 3 | ./ops/Convenience/run-silo-3-docker.sh & 4 | ./ops/Convenience/run-silo-2-local.sh -------------------------------------------------------------------------------- /7/run-demo-cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-silo-1-docker.sh & 3 | ./ops/Convenience/run-silo-3-docker.sh & 4 | ./ops/Convenience/run-silo-2-local.sh -------------------------------------------------------------------------------- /8/run-demo-cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-silo-1-docker.sh & 3 | ./ops/Convenience/run-silo-3-docker.sh & 4 | ./ops/Convenience/run-silo-2-local.sh -------------------------------------------------------------------------------- /3b/img/App.Requests.Latency.Average.Millis.Current.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PiotrJustyna/road-to-orleans/HEAD/3b/img/App.Requests.Latency.Average.Millis.Current.png -------------------------------------------------------------------------------- /5a/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | orleans-client: 3 | image: orleans-client 4 | depends_on: 5 | - orleans-silo 6 | orleans-silo: 7 | image: orleans-silo -------------------------------------------------------------------------------- /1/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /2/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /3/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /3a/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /3b/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /3c/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /4/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /4/stop-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker ps | grep client-cluster | awk '{print $1}' | xargs -I {} docker stop {} 3 | docker ps | grep silo-host-cluster | awk '{print $1}' | xargs -I {} docker stop {} -------------------------------------------------------------------------------- /4b/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /4b/stop-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker ps | grep client-cluster | awk '{print $1}' | xargs -I {} docker stop {} 3 | docker ps | grep silo-host-cluster | awk '{print $1}' | xargs -I {} docker stop {} -------------------------------------------------------------------------------- /5/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /5/stop-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker ps | grep client-cluster | awk '{print $1}' | xargs -I {} docker stop {} 3 | docker ps | grep silo-host-cluster | awk '{print $1}' | xargs -I {} docker stop {} -------------------------------------------------------------------------------- /5a/stop-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker ps | grep client-cluster | awk '{print $1}' | xargs -I {} docker stop {} 3 | docker ps | grep silo-host-cluster | awk '{print $1}' | xargs -I {} docker stop {} -------------------------------------------------------------------------------- /6/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /6/stop-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker ps | grep client-cluster | awk '{print $1}' | xargs -I {} docker stop {} 3 | docker ps | grep silo-host-cluster | awk '{print $1}' | xargs -I {} docker stop {} -------------------------------------------------------------------------------- /7/SiloHost/src/SiloEndpointConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace SiloHost 4 | { 5 | public record SiloEndpointConfiguration(IPAddress Ip, int SiloPort, int GatewayPort); 6 | } -------------------------------------------------------------------------------- /7/stop-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker ps | grep client-cluster | awk '{print $1}' | xargs -I {} docker stop {} 3 | docker ps | grep silo-host-cluster | awk '{print $1}' | xargs -I {} docker stop {} -------------------------------------------------------------------------------- /8/stop-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker ps | grep client-cluster | awk '{print $1}' | xargs -I {} docker stop {} 3 | docker ps | grep silo-host-cluster | awk '{print $1}' | xargs -I {} docker stop {} -------------------------------------------------------------------------------- /3c/ops/Vegeta/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM peterevans/vegeta:6.9 2 | WORKDIR /app 3 | COPY . . 4 | COPY ./ops/Vegeta/vegeta.sh . 5 | RUN apk update && apk add jq && apk add curl 6 | RUN chmod +x ./vegeta.sh 7 | CMD [ "./vegeta.sh" ] -------------------------------------------------------------------------------- /6/ops/Vegeta/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM peterevans/vegeta:6.8.1 2 | WORKDIR /app 3 | COPY . . 4 | COPY ./ops/Vegeta/vegeta.sh . 5 | RUN apk update && apk add jq && apk add curl 6 | RUN chmod +x ./vegeta.sh 7 | CMD [ "./vegeta.sh" ] -------------------------------------------------------------------------------- /7/ops/Vegeta/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM peterevans/vegeta:6.8.1 2 | WORKDIR /app 3 | COPY . . 4 | COPY ./ops/Vegeta/vegeta.sh . 5 | RUN apk update && apk add jq && apk add curl 6 | RUN chmod +x ./vegeta.sh 7 | CMD [ "./vegeta.sh" ] -------------------------------------------------------------------------------- /8/ops/Vegeta/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM peterevans/vegeta:6.8.1 2 | WORKDIR /app 3 | COPY . . 4 | COPY ./ops/Vegeta/vegeta.sh . 5 | RUN apk update && apk add jq && apk add curl 6 | RUN chmod +x ./vegeta.sh 7 | CMD [ "./vegeta.sh" ] -------------------------------------------------------------------------------- /3a/Grains/src/HelloWorldState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Grains 4 | { 5 | [Serializable] 6 | public class HelloWorldState 7 | { 8 | public DateTime GreetingTimeUtc { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /4b/Interfaces/src/ICoordinator.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Interfaces 4 | { 5 | public interface ICoordinator : Orleans.IGrainWithIntegerKey 6 | { 7 | Task RunTests(); 8 | } 9 | } -------------------------------------------------------------------------------- /8/stop-demo.ps1: -------------------------------------------------------------------------------- 1 | docker stop (docker ps | select-string client-cluster | foreach-object { $_.tostring().split('')[0] }) ; 2 | docker stop (docker ps | select-string silo-host-cluster | foreach-object { $_.tostring().split('')[0] } ) 3 | -------------------------------------------------------------------------------- /4b/readme.md: -------------------------------------------------------------------------------- 1 | # readme 2 | 3 | Solution 4 adapted for parallel test execution. 4 | 5 | ## architecture 6 | 7 | * test run supervisor 8 | * kicks off the tests 9 | * compiles test results into a trx file 10 | * individual tests -------------------------------------------------------------------------------- /8/run-client-local.ps1: -------------------------------------------------------------------------------- 1 | $env:OrleansSettings__MembershipTable="test-orleans-table" 2 | $env:OrleansSettings__AwsRegion="us-west-2" 3 | $env:OrleansSettings__IsLocal="true" 4 | 5 | dotnet run --no-launch-profile --project ./Api/Api.csproj 6 | -------------------------------------------------------------------------------- /6/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 3 | export GATEWAYPORT=3001 4 | 5 | dotnet run --project ./Api/Api.csproj -------------------------------------------------------------------------------- /7/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 3 | export GATEWAYPORT=3001 4 | 5 | dotnet run --project ./Api/Api.csproj -------------------------------------------------------------------------------- /2/Interfaces/src/IHelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Interfaces 4 | { 5 | public interface IHelloWorld : Orleans.IGrainWithIntegerKey 6 | { 7 | Task SayHello(string name); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /3/Interfaces/src/IHelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Interfaces 4 | { 5 | public interface IHelloWorld : Orleans.IGrainWithIntegerKey 6 | { 7 | Task SayHello(string name); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /4/Interfaces/src/IHelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Interfaces 4 | { 5 | public interface IHelloWorld : Orleans.IGrainWithIntegerKey 6 | { 7 | Task SayHello(string name); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /4/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 3 | export GATEWAYPORT=3001 4 | 5 | dotnet run --project ./Client/Client.csproj -------------------------------------------------------------------------------- /5/Interfaces/src/IHelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Interfaces 4 | { 5 | public interface IHelloWorld : Orleans.IGrainWithIntegerKey 6 | { 7 | Task SayHello(string name); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /5/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 3 | export GATEWAYPORT=3001 4 | 5 | dotnet run --project ./Client/Client.csproj -------------------------------------------------------------------------------- /3a/Interfaces/src/IHelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Interfaces 4 | { 5 | public interface IHelloWorld : Orleans.IGrainWithIntegerKey 6 | { 7 | Task SayHello(string name); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /3b/Interfaces/src/IHelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace Interfaces 4 | { 5 | public interface IHelloWorld : Orleans.IGrainWithIntegerKey 6 | { 7 | Task SayHello(string name); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /4b/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 3 | export GATEWAYPORT=3001 4 | 5 | dotnet run --project ./Client/Client.csproj -------------------------------------------------------------------------------- /5a/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 3 | export GATEWAYPORT=3001 4 | 5 | dotnet run --project ./Client/Client.fsproj 6 | -------------------------------------------------------------------------------- /6/Api/src/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /7/Api/src/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /8/Api/src/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /3c/Interfaces/src/IHelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Interfaces 5 | { 6 | public interface IHelloWorld : Orleans.IGrainWithIntegerKey 7 | { 8 | Task Factorial(int n); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /5/Library/Library.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /5a/Library/Library.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /6/Library/Library.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /7/Library/Library.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /8/Library/Library.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | /packages/ 4 | riderModule.iml 5 | /_ReSharper.Caches/ 6 | .DS_Store 7 | .idea 8 | metrics.json 9 | plot.html 10 | results.bin 11 | **/.vs 12 | RoadToOrleans.sln.DotSettings.user 13 | *.env 14 | */UnitTests/SampleTestRun.xml 15 | .fake 16 | .ionide -------------------------------------------------------------------------------- /4b/Interfaces/src/ITest1.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Interfaces.src.TRX; 3 | 4 | namespace Interfaces 5 | { 6 | public interface ITest1 : Orleans.IGrainWithIntegerKey 7 | { 8 | Task HelloWorldTest(string testlistId); 9 | } 10 | } -------------------------------------------------------------------------------- /4b/Interfaces/src/ITest2.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Interfaces.src.TRX; 3 | 4 | namespace Interfaces 5 | { 6 | public interface ITest2 : Orleans.IGrainWithIntegerKey 7 | { 8 | Task HelloWorldTest(string testlistId); 9 | } 10 | } -------------------------------------------------------------------------------- /5a/Interfaces/src/IHelloWorld.fs: -------------------------------------------------------------------------------- 1 | namespace Interfaces 2 | 3 | open System.Threading.Tasks 4 | open Orleans 5 | 6 | type IHelloWorld = 7 | inherit IGrainWithIntegerKey 8 | abstract member SayHello : name: string -> cancellationToken: GrainCancellationToken -> Task 9 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | # This is a fix for users using Windows and unix systems 3 | # See: https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings#per-repository-settings 4 | * text=auto 5 | -------------------------------------------------------------------------------- /4/run-demo-clients.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-demo-client-docker.sh & 3 | ./ops/Convenience/run-demo-client-docker.sh & 4 | ./ops/Convenience/run-demo-client-docker.sh & 5 | ./ops/Convenience/run-demo-client-docker.sh & 6 | ./ops/Convenience/run-demo-client-docker.sh & 7 | ./run-client-local.sh -------------------------------------------------------------------------------- /5/run-demo-clients.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-demo-client-docker.sh & 3 | ./ops/Convenience/run-demo-client-docker.sh & 4 | ./ops/Convenience/run-demo-client-docker.sh & 5 | ./ops/Convenience/run-demo-client-docker.sh & 6 | ./ops/Convenience/run-demo-client-docker.sh & 7 | ./run-client-local.sh -------------------------------------------------------------------------------- /4b/run-demo-clients.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-demo-client-docker.sh & 3 | ./ops/Convenience/run-demo-client-docker.sh & 4 | ./ops/Convenience/run-demo-client-docker.sh & 5 | ./ops/Convenience/run-demo-client-docker.sh & 6 | ./ops/Convenience/run-demo-client-docker.sh & 7 | ./run-client-local.sh -------------------------------------------------------------------------------- /5a/run-demo-clients.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ./ops/Convenience/run-demo-client-docker.sh & 3 | ./ops/Convenience/run-demo-client-docker.sh & 4 | ./ops/Convenience/run-demo-client-docker.sh & 5 | ./ops/Convenience/run-demo-client-docker.sh & 6 | ./ops/Convenience/run-demo-client-docker.sh & 7 | ./run-client-local.sh -------------------------------------------------------------------------------- /7/Interfaces/src/IHelloWorld.cs: -------------------------------------------------------------------------------- 1 | using Orleans; 2 | using System.Threading.Tasks; 3 | 4 | namespace Interfaces 5 | { 6 | public interface IHelloWorld : IGrainWithIntegerKey 7 | { 8 | Task SayHello(string name, GrainCancellationToken grainCancellationToken); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /8/Interfaces/src/IHelloWorld.cs: -------------------------------------------------------------------------------- 1 | using Orleans; 2 | using System.Threading.Tasks; 3 | 4 | namespace Interfaces 5 | { 6 | public interface IHelloWorld : IGrainWithIntegerKey 7 | { 8 | Task SayHello(string name, GrainCancellationToken grainCancellationToken); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /6/Interfaces/src/IHelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Orleans; 3 | 4 | namespace Interfaces 5 | { 6 | public interface IHelloWorld : Orleans.IGrainWithIntegerKey 7 | { 8 | Task SayHello(string name, GrainCancellationToken grainCancellationToken); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /2/Grains/src/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Interfaces; 3 | 4 | namespace Grains 5 | { 6 | public class HelloWorld : Orleans.Grain, IHelloWorld 7 | { 8 | public Task SayHello(string name) 9 | { 10 | return Task.FromResult($@"Hello {name}!"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /3/Grains/src/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Interfaces; 3 | 4 | namespace Grains 5 | { 6 | public class HelloWorld : Orleans.Grain, IHelloWorld 7 | { 8 | public Task SayHello(string name) 9 | { 10 | return Task.FromResult($@"Hello {name}!"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /3b/Grains/src/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Interfaces; 3 | 4 | namespace Grains 5 | { 6 | public class HelloWorld : Orleans.Grain, IHelloWorld 7 | { 8 | public Task SayHello(string name) 9 | { 10 | return Task.FromResult($@"Hello {name}!"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /4/Grains/src/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Interfaces; 3 | 4 | namespace Grains 5 | { 6 | public class HelloWorld : Orleans.Grain, IHelloWorld 7 | { 8 | public Task SayHello(string name) 9 | { 10 | return Task.FromResult($@"Hello {name}!"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /4/run-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 3 | GATEWAYPORT=3001 4 | 5 | docker build -t client-cluster -f ./ops/Client/Dockerfile ./ && 6 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client-cluster -------------------------------------------------------------------------------- /4b/run-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 3 | GATEWAYPORT=3001 4 | 5 | docker build -t client-cluster -f ./ops/Client/Dockerfile ./ && 6 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client-cluster -------------------------------------------------------------------------------- /3c/ops/Vegeta/vegeta.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | clear 3 | echo "GET http://host.docker.internal:5000/helloworld?n=3" | vegeta attack -redirects=0 -duration=10s -rate=100 | tee results.bin | vegeta report 4 | vegeta report -type=json results.bin > metrics.json 5 | cat results.bin | vegeta plot >plot.html 6 | cat results.bin | vegeta report -type="hist[0,2ms,5ms,10ms,20ms,50ms]" -------------------------------------------------------------------------------- /5/Grains/src/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Interfaces; 3 | using Library; 4 | 5 | namespace Grains 6 | { 7 | public class HelloWorld : Orleans.Grain, IHelloWorld 8 | { 9 | public Task SayHello(string name) 10 | { 11 | return Task.FromResult(Say.hello(name)); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /1/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "type": "shell", 7 | "command": "dotnet build", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /1a/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "type": "shell", 7 | "command": "dotnet build", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /1b/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "type": "shell", 7 | "command": "dotnet build", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /1c/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build", 6 | "type": "shell", 7 | "command": "dotnet build", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /8/SiloHost/src/EcsMetadata.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SiloHost 4 | { 5 | public record EcsMetadata 6 | { 7 | public List Ports { get; init; } 8 | } 9 | 10 | public record Port 11 | { 12 | public int HostPort { get; init; } 13 | 14 | public int ContainerPort { get; init; } 15 | } 16 | } -------------------------------------------------------------------------------- /5a/Grains/src/HelloWorld.fs: -------------------------------------------------------------------------------- 1 | namespace Grains 2 | 3 | open System.Threading.Tasks 4 | open Interfaces 5 | open Library 6 | open Orleans 7 | 8 | type HelloWorld() = 9 | inherit Grain() 10 | 11 | interface IHelloWorld with 12 | member this.SayHello (name: string) (_: GrainCancellationToken) : Task = 13 | task { return Say.hello (name) } 14 | -------------------------------------------------------------------------------- /6/Api/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Api": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "launchUrl": "helloworld?name=NotMyName", 7 | "applicationUrl": "http://localhost:5432", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | } 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /7/Api/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Api": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "launchUrl": "helloworld?name=NotMyName", 7 | "applicationUrl": "http://localhost:5432", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development" 10 | } 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /4b/Interfaces/src/TRX/TestDetails.cs: -------------------------------------------------------------------------------- 1 | namespace Interfaces.src.TRX 2 | { 3 | public class TestDetails 4 | { 5 | public UnitTestResult UnitTestResult { get; set; } 6 | 7 | public UnitTestDefinition UnitTestDefinition { get; set; } 8 | 9 | public TestEntry TestEntry { get; set; } 10 | public bool TestOutcome { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /6/ops/Vegeta/vegeta.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | clear 3 | echo "GET http://host.docker.internal:5432/helloworld?name=NotMyName" | vegeta attack -redirects=0 -duration=10s -rate=100 | tee results.bin | vegeta report 4 | vegeta report -type=json results.bin > metrics.json 5 | cat results.bin | vegeta plot >plot.html 6 | cat results.bin | vegeta report -type="hist[0,500ms,600ms,700ms,800ms,900ms,1s,2s,3s,4s,5s,10s]" -------------------------------------------------------------------------------- /7/ops/Vegeta/vegeta.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | clear 3 | echo "GET http://host.docker.internal:5432/helloworld?name=NotMyName" | vegeta attack -redirects=0 -duration=10s -rate=100 | tee results.bin | vegeta report 4 | vegeta report -type=json results.bin > metrics.json 5 | cat results.bin | vegeta plot >plot.html 6 | cat results.bin | vegeta report -type="hist[0,500ms,600ms,700ms,800ms,900ms,1s,2s,3s,4s,5s,10s]" -------------------------------------------------------------------------------- /8/ops/Vegeta/vegeta.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | clear 3 | echo "GET http://host.docker.internal:5432/helloworld?name=NotMyName" | vegeta attack -redirects=0 -duration=10s -rate=100 | tee results.bin | vegeta report 4 | vegeta report -type=json results.bin > metrics.json 5 | cat results.bin | vegeta plot >plot.html 6 | cat results.bin | vegeta report -type="hist[0,500ms,600ms,700ms,800ms,900ms,1s,2s,3s,4s,5s,10s]" -------------------------------------------------------------------------------- /7/SiloHost/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "FeatureManagement": { 3 | "FeatureC": true, // Feature flag set to on 4 | "FeatureB": false, // Feature flag set to off 5 | "FeatureA": { 6 | "EnabledFor": [ 7 | { 8 | "Name": "Microsoft.Percentage", 9 | "Parameters": { 10 | "Value": 30 11 | } 12 | } 13 | ] 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /8/SiloHost/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "FeatureManagement": { 3 | "FeatureC": true, // Feature flag set to on 4 | "FeatureB": false, // Feature flag set to off 5 | "FeatureA": { 6 | "EnabledFor": [ 7 | { 8 | "Name": "Microsoft.Percentage", 9 | "Parameters": { 10 | "Value": 30 11 | } 12 | } 13 | ] 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /4b/Interfaces/src/TRX/TestLists.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace Interfaces.src.TRX 4 | { 5 | [XmlRoot(ElementName = "TestList")] 6 | public class TestList 7 | { 8 | [XmlAttribute(AttributeName = "id")] 9 | public string Id { get; set; } 10 | 11 | [XmlAttribute(AttributeName = "name")] 12 | public string Name { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /5/Library/Library.fs: -------------------------------------------------------------------------------- 1 | namespace Library 2 | 3 | module Say = 4 | let hello name = 5 | let input = 6 | match (System.String.IsNullOrWhiteSpace name) with 7 | |true -> invalidArg "name" "string cannot be null or whitespace" 8 | |false -> name 9 | sprintf "Hello, \"%s\"! Your name is %i characters long." input (String.length input) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /5a/Library/Library.fs: -------------------------------------------------------------------------------- 1 | namespace Library 2 | 3 | module Say = 4 | let hello name = 5 | let input = 6 | match (System.String.IsNullOrWhiteSpace name) with 7 | |true -> invalidArg "name" "string cannot be null or whitespace" 8 | |false -> name 9 | sprintf "Hello, \"%s\"! Your name is %i characters long." input (String.length input) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /6/Library/Library.fs: -------------------------------------------------------------------------------- 1 | namespace Library 2 | 3 | module Say = 4 | let hello name = 5 | let input = 6 | match (System.String.IsNullOrWhiteSpace name) with 7 | |true -> invalidArg "name" "string cannot be null or whitespace" 8 | |false -> name 9 | sprintf "Hello, \"%s\"! Your name is %i characters long." input (String.length input) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /7/Library/Library.fs: -------------------------------------------------------------------------------- 1 | namespace Library 2 | 3 | module Say = 4 | let hello name = 5 | let input = 6 | match (System.String.IsNullOrWhiteSpace name) with 7 | |true -> invalidArg "name" "string cannot be null or whitespace" 8 | |false -> name 9 | sprintf "Hello, \"%s\"! Your name is %i characters long." input (String.length input) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /8/Library/Library.fs: -------------------------------------------------------------------------------- 1 | namespace Library 2 | 3 | module Say = 4 | let hello name = 5 | let input = 6 | match (System.String.IsNullOrWhiteSpace name) with 7 | |true -> invalidArg "name" "string cannot be null or whitespace" 8 | |false -> name 9 | sprintf "Hello, \"%s\"! Your name is %i characters long." input (String.length input) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /6/Api/Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /7/Api/Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /1a/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3001 9 | export SILOPORT=2001 10 | export PRIMARYPORT=2001 11 | export DASHBOARDPORT=8081 12 | 13 | dotnet run --project ./SiloHost/SiloHost.fsproj -------------------------------------------------------------------------------- /4/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3001 9 | export SILOPORT=2001 10 | export PRIMARYPORT=2001 11 | export DASHBOARDPORT=8081 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /4b/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3001 9 | export SILOPORT=2001 10 | export PRIMARYPORT=2001 11 | export DASHBOARDPORT=8081 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /5/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3001 9 | export SILOPORT=2001 10 | export PRIMARYPORT=2001 11 | export DASHBOARDPORT=8081 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /5a/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3001 9 | export SILOPORT=2001 10 | export PRIMARYPORT=2001 11 | export DASHBOARDPORT=8081 12 | 13 | dotnet run --project ./SiloHost/SiloHost.fsproj -------------------------------------------------------------------------------- /6/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3001 9 | export SILOPORT=2001 10 | export PRIMARYPORT=2001 11 | export DASHBOARDPORT=8081 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /7/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3001 9 | export SILOPORT=2001 10 | export PRIMARYPORT=2001 11 | export DASHBOARDPORT=8081 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /3/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /3b/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /3c/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /4/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /4b/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /5/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /5a/OrleansConfiguration/OrleansConfiguration.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | true 6 | Configuration 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /6/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /7/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /4/ops/Convenience/run-silo-2-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3002 9 | export DASHBOARDPORT=8082 10 | export SILOPORT=2002 11 | export PRIMARYPORT=2001 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /4b/ops/Convenience/run-silo-2-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3002 9 | export DASHBOARDPORT=8082 10 | export SILOPORT=2002 11 | export PRIMARYPORT=2001 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /5/ops/Convenience/run-silo-2-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3002 9 | export DASHBOARDPORT=8082 10 | export SILOPORT=2002 11 | export PRIMARYPORT=2001 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /5a/ops/Convenience/run-silo-2-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3002 9 | export DASHBOARDPORT=8082 10 | export SILOPORT=2002 11 | export PRIMARYPORT=2001 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /6/ops/Convenience/run-silo-2-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3002 9 | export DASHBOARDPORT=8082 10 | export SILOPORT=2002 11 | export PRIMARYPORT=2001 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /7/ops/Convenience/run-silo-2-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export ADVERTISEDIP=`RetrieveIp` 7 | export PRIMARYADDRESS=`RetrieveIp` 8 | export GATEWAYPORT=3002 9 | export DASHBOARDPORT=8082 10 | export SILOPORT=2002 11 | export PRIMARYPORT=2001 12 | 13 | dotnet run --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /1/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "run silo host", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "preLaunchTask": "build", 9 | "program": "${workspaceFolder}/SiloHost/bin/Debug/net5.0/SiloHost.dll", 10 | "args": [], 11 | "cwd": "${workspaceFolder}/SiloHost", 12 | "console": "internalConsole", 13 | "stopAtEntry": false 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /1a/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "run silo host", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "preLaunchTask": "build", 9 | "program": "${workspaceFolder}/SiloHost/bin/Debug/net5.0/SiloHost.dll", 10 | "args": [], 11 | "cwd": "${workspaceFolder}/SiloHost", 12 | "console": "internalConsole", 13 | "stopAtEntry": false 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /1b/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "run silo host", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "preLaunchTask": "build", 9 | "program": "${workspaceFolder}/SiloHost/bin/Debug/net7.0/SiloHost.dll", 10 | "args": [], 11 | "cwd": "${workspaceFolder}/SiloHost", 12 | "console": "internalConsole", 13 | "stopAtEntry": false 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /1c/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "run silo host", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "preLaunchTask": "build", 9 | "program": "${workspaceFolder}/SiloHost/bin/Debug/net9.0/SiloHost.dll", 10 | "args": [], 11 | "cwd": "${workspaceFolder}/SiloHost", 12 | "console": "internalConsole", 13 | "stopAtEntry": false 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /3/run-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3000 7 | 8 | docker build -t client -f ./ops/Client/Dockerfile ./ && 9 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client 10 | -------------------------------------------------------------------------------- /3a/run-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3000 7 | 8 | docker build -t client -f ./ops/Client/Dockerfile ./ && 9 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client 10 | -------------------------------------------------------------------------------- /3c/run-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3000 7 | 8 | docker build -t client -f ./ops/Client/Dockerfile ./ && 9 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client 10 | -------------------------------------------------------------------------------- /3b/run-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT='3000' 7 | 8 | docker build -t client -f ./ops/Client/Dockerfile ./ && 9 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client 10 | -------------------------------------------------------------------------------- /6/run-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3001 7 | 8 | docker build -t client-cluster -f ./ops/Api/Dockerfile ./ && 9 | docker run -it -p 5432:80 -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client-cluster -------------------------------------------------------------------------------- /7/run-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3001 7 | 8 | docker build -t client-cluster -f ./ops/Api/Dockerfile ./ && 9 | docker run -it -p 5432:80 -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client-cluster -------------------------------------------------------------------------------- /5/run-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3001 7 | 8 | docker build -t client-cluster -f ./ops/Client/Dockerfile ./ && 9 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client-cluster 10 | -------------------------------------------------------------------------------- /5a/run-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3001 7 | 8 | docker build -t client-cluster -f ./ops/Client/Dockerfile ./ && 9 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client-cluster 10 | -------------------------------------------------------------------------------- /3/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3000 7 | 8 | docker build -t silo-host -f ./ops/SiloHost/Dockerfile ./ && 9 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -p $GATEWAYPORT:3000 -p 8080:8080 --rm silo-host -------------------------------------------------------------------------------- /1a/Grains/Grains.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /8/Api/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Api": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "launchUrl": "helloworld?name=NotMyName", 7 | "applicationUrl": "http://localhost:5432", 8 | "environmentVariables": { 9 | "ASPNETCORE_ENVIRONMENT": "Development", 10 | "OrleansSettings__AwsRegion": "us-west-2", 11 | "OrleansSettings__MembershipTable": "some-table-name" 12 | } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /4/ops/Convenience/run-demo-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3001 7 | 8 | docker build -t client-cluster -f ./ops/Client/Dockerfile ./ && 9 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client-cluster 10 | -------------------------------------------------------------------------------- /5/ops/Convenience/run-demo-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3001 7 | 8 | docker build -t client-cluster -f ./ops/Client/Dockerfile ./ && 9 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client-cluster 10 | -------------------------------------------------------------------------------- /3c/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3000 7 | 8 | docker build -t silo-host -f ./ops/SiloHost/Dockerfile ./ && 9 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -p $GATEWAYPORT:3000 -p 8080:8080 -p 5000:5000 --rm silo-host -------------------------------------------------------------------------------- /4b/ops/Convenience/run-demo-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3001 7 | 8 | docker build -t client-cluster -f ./ops/Client/Dockerfile ./ && 9 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client-cluster 10 | -------------------------------------------------------------------------------- /5a/ops/Convenience/run-demo-client-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3001 7 | 8 | docker build -t client-cluster -f ./ops/Client/Dockerfile ./ && 9 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT --rm client-cluster 10 | -------------------------------------------------------------------------------- /8/Api/Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /4b/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": { } 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.shell.linux": "/bin/bash", 10 | "editor.insertSpaces": true, 11 | "editor.tabSize": 2, 12 | "editor.detectIndentation": false 13 | }, 14 | 15 | "extensions": [ 16 | "ms-vscode.csharp", 17 | "ms-dotnettools.csharp", 18 | "yzhang.markdown-all-in-one", 19 | "bierner.markdown-emoji" 20 | ], 21 | 22 | "remoteUser": "vscode" 23 | } 24 | -------------------------------------------------------------------------------- /4b/Interfaces/src/TRX/TestEntries.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace Interfaces.src.TRX 4 | { 5 | [XmlRoot(ElementName = "TestEntry")] 6 | public class TestEntry 7 | { 8 | [XmlAttribute(AttributeName = "testId")] 9 | public string TestId { get; set; } 10 | 11 | [XmlAttribute(AttributeName = "executionId")] 12 | public string ExecutionId { get; set; } 13 | 14 | [XmlAttribute(AttributeName = "testListId")] 15 | public string TestListId { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /.github/workflows/solution1-build.yml: -------------------------------------------------------------------------------- 1 | name: Solution1 Build 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: 7 | - main 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | defaults: 13 | run: 14 | working-directory: ./1 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | - name: Setup .NET 19 | uses: actions/setup-dotnet@v1 20 | - name: Restore dependencies 21 | run: dotnet restore 22 | - name: Build 23 | run: dotnet build --no-restore -------------------------------------------------------------------------------- /.github/workflows/solution2-build.yml: -------------------------------------------------------------------------------- 1 | name: Solution2 Build 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: 7 | - main 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | defaults: 13 | run: 14 | working-directory: ./2 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | - name: Setup .NET 19 | uses: actions/setup-dotnet@v1 20 | - name: Restore dependencies 21 | run: dotnet restore 22 | - name: Build 23 | run: dotnet build --no-restore -------------------------------------------------------------------------------- /.github/workflows/solution3-build.yml: -------------------------------------------------------------------------------- 1 | name: Solution3 Build 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: 7 | - main 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | defaults: 13 | run: 14 | working-directory: ./3 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | - name: Setup .NET 19 | uses: actions/setup-dotnet@v1 20 | - name: Restore dependencies 21 | run: dotnet restore 22 | - name: Build 23 | run: dotnet build --no-restore -------------------------------------------------------------------------------- /.github/workflows/solution4-build.yml: -------------------------------------------------------------------------------- 1 | name: Solution4 Build 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: 7 | - main 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | defaults: 13 | run: 14 | working-directory: ./4 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | - name: Setup .NET 19 | uses: actions/setup-dotnet@v1 20 | - name: Restore dependencies 21 | run: dotnet restore 22 | - name: Build 23 | run: dotnet build --no-restore -------------------------------------------------------------------------------- /3a/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT=3000 7 | 8 | docker build -t silo-host -f ./ops/SiloHost/Dockerfile ./ && 9 | docker run -it -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_ACCESS_KEY_ID -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -p $GATEWAYPORT:3000 -p 8080:8080 --rm silo-host -------------------------------------------------------------------------------- /4b/Interfaces/src/TRX/TestCreatorParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Interfaces.src.TRX 4 | { 5 | public class TestCreatorParameters 6 | { 7 | public Type ClassType { get; set; } 8 | public string CallerName { get; set; } 9 | public string TestListId { get; set; } 10 | public string StartTime { get; set; } 11 | public string EndTime { get; set; } 12 | public string Duration { get; set; } 13 | public string MachineName { get; set; } 14 | public bool TestOutcome { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /1/ops/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/ 5 | COPY ./ops/entrypoint.sh /SiloHost/ 6 | 7 | RUN dotnet publish --verbosity normal "/src/SiloHost.csproj" --configuration Release --output /SiloHost 8 | 9 | EXPOSE 8080 10 | 11 | # final stage/image 12 | FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine 13 | 14 | WORKDIR /SiloHost 15 | COPY --from=build /SiloHost ./ 16 | EXPOSE 3000 8080 17 | 18 | CMD ["dotnet", "SiloHost.dll"] 19 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /6/Grains/src/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using Interfaces; 3 | using Orleans; 4 | using Library; 5 | 6 | namespace Grains 7 | { 8 | public class HelloWorld : Orleans.Grain, IHelloWorld 9 | { 10 | public Task SayHello(string name, GrainCancellationToken grainCancellationToken) 11 | { 12 | if (!grainCancellationToken.CancellationToken.IsCancellationRequested) 13 | { 14 | return Task.FromResult(Say.hello(name)); 15 | } 16 | 17 | return null; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /2/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /3/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /3a/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /3b/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /4/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /5/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /5a/Interfaces/Interfaces.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /6/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /7/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /8/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /8/run-client-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export OrleansSettings__IsLocal=true 3 | export OrleansSettings__MembershipTable="some-table-name" 4 | export OrleansSettings__AwsRegion="us-west-2" 5 | 6 | AWS_REGION=$(awk -F '=' '/^region/ { print $2 }' ~/.aws/credentials) 7 | AWS_SECRET_ACCESS_KEY=$(awk -F '=' '/^aws_secret_access_key/ { print $2 }' ~/.aws/credentials) 8 | AWS_SESSION_TOKEN=$(awk -F '=' '/^aws_session_token/ { print $2 }' ~/.aws/credentials) 9 | AWS_ACCESS_KEY_ID=$(awk -F '=' '/^aws_access_key_id/ { print $2 }' ~/.aws/credentials) 10 | 11 | dotnet run --no-launch-profile --project ./Api/Api.csproj -------------------------------------------------------------------------------- /2/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | all 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /3/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | all 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /3b/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | all 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /4/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | all 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /4b/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | all 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /6/Api/src/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Hosting; 3 | 4 | namespace Api 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | CreateHostBuilder(args).Build().Run(); 11 | } 12 | 13 | public static IHostBuilder CreateHostBuilder(string[] args) => 14 | Host.CreateDefaultBuilder(args) 15 | .ConfigureWebHostDefaults(webBuilder => 16 | { 17 | webBuilder.UseStartup(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /7/Api/src/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Hosting; 3 | 4 | namespace Api 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | CreateHostBuilder(args).Build().Run(); 11 | } 12 | 13 | public static IHostBuilder CreateHostBuilder(string[] args) => 14 | Host.CreateDefaultBuilder(args) 15 | .ConfigureWebHostDefaults(webBuilder => 16 | { 17 | webBuilder.UseStartup(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/solution8-build.yml: -------------------------------------------------------------------------------- 1 | name: Solution8 Build 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | defaults: 12 | run: 13 | working-directory: ./8 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v2 17 | - name: Setup .NET 18 | uses: actions/setup-dotnet@v1 19 | - name: Restore dependencies 20 | run: dotnet restore 21 | - name: Build 22 | run: dotnet build --no-restore 23 | - name: Test 24 | run: dotnet test --no-build --verbosity normal -------------------------------------------------------------------------------- /6/ops/Api/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base 2 | WORKDIR /app 3 | EXPOSE 80 4 | 5 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build 6 | WORKDIR /src 7 | COPY ["Api/Api.csproj", "Api/"] 8 | COPY ["Interfaces/Interfaces.csproj", "Interfaces/"] 9 | RUN dotnet restore "Api/Api.csproj" 10 | COPY . . 11 | WORKDIR "/src/Api" 12 | RUN dotnet build "Api.csproj" -c Release -o /app/build 13 | 14 | FROM build AS publish 15 | RUN dotnet publish "Api.csproj" -c Release -o /app/publish 16 | 17 | FROM base AS final 18 | WORKDIR /app 19 | COPY --from=publish /app/publish . 20 | ENTRYPOINT ["dotnet", "Api.dll"] -------------------------------------------------------------------------------- /7/ops/Api/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base 2 | WORKDIR /app 3 | EXPOSE 80 4 | 5 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build 6 | WORKDIR /src 7 | COPY ["Api/Api.csproj", "Api/"] 8 | COPY ["Interfaces/Interfaces.csproj", "Interfaces/"] 9 | RUN dotnet restore "Api/Api.csproj" 10 | COPY . . 11 | WORKDIR "/src/Api" 12 | RUN dotnet build "Api.csproj" -c Release -o /app/build 13 | 14 | FROM build AS publish 15 | RUN dotnet publish "Api.csproj" -c Release -o /app/publish 16 | 17 | FROM base AS final 18 | WORKDIR /app 19 | COPY --from=publish /app/publish . 20 | ENTRYPOINT ["dotnet", "Api.dll"] -------------------------------------------------------------------------------- /8/ops/Api/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base 2 | WORKDIR /app 3 | EXPOSE 80 4 | 5 | FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build 6 | WORKDIR /src 7 | COPY ["Api/Api.csproj", "Api/"] 8 | COPY ["Interfaces/Interfaces.csproj", "Interfaces/"] 9 | RUN dotnet restore "Api/Api.csproj" 10 | COPY . . 11 | WORKDIR "/src/Api" 12 | RUN dotnet build "Api.csproj" -c Release -o /app/build 13 | 14 | FROM build AS publish 15 | RUN dotnet publish "Api.csproj" -c Release -o /app/publish 16 | 17 | FROM base AS final 18 | WORKDIR /app 19 | COPY --from=publish /app/publish . 20 | 21 | ENTRYPOINT ["dotnet", "Api.dll"] -------------------------------------------------------------------------------- /.github/workflows/solution5-build.yml: -------------------------------------------------------------------------------- 1 | name: Solution5 Build 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: 7 | - main 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | defaults: 13 | run: 14 | working-directory: ./5 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | - name: Setup .NET 19 | uses: actions/setup-dotnet@v1 20 | - name: Restore dependencies 21 | run: dotnet restore 22 | - name: Build 23 | run: dotnet build --no-restore 24 | - name: Test 25 | run: dotnet test --no-build --verbosity normal -------------------------------------------------------------------------------- /.github/workflows/solution6-build.yml: -------------------------------------------------------------------------------- 1 | name: Solution6 Build 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: 7 | - main 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | defaults: 13 | run: 14 | working-directory: ./6 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | - name: Setup .NET 19 | uses: actions/setup-dotnet@v1 20 | - name: Restore dependencies 21 | run: dotnet restore 22 | - name: Build 23 | run: dotnet build --no-restore 24 | - name: Test 25 | run: dotnet test --no-build --verbosity normal -------------------------------------------------------------------------------- /.github/workflows/solution7-build.yml: -------------------------------------------------------------------------------- 1 | name: Solution7 Build 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: 7 | - main 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | defaults: 13 | run: 14 | working-directory: ./7 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v2 18 | - name: Setup .NET 19 | uses: actions/setup-dotnet@v1 20 | - name: Restore dependencies 21 | run: dotnet restore 22 | - name: Build 23 | run: dotnet build --no-restore 24 | - name: Test 25 | run: dotnet test --no-build --verbosity normal -------------------------------------------------------------------------------- /1b/Grains/Grains.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /1c/readme.md: -------------------------------------------------------------------------------- 1 | # readme 2 | 3 | This is the most basic setup: only one silo, localhost clustering, no clients, one reminder grain, one grain service, one grain service client. For the purpose of the exercise, it will be acting on its own and not part of a distributed cluster 4 | 5 | ## run 6 | 7 | To run, use any of the methods listed below: 8 | 9 | * `./run-silo-local.sh` 10 | * `./run-silo-docker.sh` 11 | * run it from your IDE 12 | 13 | To verify everything is working correctly: 14 | 15 | * Dashboard: http://localhost:8080 16 | * Dashboard if running with Docker http://localhost:3000 17 | 18 | Provided the ports are not changed. 19 | -------------------------------------------------------------------------------- /3c/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /4b/Interfaces/src/TRX/TestSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml.Serialization; 3 | 4 | namespace Interfaces.src.TRX 5 | { 6 | public class TestSettings 7 | { 8 | [XmlAttribute(AttributeName = "id")] 9 | public string Id { get; set; } 10 | 11 | [XmlAttribute(AttributeName = "name")] 12 | public string Name { get; set; } 13 | 14 | [Obsolete] 15 | public Deployment Deployment { get; set; } 16 | } 17 | 18 | public class Deployment 19 | { 20 | [XmlAttribute(AttributeName = "runDeploymentRoot")] 21 | public string RunDeploymentRoot { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /8/SiloHost/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SiloHost": { 4 | "commandName": "Project", 5 | "environmentVariables": { 6 | "OrleansHostSettings__AdvertisedIp": "", 7 | "OrleansHostSettings__SiloPort": "2001", 8 | "OrleansHostSettings__GatewayPort": "3001", 9 | "OrleansHostSettings__DashboardPort": "8081", 10 | "OrleansHostSettings__AwsRegion": "us-west-2", 11 | "OrleansHostSettings__MembershipTableName": "some-table-name", 12 | "OrleansHostSettings__IsLocal": "true", 13 | "OrleansHostSettings__EcsContainerMetadataUri": "" 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /1c/Grains/src/YourGrainServiceClient.fs: -------------------------------------------------------------------------------- 1 | namespace Grains 2 | 3 | open System 4 | open Orleans.Runtime.Services 5 | open Orleans.Services 6 | 7 | type IYourGrainServiceClient = 8 | inherit IGrainServiceClient 9 | inherit IYourGrainService 10 | 11 | type YourGrainServiceClient(serviceProvider: IServiceProvider) = 12 | inherit GrainServiceClient(serviceProvider) 13 | 14 | let grainService = 15 | base.GetGrainService(base.CurrentGrainReference.GrainId) 16 | 17 | interface IYourGrainServiceClient with 18 | member this.HelloWorld() = 19 | grainService.HelloWorld() 20 | -------------------------------------------------------------------------------- /3c/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | all 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /5/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | all 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /6/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | all 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /3/ops/Client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine as build 2 | 3 | COPY ./Client/Client.csproj /src/Client/Client.csproj 4 | COPY ./Client/src/* /src/Client/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./ops/Client/entrypoint.sh /Client/ 10 | 11 | RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client 12 | 13 | # final stage/image 14 | FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine 15 | 16 | WORKDIR /Client 17 | COPY --from=build /Client ./ 18 | 19 | CMD ["dotnet", "Client.dll"] 20 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /3a/ops/Client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./Client/Client.csproj /src/Client/Client.csproj 4 | COPY ./Client/src/* /src/Client/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./ops/Client/entrypoint.sh /Client/ 10 | 11 | RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client 12 | 13 | # final stage/image 14 | FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine 15 | 16 | WORKDIR /Client 17 | COPY --from=build /Client ./ 18 | 19 | CMD ["dotnet", "Client.dll"] 20 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /3b/ops/Client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./Client/Client.csproj /src/Client/Client.csproj 4 | COPY ./Client/src/* /src/Client/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./ops/Client/entrypoint.sh /Client/ 10 | 11 | RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client 12 | 13 | # final stage/image 14 | FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine 15 | 16 | WORKDIR /Client 17 | COPY --from=build /Client ./ 18 | 19 | CMD ["dotnet", "Client.dll"] 20 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /3c/ops/Client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine as build 2 | 3 | COPY ./Client/Client.csproj /src/Client/Client.csproj 4 | COPY ./Client/src/* /src/Client/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./ops/Client/entrypoint.sh /Client/ 10 | 11 | RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client 12 | 13 | # final stage/image 14 | FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine 15 | 16 | WORKDIR /Client 17 | COPY --from=build /Client ./ 18 | 19 | CMD ["dotnet", "Client.dll"] 20 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /4/ops/Client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./Client/Client.csproj /src/Client/Client.csproj 4 | COPY ./Client/src/* /src/Client/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./ops/Client/entrypoint.sh /Client/ 10 | 11 | RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client 12 | 13 | # final stage/image 14 | FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine 15 | 16 | WORKDIR /Client 17 | COPY --from=build /Client ./ 18 | 19 | CMD ["dotnet", "Client.dll"] 20 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /4b/ops/Client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./Client/Client.csproj /src/Client/Client.csproj 4 | COPY ./Client/src/* /src/Client/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./ops/Client/entrypoint.sh /Client/ 10 | 11 | RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client 12 | 13 | # final stage/image 14 | FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine 15 | 16 | WORKDIR /Client 17 | COPY --from=build /Client ./ 18 | 19 | CMD ["dotnet", "Client.dll"] 20 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /5/ops/Client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./Client/Client.csproj /src/Client/Client.csproj 4 | COPY ./Client/src/* /src/Client/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./ops/Client/entrypoint.sh /Client/ 10 | 11 | RUN dotnet publish --verbosity normal "/src/Client/Client.csproj" --configuration Release --output /Client 12 | 13 | # final stage/image 14 | FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine 15 | 16 | WORKDIR /Client 17 | COPY --from=build /Client ./ 18 | 19 | CMD ["dotnet", "Client.dll"] 20 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /1c/ops/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /SiloHost/src/ 5 | COPY ./Grains/Grains.fsproj /Grains/Grains.fsproj 6 | COPY ./Grains/src/* /Grains/src/ 7 | COPY ./ops/entrypoint.sh /SiloHost/ 8 | 9 | RUN dotnet publish --verbosity normal "/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 10 | 11 | EXPOSE 8080 12 | 13 | # final stage/image 14 | FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine 15 | 16 | WORKDIR /SiloHost 17 | COPY --from=build /SiloHost ./ 18 | EXPOSE 3000 8080 19 | 20 | CMD ["dotnet", "SiloHost.dll"] 21 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /1/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /1a/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /1a/Grains/src/Library.fs: -------------------------------------------------------------------------------- 1 | namespace Grains 2 | 3 | open System.Threading.Tasks 4 | open Orleans 5 | 6 | type IDummyTests = 7 | inherit IGrainWithIntegerKey 8 | abstract member DummyTest1 : input: string -> cancellationToken: GrainCancellationToken -> Task 9 | abstract member DummyTest2 : input: string -> cancellationToken: GrainCancellationToken -> Task 10 | 11 | type DummyTests() = 12 | inherit Grain() 13 | interface IDummyTests with 14 | member this.DummyTest1 (input: string) (_: GrainCancellationToken) : Task = task { return true } 15 | member this.DummyTest2 (input: string) (_: GrainCancellationToken) : Task = task { return false } -------------------------------------------------------------------------------- /1b/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /2/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /3/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /3a/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /3b/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /3c/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /4/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /5/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /5a/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /6/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /7/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /8/.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "C# (.NET)", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": {} 6 | }, 7 | 8 | "settings": { 9 | "terminal.integrated.defaultProfile.linux": "zsh", 10 | "terminal.integrated.profiles.linux": { 11 | "zsh": { 12 | "path": "/usr/bin/zsh" 13 | } 14 | }, 15 | "editor.insertSpaces": true, 16 | "editor.tabSize": 2, 17 | "editor.detectIndentation": false 18 | }, 19 | 20 | "extensions": [ 21 | "ms-vscode.csharp", 22 | "ms-dotnettools.csharp", 23 | "yzhang.markdown-all-in-one", 24 | "bierner.markdown-emoji" 25 | ], 26 | 27 | "remoteUser": "vscode" 28 | } 29 | -------------------------------------------------------------------------------- /4b/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | runtime; build; native; contentfiles; analyzers; buildtransitive 10 | all 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /1a/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | SILOPORT=2001 10 | PRIMARYPORT=2001 11 | DASHBOARDPORT=8081 12 | 13 | docker build -t silo-host-cluster -f ./ops/Dockerfile ./ && 14 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /2/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build silo host", 6 | "type": "shell", 7 | "command": "dotnet build ./SiloHost/SiloHost.csproj", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | }, 15 | { 16 | "label": "build client", 17 | "type": "shell", 18 | "command": "dotnet build ./Client/Client.csproj", 19 | "args": [], 20 | "group": "build", 21 | "presentation": { 22 | "reveal": "silent" 23 | }, 24 | "problemMatcher": "$msCompile" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /3/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build silo host", 6 | "type": "shell", 7 | "command": "dotnet build ./SiloHost/SiloHost.csproj", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | }, 15 | { 16 | "label": "build client", 17 | "type": "shell", 18 | "command": "dotnet build ./Client/Client.csproj", 19 | "args": [], 20 | "group": "build", 21 | "presentation": { 22 | "reveal": "silent" 23 | }, 24 | "problemMatcher": "$msCompile" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /3a/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | all 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /4/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build silo host", 6 | "type": "shell", 7 | "command": "dotnet build ./SiloHost/SiloHost.csproj", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | }, 15 | { 16 | "label": "build client", 17 | "type": "shell", 18 | "command": "dotnet build ./Client/Client.csproj", 19 | "args": [], 20 | "group": "build", 21 | "presentation": { 22 | "reveal": "silent" 23 | }, 24 | "problemMatcher": "$msCompile" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /3a/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build silo host", 6 | "type": "shell", 7 | "command": "dotnet build ./SiloHost/SiloHost.csproj", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | }, 15 | { 16 | "label": "build client", 17 | "type": "shell", 18 | "command": "dotnet build ./Client/Client.csproj", 19 | "args": [], 20 | "group": "build", 21 | "presentation": { 22 | "reveal": "silent" 23 | }, 24 | "problemMatcher": "$msCompile" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /3b/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build silo host", 6 | "type": "shell", 7 | "command": "dotnet build ./SiloHost/SiloHost.csproj", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | }, 15 | { 16 | "label": "build client", 17 | "type": "shell", 18 | "command": "dotnet build ./Client/Client.csproj", 19 | "args": [], 20 | "group": "build", 21 | "presentation": { 22 | "reveal": "silent" 23 | }, 24 | "problemMatcher": "$msCompile" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /3c/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build silo host", 6 | "type": "shell", 7 | "command": "dotnet build ./SiloHost/SiloHost.csproj", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | }, 15 | { 16 | "label": "build client", 17 | "type": "shell", 18 | "command": "dotnet build ./Client/Client.csproj", 19 | "args": [], 20 | "group": "build", 21 | "presentation": { 22 | "reveal": "silent" 23 | }, 24 | "problemMatcher": "$msCompile" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /4/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | DASHBOARDPORT=8081 10 | SILOPORT=2001 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /4b/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "build silo host", 6 | "type": "shell", 7 | "command": "dotnet build ./SiloHost/SiloHost.csproj", 8 | "args": [], 9 | "group": "build", 10 | "presentation": { 11 | "reveal": "silent" 12 | }, 13 | "problemMatcher": "$msCompile" 14 | }, 15 | { 16 | "label": "build client", 17 | "type": "shell", 18 | "command": "dotnet build ./Client/Client.csproj", 19 | "args": [], 20 | "group": "build", 21 | "presentation": { 22 | "reveal": "silent" 23 | }, 24 | "problemMatcher": "$msCompile" 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /4b/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | DASHBOARDPORT=8081 10 | SILOPORT=2001 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /5a/docker-compose.override.yml: -------------------------------------------------------------------------------- 1 | services: 2 | orleans-client: 3 | image: orleans-client 4 | build: 5 | context: . 6 | dockerfile: ./ops/Client/Dockerfile 7 | environment: 8 | - ADVERTISEDIP=172.17.0.1 9 | - GATEWAYPORT=3001 10 | depends_on: 11 | - orleans-silo 12 | orleans-silo: 13 | image: orleans-silo 14 | build: 15 | context: . 16 | dockerfile: ./ops/SiloHost/Dockerfile 17 | environment: 18 | - ADVERTISEDIP=172.17.0.1 19 | - SILOPORT=2001 20 | - GATEWAYPORT=3001 21 | - PRIMARYPORT=2001 22 | - DASHBOARDPORT=8081 23 | ports: 24 | - "8081:8081" 25 | - "3001:3001" 26 | - "2001:2001" 27 | -------------------------------------------------------------------------------- /1a/readme.md: -------------------------------------------------------------------------------- 1 | # readme 2 | 3 | This is the most basic setup: only one silo, localhost clustering, no clients, one grains. It is ready to participate in a cluster if needed. For the purpose of the exercise, it will be acting on its own. 4 | 5 | ## run 6 | 7 | To run, use any of the methods listed below: 8 | 9 | * `./run-silo-local.sh` 10 | * `./run-silo-docker.sh` 11 | * run it from your IDE, but please make sure you have the environment variables set to e.g. `DASHBOARDPORT=8081;GATEWAYPORT=3001;PRIMARYPORT=2001;SILOPORT=2001` 12 | 13 | To verify everything is working correctly: 14 | 15 | * Dashboard: http://localhost:8081 16 | * API: http://localhost:5000/dummy 17 | 18 | Provided the ports are not changed. -------------------------------------------------------------------------------- /5/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | SILOPORT=2001 10 | PRIMARYPORT=2001 11 | DASHBOARDPORT=8081 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /5a/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | SILOPORT=2001 10 | PRIMARYPORT=2001 11 | DASHBOARDPORT=8081 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /6/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | SILOPORT=2001 10 | PRIMARYPORT=2001 11 | DASHBOARDPORT=8081 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /7/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | SILOPORT=2001 10 | PRIMARYPORT=2001 11 | DASHBOARDPORT=8081 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -it -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /1a/ops/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.fsproj /src/SiloHost/SiloHost.fsproj 4 | COPY ./SiloHost/src/* /src/SiloHost/src/ 5 | 6 | COPY ./Grains/Grains.fsproj /src/Grains/Grains.fsproj 7 | COPY ./Grains/src/* /src/Grains/src/ 8 | 9 | COPY ./ops/entrypoint.sh /SiloHost/ 10 | 11 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.fsproj" --configuration Release --output /SiloHost 12 | 13 | EXPOSE 8080 14 | 15 | # final stage/image 16 | FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine 17 | 18 | WORKDIR /SiloHost 19 | COPY --from=build /SiloHost ./ 20 | EXPOSE 3000 8080 21 | 22 | CMD ["dotnet", "SiloHost.dll"] 23 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /4/ops/Convenience/run-silo-1-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | DASHBOARDPORT=8081 10 | SILOPORT=2001 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /4/ops/Convenience/run-silo-3-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3003 9 | DASHBOARDPORT=8083 10 | SILOPORT=2003 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /4b/ops/Convenience/run-silo-1-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | DASHBOARDPORT=8081 10 | SILOPORT=2001 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /4b/ops/Convenience/run-silo-3-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3003 9 | DASHBOARDPORT=8083 10 | SILOPORT=2003 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /5/ops/Convenience/run-silo-1-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | DASHBOARDPORT=8081 10 | SILOPORT=2001 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /5/ops/Convenience/run-silo-3-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3003 9 | DASHBOARDPORT=8083 10 | SILOPORT=2003 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /5a/ops/Convenience/run-silo-1-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | DASHBOARDPORT=8081 10 | SILOPORT=2001 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /5a/ops/Convenience/run-silo-3-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3003 9 | DASHBOARDPORT=8083 10 | SILOPORT=2003 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /6/ops/Convenience/run-silo-1-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | DASHBOARDPORT=8081 10 | SILOPORT=2001 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /6/ops/Convenience/run-silo-3-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3003 9 | DASHBOARDPORT=8083 10 | SILOPORT=2003 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /7/ops/Convenience/run-silo-1-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3001 9 | DASHBOARDPORT=8081 10 | SILOPORT=2001 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /7/ops/Convenience/run-silo-3-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | ADVERTISEDIP=`RetrieveIp` 7 | PRIMARYADDRESS=`RetrieveIp` 8 | GATEWAYPORT=3003 9 | DASHBOARDPORT=8083 10 | SILOPORT=2003 11 | PRIMARYPORT=2001 12 | 13 | docker build -t silo-host-cluster -f ./ops/SiloHost/Dockerfile ./ && 14 | docker run -d -e ADVERTISEDIP=$ADVERTISEDIP -e GATEWAYPORT=$GATEWAYPORT -e SILOPORT=$SILOPORT -e PRIMARYPORT=$PRIMARYPORT -e DASHBOARDPORT=$DASHBOARDPORT\ 15 | -e PRIMARYADDRESS=$PRIMARYADDRESS -p $GATEWAYPORT:$GATEWAYPORT -p $SILOPORT:$SILOPORT -p $DASHBOARDPORT:$DASHBOARDPORT --rm silo-host-cluster -------------------------------------------------------------------------------- /1b/Grains/src/GrainActivatorHostedService.fs: -------------------------------------------------------------------------------- 1 | module Grains.GrainActivatorHostedService 2 | 3 | open System 4 | open System.Threading 5 | open Microsoft.Extensions.Hosting 6 | open Orleans 7 | 8 | type GrainActivatorHostedService(client: IGrainFactory) = 9 | inherit BackgroundService() 10 | let _client = client 11 | 12 | override this.ExecuteAsync(_: CancellationToken) = 13 | task { 14 | let! _ = 15 | _client 16 | .GetGrain(Guid.NewGuid().ToString()) 17 | .WakeUp() 18 | 19 | System.Threading.Tasks.Task.CompletedTask 20 | |> ignore 21 | } -------------------------------------------------------------------------------- /1b/ops/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/SiloHost/src/ 5 | 6 | COPY ./Grains/Grains.fsproj /src/Grains/Grains.fsproj 7 | COPY ./Grains/src/* /src/Grains/src/ 8 | 9 | COPY ./ops/entrypoint.sh /SiloHost/ 10 | 11 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 12 | 13 | 14 | # final stage/image 15 | FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine 16 | 17 | WORKDIR /SiloHost 18 | COPY --from=build /SiloHost ./ 19 | EXPOSE 3000 8080 20 | 21 | RUN chmod +x entrypoint.sh 22 | CMD ["dotnet", "SiloHost.dll"] 23 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /1c/Grains/src/GrainActivatorHostedService.fs: -------------------------------------------------------------------------------- 1 | module Grains.GrainActivatorHostedService 2 | 3 | open System 4 | open System.Threading 5 | open Microsoft.Extensions.Hosting 6 | open Orleans 7 | 8 | type GrainActivatorHostedService(client: IGrainFactory) = 9 | inherit BackgroundService() 10 | let _client = client 11 | 12 | override this.ExecuteAsync(_: CancellationToken) = 13 | task { 14 | let! _ = 15 | _client 16 | .GetGrain(Guid.NewGuid().ToString()) 17 | .WakeUp() 18 | 19 | System.Threading.Tasks.Task.CompletedTask 20 | |> ignore 21 | } -------------------------------------------------------------------------------- /1b/SiloHost/src/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Grains; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Microsoft.Extensions.Hosting; 5 | using Orleans; 6 | using Orleans.Hosting; 7 | 8 | [assembly: GenerateCodeForDeclaringAssembly(typeof(Grains.YourReminderGrain))] 9 | 10 | using var host = new HostBuilder() 11 | .UseOrleans(builder => 12 | { 13 | builder.UseLocalhostClustering(); 14 | builder.UseInMemoryReminderService(); 15 | builder.UseDashboard(); 16 | builder.ConfigureServices(_ => _.AddHostedService()); 17 | }) 18 | .UseConsoleLifetime() 19 | .Build(); 20 | 21 | await host.StartAsync(); 22 | 23 | Console.ReadLine(); -------------------------------------------------------------------------------- /5a/ops/Client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine as build 2 | 3 | WORKDIR /src 4 | 5 | COPY ./Client/Client.fsproj /src/Client/ 6 | COPY ./Client/src/ /src/Client/src/ 7 | 8 | COPY ./Interfaces/Interfaces.fsproj /src/Interfaces/ 9 | COPY ./Interfaces/src/ /src/Interfaces/src/ 10 | 11 | COPY ./OrleansConfiguration/* /src/OrleansConfiguration/ 12 | 13 | COPY ./ops/Client/entrypoint.sh /Client/ 14 | 15 | RUN dotnet publish --verbosity normal "./Client/Client.fsproj" --configuration Release --output /Client 16 | 17 | # final stage/image 18 | FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine 19 | 20 | WORKDIR /Client 21 | COPY --from=build /Client ./ 22 | 23 | CMD ["dotnet", "Client.dll"] 24 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /7/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | all 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /8/Grains/Grains.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | all 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /1c/Grains/Grains.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /1c/Grains/src/YourGrainService.fs: -------------------------------------------------------------------------------- 1 | namespace Grains 2 | 3 | open System 4 | open System.Threading.Tasks 5 | open Microsoft.Extensions.Logging 6 | open Orleans.Concurrency 7 | open Orleans.Runtime 8 | open Orleans.Services 9 | 10 | type IYourGrainService = 11 | inherit IGrainService 12 | 13 | abstract member HelloWorld : unit -> Task 14 | 15 | [] 16 | type YourGrainService( 17 | grainId: GrainId, 18 | silo: Silo, 19 | loggerFactory: ILoggerFactory) = 20 | inherit GrainService(grainId, silo, loggerFactory) 21 | 22 | interface IYourGrainService with 23 | member this.HelloWorld() = task{ 24 | Console.WriteLine("Hello from Grain Service") 25 | Task.CompletedTask |> ignore 26 | } 27 | -------------------------------------------------------------------------------- /1c/SiloHost/SiloHost.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net9.0 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /8/Api/src/OrleansSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Api 4 | { 5 | public class OrleansSettings : IOrleansSettings 6 | { 7 | public string AwsRegion { get; set; } 8 | 9 | public string MembershipTable { get; set; } 10 | 11 | public void Validate() 12 | { 13 | if (string.IsNullOrEmpty(AwsRegion) || string.IsNullOrEmpty(MembershipTable)) 14 | { 15 | throw new InvalidOperationException($"Orleans settings are missing: {AwsRegion} - {MembershipTable}"); 16 | } 17 | } 18 | } 19 | 20 | public interface IOrleansSettings 21 | { 22 | string AwsRegion { get; set; } 23 | string MembershipTable { get; set; } 24 | 25 | void Validate(); 26 | } 27 | } -------------------------------------------------------------------------------- /5a/Grains/Grains.fsproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /1b/SiloHost/SiloHost.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net7.0 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /2/Client/Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /3/Client/Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /3a/Client/Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /3b/Client/Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /4/Client/Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /4b/Client/Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /5/Client/Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /1b/readme.md: -------------------------------------------------------------------------------- 1 | # readme 2 | 3 | This is the most basic setup: only one silo, localhost clustering, no clients, one reminder grain. For the purpose of the exercise, it will be acting on its own and not part of a distributed cluster 4 | 5 | ## run 6 | 7 | To run, use any of the methods listed below: 8 | 9 | * `./run-silo-local.sh` 10 | * `./run-silo-docker.sh` 11 | * run it from your IDE 12 | 13 | To verify everything is working correctly: 14 | 15 | * Dashboard: http://localhost:8081 16 | * Dashboard if running with Docker http://localhost:3000 17 | 18 | Provided the ports are not changed. 19 | 20 | This project also supports dev containers and has the required files to run within dev containers. See [here](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) for explanation of dev containers -------------------------------------------------------------------------------- /3/ops/SiloHost/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/SiloHost/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./Grains/Grains.csproj /src/Grains/Grains.csproj 10 | COPY ./Grains/src/* /src/Grains/ 11 | 12 | COPY ./ops/SiloHost/entrypoint.sh /SiloHost/ 13 | 14 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 15 | 16 | # final stage/image 17 | FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine 18 | 19 | WORKDIR /SiloHost 20 | COPY --from=build /SiloHost ./ 21 | EXPOSE 3000 8080 22 | 23 | CMD ["dotnet", "SiloHost.dll"] 24 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /8/Api/src/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.Hosting; 4 | 5 | namespace Api 6 | { 7 | public class Program 8 | { 9 | public static void Main(string[] args) 10 | { 11 | CreateHostBuilder(args).Build().Run(); 12 | } 13 | 14 | public static IHostBuilder CreateHostBuilder(string[] args) => 15 | Host.CreateDefaultBuilder(args) 16 | .ConfigureWebHostDefaults(webBuilder => 17 | { 18 | webBuilder.UseStartup(); 19 | }) 20 | .ConfigureAppConfiguration(configurationBuilder => 21 | { 22 | configurationBuilder.AddEnvironmentVariables(); 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /2/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "run silo host", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "preLaunchTask": "build silo host", 9 | "program": "${workspaceFolder}/SiloHost/bin/Debug/net5.0/SiloHost.dll", 10 | "args": [], 11 | "cwd": "${workspaceFolder}/SiloHost", 12 | "console": "internalConsole", 13 | "stopAtEntry": false 14 | }, 15 | { 16 | "name": "run client", 17 | "type": "coreclr", 18 | "request": "launch", 19 | "preLaunchTask": "build client", 20 | "program": "${workspaceFolder}/Client/bin/Debug/net5.0/Client.dll", 21 | "args": [], 22 | "cwd": "${workspaceFolder}/Client", 23 | "console": "internalConsole", 24 | "stopAtEntry": false 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /3/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "run silo host", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "preLaunchTask": "build silo host", 9 | "program": "${workspaceFolder}/SiloHost/bin/Debug/net5.0/SiloHost.dll", 10 | "args": [], 11 | "cwd": "${workspaceFolder}/SiloHost", 12 | "console": "internalConsole", 13 | "stopAtEntry": false 14 | }, 15 | { 16 | "name": "run client", 17 | "type": "coreclr", 18 | "request": "launch", 19 | "preLaunchTask": "build client", 20 | "program": "${workspaceFolder}/Client/bin/Debug/net5.0/Client.dll", 21 | "args": [], 22 | "cwd": "${workspaceFolder}/Client", 23 | "console": "internalConsole", 24 | "stopAtEntry": false 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /3a/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "run silo host", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "preLaunchTask": "build silo host", 9 | "program": "${workspaceFolder}/SiloHost/bin/Debug/net5.0/SiloHost.dll", 10 | "args": [], 11 | "cwd": "${workspaceFolder}/SiloHost", 12 | "console": "internalConsole", 13 | "stopAtEntry": false 14 | }, 15 | { 16 | "name": "run client", 17 | "type": "coreclr", 18 | "request": "launch", 19 | "preLaunchTask": "build client", 20 | "program": "${workspaceFolder}/Client/bin/Debug/net5.0/Client.dll", 21 | "args": [], 22 | "cwd": "${workspaceFolder}/Client", 23 | "console": "internalConsole", 24 | "stopAtEntry": false 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /3b/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "run silo host", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "preLaunchTask": "build silo host", 9 | "program": "${workspaceFolder}/SiloHost/bin/Debug/net5.0/SiloHost.dll", 10 | "args": [], 11 | "cwd": "${workspaceFolder}/SiloHost", 12 | "console": "internalConsole", 13 | "stopAtEntry": false 14 | }, 15 | { 16 | "name": "run client", 17 | "type": "coreclr", 18 | "request": "launch", 19 | "preLaunchTask": "build client", 20 | "program": "${workspaceFolder}/Client/bin/Debug/net5.0/Client.dll", 21 | "args": [], 22 | "cwd": "${workspaceFolder}/Client", 23 | "console": "internalConsole", 24 | "stopAtEntry": false 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /3c/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "run silo host", 6 | "type": "coreclr", 7 | "request": "launch", 8 | "preLaunchTask": "build silo host", 9 | "program": "${workspaceFolder}/SiloHost/bin/Debug/net5.0/SiloHost.dll", 10 | "args": [], 11 | "cwd": "${workspaceFolder}/SiloHost", 12 | "console": "internalConsole", 13 | "stopAtEntry": false 14 | }, 15 | { 16 | "name": "run client", 17 | "type": "coreclr", 18 | "request": "launch", 19 | "preLaunchTask": "build client", 20 | "program": "${workspaceFolder}/Client/bin/Debug/net5.0/Client.dll", 21 | "args": [], 22 | "cwd": "${workspaceFolder}/Client", 23 | "console": "internalConsole", 24 | "stopAtEntry": false 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /1a/SiloHost/src/Controllers/DummyTestsController.fs: -------------------------------------------------------------------------------- 1 | namespace SiloHost.Controllers 2 | 3 | open System 4 | open System.Threading.Tasks 5 | open Grains 6 | open Microsoft.AspNetCore.Mvc 7 | open Microsoft.Extensions.Logging 8 | open Orleans 9 | 10 | [] 11 | [] 12 | type DummyController(logger: ILogger, clusterClient: IClusterClient) = 13 | inherit ControllerBase() 14 | 15 | [] 16 | member _.Get() : Task = 17 | let grain = clusterClient.GetGrain(Int64.MinValue) 18 | let g = new GrainCancellationTokenSource() 19 | task { 20 | let! results = [| 21 | grain.DummyTest1 "a" g.Token 22 | grain.DummyTest2 "b" g.Token |] |> Task.WhenAll 23 | return $"{results.[0]}, {results.[1]}" 24 | } -------------------------------------------------------------------------------- /3a/ops/SiloHost/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/SiloHost/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./Grains/Grains.csproj /src/Grains/Grains.csproj 10 | COPY ./Grains/src/* /src/Grains/ 11 | 12 | COPY ./ops/SiloHost/entrypoint.sh /SiloHost/ 13 | 14 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 15 | 16 | EXPOSE 3000 8080 17 | 18 | # final stage/image 19 | FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine 20 | 21 | WORKDIR /SiloHost 22 | COPY --from=build /SiloHost ./ 23 | EXPOSE 3000 8080 24 | 25 | CMD ["dotnet", "SiloHost.dll"] 26 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /4/ops/SiloHost/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/SiloHost/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./Grains/Grains.csproj /src/Grains/Grains.csproj 10 | COPY ./Grains/src/* /src/Grains/ 11 | 12 | COPY ./ops/SiloHost/entrypoint.sh /SiloHost/ 13 | 14 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 15 | 16 | EXPOSE 3000 8080 17 | 18 | # final stage/image 19 | FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine 20 | 21 | WORKDIR /SiloHost 22 | COPY --from=build /SiloHost ./ 23 | EXPOSE 3000 8080 24 | 25 | CMD ["dotnet", "SiloHost.dll"] 26 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /4b/ops/SiloHost/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/SiloHost/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./Grains/Grains.csproj /src/Grains/Grains.csproj 10 | COPY ./Grains/src/* /src/Grains/ 11 | 12 | COPY ./ops/SiloHost/entrypoint.sh /SiloHost/ 13 | 14 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 15 | 16 | EXPOSE 3000 8080 17 | 18 | # final stage/image 19 | FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine 20 | 21 | WORKDIR /SiloHost 22 | COPY --from=build /SiloHost ./ 23 | EXPOSE 3000 8080 24 | 25 | CMD ["dotnet", "SiloHost.dll"] 26 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /3c/Grains/src/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Interfaces; 7 | using NLua; 8 | 9 | namespace Grains 10 | { 11 | public class HelloWorld : Orleans.Grain, IHelloWorld 12 | { 13 | public Task Factorial(int n) 14 | { 15 | var luaString = File.ReadAllText("HelloWorld.lua"); 16 | Int64 result; 17 | 18 | using (var lua = new Lua()) 19 | { 20 | lua.State.Encoding = Encoding.UTF8; 21 | lua.DoString(luaString); 22 | 23 | var factorialFunction = lua["factorial"] as LuaFunction; 24 | result = (Int64)factorialFunction.Call(n).First(); 25 | } 26 | 27 | return Task.FromResult(result); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /3c/ops/SiloHost/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/SiloHost/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./Grains/Grains.csproj /src/Grains/Grains.csproj 10 | COPY ./Grains/src/* /src/Grains/ 11 | 12 | COPY ./ops/SiloHost/entrypoint.sh /SiloHost/ 13 | COPY ./HelloWorld.lua /SiloHost/ 14 | 15 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 16 | 17 | # final stage/image 18 | FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine 19 | 20 | WORKDIR /SiloHost 21 | COPY --from=build /SiloHost ./ 22 | EXPOSE 3000 8080 5000 23 | 24 | CMD ["dotnet", "SiloHost.dll"] 25 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /3c/Client/Client.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /3a/Grains/src/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Interfaces; 4 | using Orleans.Runtime; 5 | 6 | namespace Grains 7 | { 8 | public class HelloWorld : Orleans.Grain, IHelloWorld 9 | { 10 | private readonly IPersistentState _helloWorldState; 11 | 12 | public HelloWorld([PersistentState("helloWorldState", "helloWorldStore")] 13 | IPersistentState helloWorldState) 14 | { 15 | _helloWorldState = helloWorldState; 16 | } 17 | 18 | public async Task SayHello(string name) 19 | { 20 | var now = DateTime.UtcNow; 21 | 22 | _helloWorldState.State.GreetingTimeUtc = now; 23 | 24 | await _helloWorldState.WriteStateAsync(); 25 | 26 | return $@"Hello {name}! Sent at {now}."; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /5/ops/SiloHost/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/SiloHost/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./Grains/Grains.csproj /src/Grains/Grains.csproj 10 | COPY ./Grains/src/* /src/Grains/ 11 | 12 | COPY ./Library/* /src/Library/ 13 | 14 | COPY ./ops/SiloHost/entrypoint.sh /SiloHost/ 15 | 16 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 17 | 18 | EXPOSE 3000 8080 19 | 20 | # final stage/image 21 | FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine 22 | 23 | WORKDIR /SiloHost 24 | COPY --from=build /SiloHost ./ 25 | EXPOSE 3000 8080 26 | 27 | CMD ["dotnet", "SiloHost.dll"] 28 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /6/ops/SiloHost/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/SiloHost/ 5 | 6 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 7 | COPY ./Interfaces/src/* /src/Interfaces/ 8 | 9 | COPY ./Grains/Grains.csproj /src/Grains/Grains.csproj 10 | COPY ./Grains/src/* /src/Grains/ 11 | 12 | COPY ./Library/* /src/Library/ 13 | 14 | COPY ./ops/SiloHost/entrypoint.sh /SiloHost/ 15 | 16 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 17 | 18 | EXPOSE 3000 8080 19 | 20 | # final stage/image 21 | FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine 22 | 23 | WORKDIR /SiloHost 24 | COPY --from=build /SiloHost ./ 25 | EXPOSE 3000 8080 26 | 27 | CMD ["dotnet", "SiloHost.dll"] 28 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /3c/Client/src/HelloWorldClientHostedService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Interfaces; 5 | using Microsoft.Extensions.Hosting; 6 | using Orleans; 7 | 8 | namespace Client 9 | { 10 | public class HelloWorldClientHostedService : IHostedService 11 | { 12 | private readonly IClusterClient _clusterClient; 13 | 14 | public HelloWorldClientHostedService(IClusterClient clusterClient) 15 | { 16 | _clusterClient = clusterClient; 17 | } 18 | 19 | public async Task StartAsync(CancellationToken cancellationToken) 20 | { 21 | var helloWorldGrain = _clusterClient.GetGrain(0); 22 | Console.WriteLine($"{await helloWorldGrain.Factorial(3)}"); 23 | } 24 | 25 | public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; 26 | } 27 | } -------------------------------------------------------------------------------- /2/Client/src/HelloWorldClientHostedService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Interfaces; 5 | using Microsoft.Extensions.Hosting; 6 | using Orleans; 7 | 8 | namespace Client 9 | { 10 | public class HelloWorldClientHostedService : IHostedService 11 | { 12 | private readonly IClusterClient _clusterClient; 13 | 14 | public HelloWorldClientHostedService(IClusterClient clusterClient) 15 | { 16 | _clusterClient = clusterClient; 17 | } 18 | 19 | public async Task StartAsync(CancellationToken cancellationToken) 20 | { 21 | var helloWorldGrain = _clusterClient.GetGrain(0); 22 | Console.WriteLine($"{await helloWorldGrain.SayHello("Piotr")}"); 23 | } 24 | 25 | public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; 26 | } 27 | } -------------------------------------------------------------------------------- /3/Client/src/HelloWorldClientHostedService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Interfaces; 5 | using Microsoft.Extensions.Hosting; 6 | using Orleans; 7 | 8 | namespace Client 9 | { 10 | public class HelloWorldClientHostedService : IHostedService 11 | { 12 | private readonly IClusterClient _clusterClient; 13 | 14 | public HelloWorldClientHostedService(IClusterClient clusterClient) 15 | { 16 | _clusterClient = clusterClient; 17 | } 18 | 19 | public async Task StartAsync(CancellationToken cancellationToken) 20 | { 21 | var helloWorldGrain = _clusterClient.GetGrain(0); 22 | Console.WriteLine($"{await helloWorldGrain.SayHello("Piotr")}"); 23 | } 24 | 25 | public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; 26 | } 27 | } -------------------------------------------------------------------------------- /3a/Client/src/HelloWorldClientHostedService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Interfaces; 5 | using Microsoft.Extensions.Hosting; 6 | using Orleans; 7 | 8 | namespace Client 9 | { 10 | public class HelloWorldClientHostedService : IHostedService 11 | { 12 | private readonly IClusterClient _clusterClient; 13 | 14 | public HelloWorldClientHostedService(IClusterClient clusterClient) 15 | { 16 | _clusterClient = clusterClient; 17 | } 18 | 19 | public async Task StartAsync(CancellationToken cancellationToken) 20 | { 21 | var helloWorldGrain = _clusterClient.GetGrain(1); 22 | Console.WriteLine($"{await helloWorldGrain.SayHello("Piotr")}"); 23 | } 24 | 25 | public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; 26 | } 27 | } -------------------------------------------------------------------------------- /3b/Client/src/HelloWorldClientHostedService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Interfaces; 5 | using Microsoft.Extensions.Hosting; 6 | using Orleans; 7 | 8 | namespace Client 9 | { 10 | public class HelloWorldClientHostedService : IHostedService 11 | { 12 | private readonly IClusterClient _clusterClient; 13 | 14 | public HelloWorldClientHostedService(IClusterClient clusterClient) 15 | { 16 | _clusterClient = clusterClient; 17 | } 18 | 19 | public async Task StartAsync(CancellationToken cancellationToken) 20 | { 21 | var helloWorldGrain = _clusterClient.GetGrain(0); 22 | Console.WriteLine($"{await helloWorldGrain.SayHello("Piotr")}"); 23 | } 24 | 25 | public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; 26 | } 27 | } -------------------------------------------------------------------------------- /5a/ops/SiloHost/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine as build 2 | 3 | WORKDIR /src 4 | 5 | COPY ./SiloHost/SiloHost.fsproj /src/SiloHost/ 6 | COPY ./SiloHost/src/ /src/SiloHost/src/ 7 | 8 | COPY ./Interfaces/Interfaces.fsproj /src/Interfaces/ 9 | COPY ./Interfaces/src/ /src/Interfaces/src/ 10 | 11 | COPY ./Grains/Grains.fsproj /src/Grains/ 12 | COPY ./Grains/src/ /src/Grains/src 13 | 14 | COPY ./Library/* /src/Library/ 15 | 16 | COPY ./OrleansConfiguration/* /src/OrleansConfiguration/ 17 | 18 | COPY ./ops/SiloHost/entrypoint.sh /SiloHost/ 19 | 20 | RUN dotnet publish --verbosity normal "./SiloHost/SiloHost.fsproj" --configuration Release --output /SiloHost 21 | 22 | # final stage/image 23 | FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine 24 | 25 | WORKDIR /SiloHost 26 | COPY --from=build /SiloHost ./ 27 | EXPOSE 3000 8080 28 | 29 | CMD ["dotnet", "SiloHost.dll"] 30 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /3c/SiloHost/src/Controllers/HelloWorldController.cs: -------------------------------------------------------------------------------- 1 | using Interfaces; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Orleans; 4 | 5 | namespace SiloHost.Controllers 6 | { 7 | [ApiController] 8 | [Route("[controller]")] 9 | public class HelloWorldController : ControllerBase 10 | { 11 | private readonly IClusterClient _clusterClient; 12 | private readonly Random _generator; 13 | 14 | public HelloWorldController( 15 | IClusterClient clusterClient) 16 | { 17 | _clusterClient = clusterClient; 18 | _generator = new Random(); 19 | } 20 | 21 | [HttpGet] 22 | public async Task Get( 23 | int n, 24 | CancellationToken cancellationToken) 25 | { 26 | var grain = _clusterClient.GetGrain(1); 27 | return await grain.Factorial(n); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /3b/run-silo-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 2020-12-07 PJ: 4 | # Code below gets local IP for dockerized applications to function and communicate correctly. 5 | ADVERTISEDIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1'` 6 | GATEWAYPORT='3000' 7 | DASHBOARDPORT='8080' 8 | DATADOG_SERVICE_NAME='road-to-orleans-3b' 9 | DATADOG_ENVIRONMENT='dev' 10 | DATADOG_API_KEY='API_KEY_HERE' 11 | ENVIRONMENT_VARIABLES_FILE="./ops/SiloHost/$DATADOG_ENVIRONMENT.env" 12 | 13 | echo "ADVERTISEDIP=$ADVERTISEDIP 14 | DATADOG_SERVICE_NAME=$DATADOG_SERVICE_NAME 15 | DATADOG_ENVIRONMENT=$DATADOG_ENVIRONMENT 16 | DATADOG_API_KEY=$DATADOG_API_KEY 17 | GATEWAYPORT=$GATEWAYPORT 18 | DASHBOARDPORT=$DASHBOARDPORT" > $ENVIRONMENT_VARIABLES_FILE 19 | 20 | docker build -t silo-host -f ./ops/SiloHost/Dockerfile ./ && 21 | docker-compose --env-file $ENVIRONMENT_VARIABLES_FILE -f ./ops/SiloHost/docker-compose.yml up -------------------------------------------------------------------------------- /7/Library.UnitTests/Tests.fs: -------------------------------------------------------------------------------- 1 | module UnitTests.Tests 2 | 3 | open Xunit 4 | open Library 5 | 6 | [] 7 | let ``Library Valid String Input Test`` () = 8 | let result = Say.hello("Mereta") 9 | Assert.Equal("Hello, \"Mereta\"! Your name is 6 characters long.", result) 10 | 11 | [] 12 | let ``Library Empty String Input Throws Exception`` () = 13 | Assert.Throws((fun () -> Say.hello "" |> ignore)) 14 | 15 | [] 16 | let ``Library Whitespace String Input Throws Exception`` () = 17 | Assert.Throws((fun () -> Say.hello "\t" |> ignore)) 18 | 19 | [] 20 | let ``Library Exception Messgage Test`` () = 21 | let ex = Assert.Throws((fun () -> Say.hello "" |> ignore)); 22 | Assert.Equal("string cannot be null or whitespace (Parameter 'name')" , ex.Message); 23 | Assert.Same(typeof, ex.GetType()) 24 | 25 | 26 | -------------------------------------------------------------------------------- /7/ops/SiloHost/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/SiloHost/ 5 | COPY ./SiloHost/appsettings.json /src/SiloHost/ 6 | 7 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 8 | COPY ./Interfaces/src/* /src/Interfaces/ 9 | 10 | COPY ./Grains/Grains.csproj /src/Grains/Grains.csproj 11 | COPY ./Grains/src/* /src/Grains/ 12 | 13 | COPY ./Library/* /src/Library/ 14 | 15 | COPY ./ops/SiloHost/entrypoint.sh /SiloHost/ 16 | 17 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 18 | 19 | EXPOSE 3000 8080 20 | 21 | # final stage/image 22 | FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine 23 | 24 | WORKDIR /SiloHost 25 | COPY --from=build /SiloHost ./ 26 | EXPOSE 3000 8080 27 | 28 | CMD ["dotnet", "SiloHost.dll"] 29 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /8/Library.UnitTests/Tests.fs: -------------------------------------------------------------------------------- 1 | module UnitTests.Tests 2 | 3 | open Xunit 4 | open Library 5 | 6 | [] 7 | let ``Library Valid String Input Test`` () = 8 | let result = Say.hello("Mereta") 9 | Assert.Equal("Hello, \"Mereta\"! Your name is 6 characters long.", result) 10 | 11 | [] 12 | let ``Library Empty String Input Throws Exception`` () = 13 | Assert.Throws((fun () -> Say.hello "" |> ignore)) 14 | 15 | [] 16 | let ``Library Whitespace String Input Throws Exception`` () = 17 | Assert.Throws((fun () -> Say.hello "\t" |> ignore)) 18 | 19 | [] 20 | let ``Library Exception Messgage Test`` () = 21 | let ex = Assert.Throws((fun () -> Say.hello "" |> ignore)); 22 | Assert.Equal("string cannot be null or whitespace (Parameter 'name')" , ex.Message); 23 | Assert.Same(typeof, ex.GetType()) 24 | 25 | 26 | -------------------------------------------------------------------------------- /5/UnitTests/src/UnitTests/Tests.fs: -------------------------------------------------------------------------------- 1 | module UnitTests.Tests 2 | 3 | open Xunit 4 | open Library 5 | 6 | [] 7 | let ``Library Valid String Input Test`` () = 8 | let result = Say.hello("Mereta") 9 | Assert.Equal("Hello, \"Mereta\"! Your name is 6 characters long.", result) 10 | 11 | [] 12 | let ``Library Empty String Input Throws Exception`` () = 13 | Assert.Throws((fun () -> Say.hello "" |> ignore)) 14 | 15 | [] 16 | let ``Library Whitespace String Input Throws Exception`` () = 17 | Assert.Throws((fun () -> Say.hello "\t" |> ignore)) 18 | 19 | [] 20 | let ``Library Exception Messgage Test`` () = 21 | let ex = Assert.Throws((fun () -> Say.hello "" |> ignore)); 22 | Assert.Equal("string cannot be null or whitespace (Parameter 'name')" , ex.Message); 23 | Assert.Same(typeof, ex.GetType()) 24 | 25 | 26 | -------------------------------------------------------------------------------- /5a/UnitTests/src/UnitTests/Tests.fs: -------------------------------------------------------------------------------- 1 | module UnitTests.Tests 2 | 3 | open Xunit 4 | open Library 5 | 6 | [] 7 | let ``Library Valid String Input Test`` () = 8 | let result = Say.hello("Mereta") 9 | Assert.Equal("Hello, \"Mereta\"! Your name is 6 characters long.", result) 10 | 11 | [] 12 | let ``Library Empty String Input Throws Exception`` () = 13 | Assert.Throws((fun () -> Say.hello "" |> ignore)) 14 | 15 | [] 16 | let ``Library Whitespace String Input Throws Exception`` () = 17 | Assert.Throws((fun () -> Say.hello "\t" |> ignore)) 18 | 19 | [] 20 | let ``Library Exception Messgage Test`` () = 21 | let ex = Assert.Throws((fun () -> Say.hello "" |> ignore)); 22 | Assert.Equal("string cannot be null or whitespace (Parameter 'name')" , ex.Message); 23 | Assert.Same(typeof, ex.GetType()) 24 | 25 | 26 | -------------------------------------------------------------------------------- /6/UnitTests/src/UnitTests/Tests.fs: -------------------------------------------------------------------------------- 1 | module UnitTests.Tests 2 | 3 | open Xunit 4 | open Library 5 | 6 | [] 7 | let ``Library Valid String Input Test`` () = 8 | let result = Say.hello("Mereta") 9 | Assert.Equal("Hello, \"Mereta\"! Your name is 6 characters long.", result) 10 | 11 | [] 12 | let ``Library Empty String Input Throws Exception`` () = 13 | Assert.Throws((fun () -> Say.hello "" |> ignore)) 14 | 15 | [] 16 | let ``Library Whitespace String Input Throws Exception`` () = 17 | Assert.Throws((fun () -> Say.hello "\t" |> ignore)) 18 | 19 | [] 20 | let ``Library Exception Messgage Test`` () = 21 | let ex = Assert.Throws((fun () -> Say.hello "" |> ignore)); 22 | Assert.Equal("string cannot be null or whitespace (Parameter 'name')" , ex.Message); 23 | Assert.Same(typeof, ex.GetType()) 24 | 25 | 26 | -------------------------------------------------------------------------------- /8/ops/SiloHost/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine as build 2 | 3 | COPY ./SiloHost/SiloHost.csproj /src/SiloHost/SiloHost.csproj 4 | COPY ./SiloHost/src/* /src/SiloHost/ 5 | COPY ./SiloHost/appsettings.json /src/SiloHost/ 6 | 7 | COPY ./Interfaces/Interfaces.csproj /src/Interfaces/Interfaces.csproj 8 | COPY ./Interfaces/src/* /src/Interfaces/ 9 | 10 | COPY ./Grains/Grains.csproj /src/Grains/Grains.csproj 11 | COPY ./Grains/src/* /src/Grains/ 12 | 13 | COPY ./Library/* /src/Library/ 14 | 15 | COPY ./ops/SiloHost/entrypoint.sh /SiloHost/ 16 | 17 | RUN dotnet publish --verbosity normal "/src/SiloHost/SiloHost.csproj" --configuration Release --output /SiloHost 18 | 19 | EXPOSE 3000 8080 20 | 21 | # final stage/image 22 | FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine 23 | 24 | WORKDIR /SiloHost 25 | COPY --from=build /SiloHost ./ 26 | EXPOSE 3000 8080 27 | 28 | CMD ["dotnet", "SiloHost.dll"] 29 | ENTRYPOINT ["./entrypoint.sh"] 30 | -------------------------------------------------------------------------------- /1b/Grains/src/Library.fs: -------------------------------------------------------------------------------- 1 | namespace Grains 2 | 3 | open System 4 | open System.Threading 5 | open System.Threading.Tasks 6 | open Orleans 7 | 8 | type IYourReminderGrain = 9 | inherit IGrainWithStringKey 10 | inherit IRemindable 11 | 12 | abstract member WakeUp : unit -> Task 13 | 14 | type YourReminderGrain() = 15 | inherit Grain() 16 | interface IYourReminderGrain with 17 | member this.WakeUp() = Task.CompletedTask 18 | member this.ReceiveReminder(reminderName, status) = 19 | Console.WriteLine(reminderName, status) 20 | Task.CompletedTask 21 | 22 | override _.OnActivateAsync(cancellationToken:CancellationToken) = 23 | let _periodInSeconds = TimeSpan.FromSeconds 60 24 | let _timeInSeconds = TimeSpan.FromSeconds 60 25 | let _reminder = base.RegisterOrUpdateReminder(base.GetPrimaryKeyString(), _periodInSeconds, _timeInSeconds) 26 | base.OnActivateAsync(cancellationToken) 27 | -------------------------------------------------------------------------------- /1c/SiloHost/src/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Grains; 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Microsoft.Extensions.Hosting; 5 | using Orleans; 6 | using Orleans.Hosting; 7 | 8 | [assembly: GenerateCodeForDeclaringAssembly(typeof(Grains.YourReminderGrain))] 9 | 10 | using var host = new HostBuilder() 11 | .UseOrleans(builder => 12 | { 13 | builder.UseLocalhostClustering(); 14 | builder.UseInMemoryReminderService(); 15 | builder.UseDashboard(); 16 | builder.ConfigureServices(serviceCollection => 17 | { 18 | serviceCollection.AddSingleton(); 19 | serviceCollection.AddGrainService(); 20 | serviceCollection.AddHostedService(); 21 | }); 22 | }) 23 | .UseConsoleLifetime() 24 | .Build(); 25 | 26 | await host.StartAsync(); 27 | 28 | Console.ReadLine(); -------------------------------------------------------------------------------- /8/run-silo-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | RetrieveIp(){ 3 | ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v -m1 '127.0.0.1' 4 | } 5 | 6 | export OrleansHostSettings__AdvertisedIp=`RetrieveIp` 7 | export OrleansHostSettings__GatewayPort=3001 8 | export OrleansHostSettings__DashboardPort=8081 9 | export OrleansHostSettings__SiloPort=2001 10 | export OrleansHostSettings__MembershipTableName="some-table-name" 11 | export OrleansHostSettings__AwsRegion="us-west-2" 12 | export OrleansHostSettings__IsLocal=true 13 | 14 | export AWS_REGION=$(awk -F '=' '/^region/ { print $2 }' ~/.aws/credentials) 15 | export AWS_SECRET_ACCESS_KEY=$(awk -F '=' '/^aws_secret_access_key/ { print $2 }' ~/.aws/credentials) 16 | export AWS_SESSION_TOKEN=$(awk -F '=' '/^aws_session_token/ { print $2 }' ~/.aws/credentials) 17 | export AWS_ACCESS_KEY_ID=$(awk -F '=' '/^aws_access_key_id/ { print $2 }' ~/.aws/credentials) 18 | 19 | dotnet run --no-launch-profile --project ./SiloHost/SiloHost.csproj -------------------------------------------------------------------------------- /1/SiloHost/SiloHost.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | true 7 | true 8 | 9 | 10 | 11 | 12 | 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | all 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /7/Grains/src/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | using Interfaces; 2 | using Library; 3 | using Orleans; 4 | using System.Threading.Tasks; 5 | using Microsoft.FeatureManagement; 6 | 7 | namespace Grains 8 | { 9 | public class HelloWorld : Grain, IHelloWorld 10 | { 11 | private readonly IFeatureManagerSnapshot _featureManagerSnapshot; 12 | public HelloWorld(IFeatureManagerSnapshot featureManagerSnapshot) 13 | { 14 | _featureManagerSnapshot = featureManagerSnapshot; 15 | } 16 | public async Task SayHello(string name, GrainCancellationToken grainCancellationToken) 17 | { 18 | string result = null; 19 | 20 | if (!grainCancellationToken.CancellationToken.IsCancellationRequested && 21 | await _featureManagerSnapshot.IsEnabledAsync("FeatureA")) 22 | { 23 | result = Say.hello(name) + $" Grain reference - {IdentityString}"; 24 | } 25 | 26 | return result; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /8/Grains/src/HelloWorld.cs: -------------------------------------------------------------------------------- 1 | using Interfaces; 2 | using Library; 3 | using Orleans; 4 | using System.Threading.Tasks; 5 | using Microsoft.FeatureManagement; 6 | 7 | namespace Grains 8 | { 9 | public class HelloWorld : Grain, IHelloWorld 10 | { 11 | private readonly IFeatureManagerSnapshot _featureManagerSnapshot; 12 | public HelloWorld(IFeatureManagerSnapshot featureManagerSnapshot) 13 | { 14 | _featureManagerSnapshot = featureManagerSnapshot; 15 | } 16 | public async Task SayHello(string name, GrainCancellationToken grainCancellationToken) 17 | { 18 | string result = null; 19 | 20 | if (!grainCancellationToken.CancellationToken.IsCancellationRequested && 21 | await _featureManagerSnapshot.IsEnabledAsync("FeatureA")) 22 | { 23 | result = Say.hello(name) + $" Grain reference - {IdentityString}"; 24 | } 25 | 26 | return result; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /1c/Grains/src/Library.fs: -------------------------------------------------------------------------------- 1 | namespace Grains 2 | 3 | open System 4 | open System.Threading 5 | open System.Threading.Tasks 6 | open Orleans 7 | 8 | type IYourReminderGrain = 9 | inherit IGrainWithStringKey 10 | inherit IRemindable 11 | 12 | abstract member WakeUp : unit -> Task 13 | 14 | type YourReminderGrain(client: IYourGrainServiceClient) = 15 | inherit Grain() 16 | interface IYourReminderGrain with 17 | member this.WakeUp() = client.HelloWorld() 18 | member this.ReceiveReminder(reminderName, status) = 19 | Console.WriteLine(reminderName, status) 20 | client.HelloWorld() 21 | 22 | override _.OnActivateAsync(cancellationToken:CancellationToken) = 23 | let _periodInSeconds = TimeSpan.FromSeconds 60.0 24 | let _timeInSeconds = TimeSpan.FromSeconds 60.0 25 | let _reminder = base.RegisterOrUpdateReminder(base.GetPrimaryKeyString(), _periodInSeconds, _timeInSeconds) 26 | base.OnActivateAsync(cancellationToken) 27 | -------------------------------------------------------------------------------- /4b/Client/src/CoordinatorClientHostedService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Interfaces; 5 | using Microsoft.Extensions.Hosting; 6 | using Orleans; 7 | 8 | namespace Client 9 | { 10 | public class CoordinatorClientHostedService : IHostedService 11 | { 12 | private readonly IClusterClient _clusterClient; 13 | private readonly Random _generator; 14 | 15 | public CoordinatorClientHostedService(IClusterClient clusterClient) 16 | { 17 | _clusterClient = clusterClient; 18 | _generator = new Random(); 19 | } 20 | 21 | public async Task StartAsync(CancellationToken cancellationToken) 22 | { 23 | var coordinatorGrain = _clusterClient.GetGrain(_generator.Next(int.MaxValue)); 24 | Console.WriteLine($"{await coordinatorGrain.RunTests()}"); 25 | } 26 | 27 | public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; 28 | } 29 | } --------------------------------------------------------------------------------