Skip to content

Commit

Permalink
Update to preview 3 + Use Container for temporal cli (#1)
Browse files Browse the repository at this point in the history
* Update to preview 3

* more

* Add container support

* Apply suggestions from code review

* Update README.md

* Fix prots to match docs

* Update sample/Worker/Program.cs

* Fix repo name

* Rename package

* Rename stuff

* Update README.md

* Update publish.yaml

* Add sourcelink

* Update README.md

* Update LICENSE
  • Loading branch information
ElanHasson committed Feb 20, 2024
1 parent 35be5ab commit 759c80a
Show file tree
Hide file tree
Showing 21 changed files with 925 additions and 742 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NuGetDirectory: ${{ github.workspace}}/nuget
TargetProject: "./src/Aspire.Temporal.Server/Aspire.Temporal.Server.csproj"
TargetProject: "./src/InfinityFlow.Aspire.Temporal/InfinityFlow.Aspire.Temporal.csproj"

defaults:
run:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppHost", "sample\AppHost\AppHost.csproj", "{52057B80-B01E-46C3-96F5-228D0B3BCB48}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceDefaults", "sample\ServiceDefaults\ServiceDefaults.csproj", "{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{0815F1E4-424A-4A05-A12E-B2BDAF2AA142}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{70F8209F-4A68-4F27-AF37-3A76C8EA0642}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Temporal.Server", "src\Aspire.Temporal.Server\Aspire.Temporal.Server.csproj", "{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Api", "Sample\Api\Api.csproj", "{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Worker", "sample\Worker\Worker.csproj", "{8B68A40A-674D-4989-B366-1EE0A633F0D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{52057B80-B01E-46C3-96F5-228D0B3BCB48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52057B80-B01E-46C3-96F5-228D0B3BCB48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52057B80-B01E-46C3-96F5-228D0B3BCB48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52057B80-B01E-46C3-96F5-228D0B3BCB48}.Release|Any CPU.Build.0 = Release|Any CPU
{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04}.Release|Any CPU.Build.0 = Release|Any CPU
{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F}.Release|Any CPU.Build.0 = Release|Any CPU
{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B}.Release|Any CPU.Build.0 = Release|Any CPU
{8B68A40A-674D-4989-B366-1EE0A633F0D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B68A40A-674D-4989-B366-1EE0A633F0D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B68A40A-674D-4989-B366-1EE0A633F0D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B68A40A-674D-4989-B366-1EE0A633F0D9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{52057B80-B01E-46C3-96F5-228D0B3BCB48} = {0815F1E4-424A-4A05-A12E-B2BDAF2AA142}
{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04} = {0815F1E4-424A-4A05-A12E-B2BDAF2AA142}
{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F} = {70F8209F-4A68-4F27-AF37-3A76C8EA0642}
{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B} = {0815F1E4-424A-4A05-A12E-B2BDAF2AA142}
{8B68A40A-674D-4989-B366-1EE0A633F0D9} = {0815F1E4-424A-4A05-A12E-B2BDAF2AA142}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C4C2C7A9-980A-4B6D-A624-60A0FBD99DE0}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppHost", "sample\AppHost\AppHost.csproj", "{52057B80-B01E-46C3-96F5-228D0B3BCB48}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServiceDefaults", "sample\ServiceDefaults\ServiceDefaults.csproj", "{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{0815F1E4-424A-4A05-A12E-B2BDAF2AA142}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{70F8209F-4A68-4F27-AF37-3A76C8EA0642}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InfinityFlow.Aspire.Temporal", "src\InfinityFlow.Aspire.Temporal\InfinityFlow.Aspire.Temporal.csproj", "{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Api", "Sample\Api\Api.csproj", "{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Worker", "sample\Worker\Worker.csproj", "{8B68A40A-674D-4989-B366-1EE0A633F0D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{52057B80-B01E-46C3-96F5-228D0B3BCB48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52057B80-B01E-46C3-96F5-228D0B3BCB48}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52057B80-B01E-46C3-96F5-228D0B3BCB48}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52057B80-B01E-46C3-96F5-228D0B3BCB48}.Release|Any CPU.Build.0 = Release|Any CPU
{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04}.Release|Any CPU.Build.0 = Release|Any CPU
{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F}.Release|Any CPU.Build.0 = Release|Any CPU
{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B}.Release|Any CPU.Build.0 = Release|Any CPU
{8B68A40A-674D-4989-B366-1EE0A633F0D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B68A40A-674D-4989-B366-1EE0A633F0D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B68A40A-674D-4989-B366-1EE0A633F0D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8B68A40A-674D-4989-B366-1EE0A633F0D9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{52057B80-B01E-46C3-96F5-228D0B3BCB48} = {0815F1E4-424A-4A05-A12E-B2BDAF2AA142}
{4B893ACC-7DDF-43CE-95A6-104CA8AEAB04} = {0815F1E4-424A-4A05-A12E-B2BDAF2AA142}
{88EE3FBD-5AF8-4F75-A0C7-BC593EC8F90F} = {70F8209F-4A68-4F27-AF37-3A76C8EA0642}
{1FFA9DCE-3368-4AFA-960A-0AD2C501CA1B} = {0815F1E4-424A-4A05-A12E-B2BDAF2AA142}
{8B68A40A-674D-4989-B366-1EE0A633F0D9} = {0815F1E4-424A-4A05-A12E-B2BDAF2AA142}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C4C2C7A9-980A-4B6D-A624-60A0FBD99DE0}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 sains1
Copyright (c) 2024 sains1, InfinityFlow

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# InfinityFlow Aspire.Temporal
# InfinityFlow.Aspire.Temporal

[![NuGet](https://img.shields.io/nuget/v/InfinityFlow.Aspire.Temporal.svg?style=flat)](http://www.nuget.org/profiles/InfinityFlow)

[![Discord](https://discordapp.com/api/guilds/1148334798524383292/widget.png?style=banner2)](https://discord.gg/PXJFbP7PKk)

Aspire extension to start the temporal cli dev server as an container or executable resource.
**Note: Only container works as expected. See https://github.com/dotnet/aspire/issues/1637 and https://github.com/temporalio/cli/issues/316**

Aspire extension to start the temporal cli dev server as an container or executable resource

## Contents:
- [Pre-Requisites](#pre-requisites)
Expand Down Expand Up @@ -31,14 +36,14 @@ using Aspire.Temporal.Server;
var builder = DistributedApplication.CreateBuilder(args);

// Use the default server options
var temporal = builder.AddTemporalServerExecutable("temporal");
var temporal = await builder.AddTemporalServerContainer("temporal")

// OR customise server options with builder
// see config section for details
var temporal = builder.AddTemporalServerExecutable("temporal", x => x.WithNamespace("test1", "test2"));


// ...
var temporal = await builder.AddTemporalServerContainer("temporal", x => x
.WithLogFormat(LogFormat.Json)
.WithLogLevel(LogLevel.Info)
.WithNamespace("test1", "test2"));
```

### 3. Run the Aspire application
Expand Down Expand Up @@ -121,7 +126,7 @@ If done correctly, you should tracing and metrics on the Aspire dashboard:
The dev server can be configured with a fluent builder

```csharp
builder.AddTemporalServerExecutable("temporal", builder => builder.WithPort(1234))
await builder.AddTemporalServerContainer("temporal", builder => builder.WithPort(1234))
```

You can run `temporal server start-dev --help` to get more information about the CLI flags on the dev server. All available flags are mapped to a method on the builder.
Expand Down
7 changes: 3 additions & 4 deletions sample/AppHost/AppHost.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -9,12 +9,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting" Version="8.0.0-preview.1.23557.2" />
<!--<PackageReference Include="sains1.Aspire.Temporal.Server" Version="0.1.0" />-->
<PackageReference Include="Aspire.Hosting" Version="8.0.0-preview.3.24105.21" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Aspire.Temporal.Server\Aspire.Temporal.Server.csproj" />
<ProjectReference Include="..\..\src\InfinityFlow.Aspire.Temporal\InfinityFlow.Aspire.Temporal.csproj" IsAspireProjectResource="false" />
<ProjectReference Include="..\Api\Api.csproj" />
<ProjectReference Include="..\Worker\Worker.csproj" />
</ItemGroup>
Expand Down
40 changes: 16 additions & 24 deletions sample/AppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
using Aspire.Temporal.Server;

var builder = DistributedApplication.CreateBuilder(args);

const string TemporalDbConfigName = "TemporalDbFileName";

if (builder.Configuration[TemporalDbConfigName] is not string temporalDb)
{
throw new Exception($"Set the {TemporalDbConfigName} in your appsettings.Development.json");
}

var temporal = builder.AddTemporalServerExecutable("temporal", x => x
.WithLogFormat(LogFormat.Pretty)
.WithLogLevel(LogLevel.Info)
.WithDbFileName(temporalDb)
.WithNamespace("test1", "test2"));

builder.AddProject<Projects.Api>("api")
.WithReference(temporal);

builder.AddProject<Projects.Worker>("worker")
.WithReference(temporal);

builder.Build().Run();
using InfinityFlow.Aspire.Temporal;

var builder = DistributedApplication.CreateBuilder(args);

var temporal = await builder.AddTemporalServerContainer("temporal", x => x
.WithLogFormat(LogFormat.Json)
.WithLogLevel(LogLevel.Info)
.WithNamespace("test1", "test2"));

builder.AddProject<Projects.Api>("api")
.WithReference(temporal);

builder.AddProject<Projects.Worker>("worker")
.WithReference(temporal);

builder.Build().Run();
3 changes: 1 addition & 2 deletions sample/AppHost/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.Dcp": "Warning"
}
},
"TemporalDbFileName": ""
}
}
Loading

0 comments on commit 759c80a

Please sign in to comment.