Skip to content

Commit 11a3e90

Browse files
stho32claude
andcommitted
docs: Update scenarios to use provided files
- Updated all scenario documentation to reference provided files instead of instructing creation - Added complete script implementations for all scenarios: - file-sync: PowerShell file watchers and Python monitors - monitoring-alerting: Metric collectors and alert handlers - distributed-build: Build workers, schedulers, and example C# projects - Each scenario now includes ready-to-use scripts in scripts/ and python/ subdirectories - Added troubleshooting sections and best practices to each scenario - Improved German documentation consistency across all scenarios 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent fd8576c commit 11a3e90

29 files changed

+1301
-197
lines changed
Lines changed: 117 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
# Distributed Build System
22

3-
Ein verteiltes Build-System mit LocalNetAppChat.
3+
Ein verteiltes Build-System mit LocalNetAppChat. Dieses Szenario zeigt, wie Sie Build-Aufgaben auf mehrere Worker verteilen können.
4+
5+
## Bereitgestellte Dateien
6+
7+
Dieses Szenario enthält alle notwendigen Scripts und Beispielprojekte:
8+
9+
### Scripts (scripts/)
10+
- `build-task.ps1` - Einfacher Build-Worker für Beispielzwecke
11+
- `build-dotnet-project.ps1` - Vollständiger Build-Worker für .NET-Projekte
12+
- `build-status-reporter.ps1` - Status-Reporting für Build-Fortschritt
13+
14+
### Python Scripts (python/)
15+
- `build-scheduler.py` - Einfacher Build-Scheduler
16+
- `build-scheduler-advanced.py` - Erweiterter Scheduler mit Dependency-Management
17+
- `build-monitor.py` - Echtzeit-Monitoring für Build-Status
18+
19+
### Beispielprojekte (example-projects/)
20+
- `ProjectA.csproj` / `ProjectA.cs` - Standalone Konsolenanwendung
21+
- `ProjectB.csproj` / `Calculator.cs` - Bibliothek mit Calculator-Klasse
22+
- `ProjectC.csproj` / `ProjectC.cs` - Anwendung mit Abhängigkeit zu ProjectB
423

524
## Komponenten
625

@@ -10,28 +29,106 @@ Ein verteiltes Build-System mit LocalNetAppChat.
1029

1130
## Schnellstart
1231

