Skip to content

Cross platform support #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Auto detect text files and perform LF normalization
* text=auto
*.sh text eol=lf
28 changes: 15 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,33 @@ on:
workflow_dispatch:
env:
DOTNET_NOLOGO: true
defaults:
run:
shell: pwsh
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-2022
name: Windows
#- os: ubuntu-22.04
# name: Linux
fail-fast: false
name: Linux
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Build
run: dotnet build src --configuration Release
- name: Remove executables
run: |
Remove-Item binaries/MonitoringDemo
Remove-Item binaries/Billing/Billing
Remove-Item binaries/ClientUI/ClientUI
Remove-Item binaries/PlatformLauncher/PlatformLauncher
Remove-Item binaries/Sales/Sales
Remove-Item binaries/Shipping/Shipping
- name: Publish artifacts
if: matrix.name == 'Windows'
uses: actions/[email protected]
with:
name: binaries
path: src/binaries/*
path: binaries/*
retention-days: 7
37 changes: 14 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,46 @@ on:
workflow_dispatch:
env:
DOTNET_NOLOGO: true
defaults:
run:
shell: pwsh
jobs:
release:
runs-on: windows-2022
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Build
run: dotnet build src --configuration Release
- name: Install AzureSignTool
run: dotnet tool install --global azuresigntool
- name: Sign binaries
- name: Remove executables
run: |
AzureSignTool sign `
--file-digest sha256 `
--timestamp-rfc3161 http://timestamp.digicert.com `
--azure-key-vault-url https://particularcodesigning.vault.azure.net `
--azure-key-vault-client-id ${{ secrets.AZURE_KEY_VAULT_CLIENT_ID }} `
--azure-key-vault-tenant-id ${{ secrets.AZURE_KEY_VAULT_TENANT_ID }} `
--azure-key-vault-client-secret ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }} `
--azure-key-vault-certificate ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }} `
src/binaries/MonitoringDemo.exe `
src/binaries/Billing/Billing.exe `
src/binaries/ClientUI/ClientUI.exe `
src/binaries/Platform/Platform.exe `
src/binaries/Sales/Sales.exe `
src/binaries/Shipping/Shipping.exe
shell: pwsh
Remove-Item binaries/MonitoringDemo
Remove-Item binaries/Billing/Billing
Remove-Item binaries/ClientUI/ClientUI
Remove-Item binaries/PlatformLauncher/PlatformLauncher
Remove-Item binaries/Sales/Sales
Remove-Item binaries/Shipping/Shipping
- name: Setup AWS Credentials
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESSKEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRETKEY }}
aws-region: us-east-1
- name: Deploy to S3
shell: pwsh
shell: bash
run: |
echo "Creating Particular.MonitoringDemo.zip archive"
Compress-Archive -Path ./src/binaries/* -DestinationPath ./Particular.MonitoringDemo.zip
(cd binaries && zip -r "$OLDPWD/Particular.MonitoringDemo.zip" .)

echo "Uploading zip file to AWS"
aws s3 cp ./Particular.MonitoringDemo.zip s3://particular.downloads/MonitoringDemo/Particular.MonitoringDemo.zip --content-type application/zip --acl public-read

echo "Complete"
- name: Upload dependency file to AWS
shell: pwsh
run: |
$dotnetPackages = dotnet list src/Platform package --include-transitive --format json | ConvertFrom-Json
$firstProject = $dotnetPackages.projects[0]
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**/Platform/**/db
**/bin/
**/obj/
src/binaries/**/*
binaries/**/*
**/.vs/
MonitoringDemo.Sql/support/*.log
MonitoringDemo.Sql/transport/
Expand Down
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,18 @@ Self-contained demo showing all of the monitoring components working together. T

- https://docs.particular.net/tutorials/monitoring/demo/

# Prerequisites

Running the demo requires .Net Framework 4.6.1 or newer.
## Prerequisites

In order to run the downloaded sample you will need the following prerequisites.

- Window operating system, the Particular Service Platform requires the Windows operating system
- Desktop: Windows 8 or higher
- Server: Windows Server 2016 or higher
- Powershell 3.0 or higher
- .NET Framework 4.6.1 (check version)

# Running
- .NET 8.0 or higher

## Running

- Compile `src\MonitoringDemo.sln`
- Execute `src\binaries\MonitoringDemo.exe`
- Execute `src\binaries\launch.sh` or `src\binaries\launch.ps1`

# Deploying
## Deploying

1. Go to the [Release action page](https://github.com/Particular/MonitoringDemo/actions/workflows/release.yml).
2. Click the **Run workflow** button.
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.400",
"version": "9.0.100",
"rollForward": "latestFeature"
}
}
16 changes: 9 additions & 7 deletions src/Billing/Billing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputPath>..\binaries\Billing\</OutputPath>
<ApplicationIcon>failures.ico</ApplicationIcon>
<OutputPath>..\..\binaries\Billing\</OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Messages\Messages.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="9.0.0" />
<PackageReference Include="NServiceBus.Heartbeat" Version="5.0.0" />
<PackageReference Include="NServiceBus.Metrics.ServiceControl" Version="5.0.0" />
<PackageReference Include="NServiceBus" Version="9.*" />
<PackageReference Include="NServiceBus.Heartbeat" Version="5.*" />
<PackageReference Include="NServiceBus.Metrics.ServiceControl" Version="5.*" />
</ItemGroup>

<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<ItemGroup>
<Compile Include="..\MonitoringDemo\UserInterface.cs">
<Link>UserInterface.cs</Link>
</Compile>
</ItemGroup>

</Project>
41 changes: 7 additions & 34 deletions src/Billing/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
using Microsoft.Extensions.DependencyInjection;
using Shared;

Console.Title = "Failure rate (Billing)";
Console.SetWindowSize(65, 15);

LoggingUtils.ConfigureLogging("Billing");

var endpointConfiguration = new EndpointConfiguration("Billing");
endpointConfiguration.LimitMessageProcessingConcurrencyTo(4);

Expand Down Expand Up @@ -44,35 +39,13 @@

var endpointInstance = await Endpoint.Start(endpointConfiguration);

RunUserInterfaceLoop(simulationEffects);
var nonInteractive = args.Length > 1 && bool.TryParse(args[1], out var isInteractive) && !isInteractive;
var interactive = !nonInteractive;

await endpointInstance.Stop();

void RunUserInterfaceLoop(SimulationEffects state)
UserInterface.RunLoop("Failure rate (Billing)", new Dictionary<char, (string, Action)>
{
while (true)
{
Console.Clear();
Console.WriteLine("Billing Endpoint");
Console.WriteLine("Press F to increase the simulated failure rate");
Console.WriteLine("Press S to decrease the simulated failure rate");
Console.WriteLine("Press ESC to quit");
Console.WriteLine();

state.WriteState(Console.Out);
['w'] = ("increase the simulated failure rate", () => simulationEffects.IncreaseFailureRate()),
['s'] = ("decrease the simulated failure rate", () => simulationEffects.DecreaseFailureRate())
}, writer => simulationEffects.WriteState(writer), interactive);

var input = Console.ReadKey(true);

switch (input.Key)
{
case ConsoleKey.F:
state.IncreaseFailureRate();
break;
case ConsoleKey.S:
state.DecreaseFailureRate();
break;
case ConsoleKey.Escape:
return;
}
}
}
await endpointInstance.Stop();
Binary file removed src/Billing/failures.ico
Binary file not shown.
16 changes: 9 additions & 7 deletions src/ClientUI/ClientUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputPath>..\binaries\ClientUI\</OutputPath>
<ApplicationIcon>traffic.ico</ApplicationIcon>
<OutputPath>..\..\binaries\ClientUI\</OutputPath>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Messages\Messages.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="9.0.0" />
<PackageReference Include="NServiceBus.Heartbeat" Version="5.0.0" />
<PackageReference Include="NServiceBus.Metrics.ServiceControl" Version="5.0.0" />
<PackageReference Include="NServiceBus" Version="9.*" />
<PackageReference Include="NServiceBus.Heartbeat" Version="5.*" />
<PackageReference Include="NServiceBus.Metrics.ServiceControl" Version="5.*" />
</ItemGroup>

<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<ItemGroup>
<Compile Include="..\MonitoringDemo\UserInterface.cs">
<Link>UserInterface.cs</Link>
</Compile>
</ItemGroup>

</Project>
40 changes: 8 additions & 32 deletions src/ClientUI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
using Messages;
using Shared;

Console.Title = "Load (ClientUI)";
Console.SetWindowSize(65, 15);

LoggingUtils.ConfigureLogging("ClientUI");

var endpointConfiguration = new EndpointConfiguration("ClientUI");

var serializer = endpointConfiguration.UseSerialization<SystemJsonSerializer>();
Expand Down Expand Up @@ -43,35 +38,16 @@
var cancellation = new CancellationTokenSource();
var simulatedWork = simulatedCustomers.Run(cancellation.Token);

RunUserInterfaceLoop(simulatedCustomers);

cancellation.Cancel();

await simulatedWork;
var nonInteractive = args.Length > 1 && bool.TryParse(args[1], out var isInteractive) && !isInteractive;
var interactive = !nonInteractive;

await endpointInstance.Stop();

void RunUserInterfaceLoop(SimulatedCustomers simulatedCustomers)
UserInterface.RunLoop("Load (ClientUI)", new Dictionary<char, (string, Action)>
{
while (true)
{
Console.Clear();
Console.WriteLine("Simulating customers placing orders on a website");
Console.WriteLine("Press T to toggle High/Low traffic mode");
Console.WriteLine("Press ESC to quit");
Console.WriteLine();
['c'] = ("toggle High/Low traffic mode", () => simulatedCustomers.ToggleTrafficMode()),
}, writer => simulatedCustomers.WriteState(writer), interactive);

simulatedCustomers.WriteState(Console.Out);
cancellation.Cancel();

var input = Console.ReadKey(true);
await simulatedWork;

switch (input.Key)
{
case ConsoleKey.T:
simulatedCustomers.ToggleTrafficMode();
break;
case ConsoleKey.Escape:
return;
}
}
}
await endpointInstance.Stop();
Binary file removed src/ClientUI/traffic.ico
Binary file not shown.
10 changes: 7 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
<DebugType>embedded</DebugType>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<NuGetAuditLevel>low</NuGetAuditLevel>
<NuGetAuditMode>all</NuGetAuditMode>
</PropertyGroup>

<PropertyGroup Condition="'$(CI)' != ''">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Particular.Analyzers" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Particular.Analyzers" Version="2.1.3" PrivateAssets="All" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Messages/Messages.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.MessageInterfaces" Version="1.0.0" />
<PackageReference Include="NServiceBus.MessageInterfaces" Version="1.*" />
</ItemGroup>

</Project>
Loading