13-
1. Server starten:
14-
```bash
15-
LocalNetAppChat.Server --port 5000 --key "build123"
16-
```
32+
### 1. Server starten
33+
```bash
34+
cd Source/LocalNetAppChat/LocalNetAppChat.Server
35+
dotnet run -- --port 5000 --key "build123"
36+
```
37+
38+
### 2. Build Workers starten (auf mehreren Maschinen)
39+
40+
Für einfache Tests:
41+
```bash
42+
cd Source/LocalNetAppChat/LocalNetAppChat.ConsoleClient
43+
dotnet run -- taskreceiver --server localhost --port 5000 --key "build123" --tags "build,compile" --processor "../../docs/scenarios/distributed-build/scripts/build-task.ps1"
44+
```
45+
46+
Für echte .NET-Builds:
47+
```bash
48+
cd Source/LocalNetAppChat/LocalNetAppChat.ConsoleClient
49+
dotnet run -- taskreceiver --server localhost --port 5000 --key "build123" --tags "build,compile" --processor "../../docs/scenarios/distributed-build/scripts/build-dotnet-project.ps1"
50+
```
51+
52+
### 3. Build Monitor starten (optional)
53+
```bash
54+
cd Source/LocalNetAppChat/LocalNetAppChat.ConsoleClient
55+
dotnet run -- listener --server localhost --port 5000 --key "build123" --clientName "BuildMonitor" | python3 ../../docs/scenarios/distributed-build/python/build-monitor.py
56+
```
57+
58+
### 4. Build Master starten
59+
60+
Einfacher Scheduler:
61+
```bash
62+
cd Source/LocalNetAppChat/LocalNetAppChat.ConsoleClient
63+
dotnet run -- emitter --server localhost --port 5000 --key "build123" --clientName "BuildMaster" --command "python3 -u ../../docs/scenarios/distributed-build/python/build-scheduler.py"
64+
```
65+
66+
Erweiterter Scheduler mit Dependencies:
67+
```bash
68+
cd Source/LocalNetAppChat/LocalNetAppChat.ConsoleClient
69+
dotnet run -- emitter --server localhost --port 5000 --key "build123" --clientName "BuildMaster" --command "python3 -u ../../docs/scenarios/distributed-build/python/build-scheduler-advanced.py"
70+
```
71+
72+
## Erweiterte Nutzung
73+
74+
### Test der Beispielprojekte
75+
76+
Die bereitgestellten Beispielprojekte können direkt gebaut werden:
77+
78+
```bash
79+
# Aus dem example-projects Verzeichnis
80+
cd docs/scenarios/distributed-build/example-projects
81+
dotnet build ProjectA.csproj
82+
dotnet build ProjectB.csproj
83+
dotnet build ProjectC.csproj # Benötigt ProjectB
84+
```
85+
86+
### Anpassung für eigene Projekte
87+
88+
1. **Build-Scripts anpassen**: Modifizieren Sie `build-dotnet-project.ps1` für Ihre spezifischen Build-Anforderungen
89+
2. **Scheduler erweitern**: Passen Sie `build-scheduler-advanced.py` an Ihre Projekt-Dependencies an
90+
3. **Monitoring verbessern**: Erweitern Sie `build-monitor.py` für detailliertere Statistiken
91+
92+
## Architektur-Details
93+
94+
### Task-Flow
95+
1. Build Master sendet Tasks mit Projekt-Informationen
96+
2. Worker empfangen Tasks basierend auf Tags
97+
3. Worker führen Build-Script aus und senden Status-Updates
98+
4. Monitor aggregiert Status-Informationen in Echtzeit
99+
100+
### Parallelisierung
101+
- Mehrere Worker können gleichzeitig verschiedene Projekte bauen
102+
- Der erweiterte Scheduler gruppiert Projekte nach Dependency-Level
103+
- Projekte ohne Dependencies werden parallel gebaut
104+
105+
## Erweiterungsmöglichkeiten
106+
107+
1. **Parallelität**: Starten Sie mehrere Worker für parallele Builds
108+
2. **Fehlerbehandlung**: Die Scripts enthalten bereits grundlegende Fehlerbehandlung
109+
3. **Notifications**: Fügen Sie einen Bot hinzu, der bei Fehlern benachrichtigt
110+
4. **Statistiken**: Nutzen Sie build-monitor.py für Build-Zeit-Analysen
111+
5. **Artefakt-Management**: Erweitern Sie für Upload von Build-Artefakten zum Server
17112

18-
2. Build Worker starten (auf mehreren Maschinen):
19-
```bash
20-
LocalNetAppChat.ConsoleClient taskreceiver --server buildserver --port 5000 --key "build123" --tags "build,compile" --processor "./scripts/build-task.ps1"
21-
```
113+
## Best Practices
22114

23-
3. Build Master (sendet Tasks):
24-
```bash
25-
LocalNetAppChat.ConsoleClient emitter --server buildserver --port 5000 --key "build123" --clientName "BuildMaster" --command "python -u scripts/build-scheduler.py"
26-
```
115+
- Verwenden Sie eindeutige Task-Namen
116+
- Implementieren Sie Timeouts für lange Builds
117+
- Loggen Sie alle Build-Ausgaben
118+
- Nutzen Sie Tags für verschiedene Build-Typen (debug, release, test)
119+
- Testen Sie zunächst mit den Beispielprojekten bevor Sie produktive Builds durchführen
27120

28-
## Scripts
121+
## Troubleshooting
29122

30-
### scripts/build-task.ps1
31-
Kompiliert ein Projekt basierend auf Task-Parametern.
123+
### Worker empfängt keine Tasks
124+
- Überprüfen Sie die Tag-Übereinstimmung zwischen Scheduler und Worker
125+
- Stellen Sie sicher, dass Server und Key korrekt sind
32126

33-
### scripts/build-scheduler.py
34-
Verteilt Build-Aufgaben an verfügbare Worker.
127+
### Build schlägt fehl
128+
- Prüfen Sie die Pfade in den Build-Scripts
129+
- Stellen Sie sicher, dass .NET SDK installiert ist
130+
- Überprüfen Sie die Projekt-Dependencies
35131

36-
### scripts/status-monitor.ps1
37-
Überwacht den Build-Status und sendet Benachrichtigungen.
132+
### Monitor zeigt keine Updates
133+
- Stellen Sie sicher, dass Python 3 installiert ist
134+
- Prüfen Sie, ob die Pipe zwischen Client und Python-Script funktioniert
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
3+
namespace ProjectB
4+
{
5+
public class Calculator
6+
{
7+
public int Add(int a, int b)
8+
{
9+
return a + b;
10+
}
11+
12+
public int Subtract(int a, int b)
13+
{
14+
return a - b;
15+
}
16+
17+
public int Multiply(int a, int b)
18+
{
19+
return a * b;
20+
}
21+
22+
public double Divide(int a, int b)
23+
{
24+
if (b == 0)
25+
{
26+
throw new DivideByZeroException("Cannot divide by zero");
27+
}
28+
return (double)a / b;
29+
}
30+
31+
public double CalculateAverage(params int[] numbers)
32+
{
33+
if (numbers.Length == 0)
34+
{
35+
return 0;
36+
}
37+
38+
int sum = 0;
39+
foreach (int num in numbers)
40+
{
41+
sum += num;
42+
}
43+
44+
return (double)sum / numbers.Length;
45+
}
46+
}
47+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.0.31903.59
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectA", "ProjectA.csproj", "{A1B2C3D4-E5F6-7890-1234-567890ABCDEF}"
6+
EndProject
7+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectB", "ProjectB.csproj", "{B1B2C3D4-E5F6-7890-1234-567890ABCDEF}"
8+
EndProject
9+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectC", "ProjectC.csproj", "{C1B2C3D4-E5F6-7890-1234-567890ABCDEF}"
10+
EndProject
11+
Global
12+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
13+
Debug|Any CPU = Debug|Any CPU
14+
Release|Any CPU = Release|Any CPU
15+
EndGlobalSection
16+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
17+
{A1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+
{A1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+
{A1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+
{A1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Release|Any CPU.Build.0 = Release|Any CPU
21+
{B1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22+
{B1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
23+
{B1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
24+
{B1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{C1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26+
{C1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
27+
{C1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
28+
{C1B2C3D4-E5F6-7890-1234-567890ABCDEF}.Release|Any CPU.Build.0 = Release|Any CPU
29+
EndGlobalSection
30+
EndGlobal
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
3+
namespace ProjectA
4+
{
5+
class Program
6+
{
7+
static void Main(string[] args)
8+
{
9+
Console.WriteLine("ProjectA - Example Application");
10+
Console.WriteLine($"Built at: {DateTime.Now}");
11+
12+
// Simulate some work
13+
for (int i = 0; i < 5; i++)
14+
{
15+
Console.WriteLine($"Processing item {i + 1}...");
16+
System.Threading.Thread.Sleep(100);
17+
}
18+
19+
Console.WriteLine("ProjectA completed successfully!");
20+
}
21+
}
22+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>ProjectA</RootNamespace>
7+
<AssemblyName>ProjectA</AssemblyName>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Library</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>ProjectB</RootNamespace>
7+
<AssemblyName>ProjectB</AssemblyName>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Text.Json;
3+
using ProjectB;
4+
5+
namespace ProjectC
6+
{
7+
class Program
8+
{
9+
static void Main(string[] args)
10+
{
11+
Console.WriteLine("ProjectC - Calculator Test Application");
12+
13+
var calculator = new Calculator();
14+
15+
// Test calculations
16+
var testData = new
17+
{
18+
Addition = calculator.Add(10, 5),
19+
Subtraction = calculator.Subtract(10, 5),
20+
Multiplication = calculator.Multiply(10, 5),
21+
Division = calculator.Divide(10, 5),
22+
Average = calculator.CalculateAverage(10, 20, 30, 40, 50)
23+
};
24+
25+
// Serialize to JSON
26+
var json = JsonSerializer.Serialize(testData, new JsonSerializerOptions
27+
{
28+
WriteIndented = true
29+
});
30+
31+
Console.WriteLine("Calculation Results:");
32+
Console.WriteLine(json);
33+
34+
Console.WriteLine("\nProjectC completed successfully!");
35+
}
36+
}
37+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>ProjectC</RootNamespace>
7+
<AssemblyName>ProjectC</AssemblyName>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<ProjectReference Include="ProjectB.csproj" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<PackageReference Include="System.Text.Json" Version="8.0.0" />
16+
</ItemGroup>
17+
18+
</Project>

0 commit comments

Comments
 (0)