{"id":13542932,"url":"https://github.com/InfinityFlowApp/aspire-temporal","last_synced_at":"2025-04-02T12:30:52.917Z","repository":{"id":223389849,"uuid":"760161702","full_name":"InfinityFlowApp/aspire-temporal","owner":"InfinityFlowApp","description":"Aspire component wrapper for the temporal CLI dev server","archived":false,"fork":false,"pushed_at":"2025-03-12T22:23:48.000Z","size":428,"stargazers_count":18,"open_issues_count":6,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-25T08:55:55.757Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"sains1/temporal-server-aspire-component","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InfinityFlowApp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-19T22:33:17.000Z","updated_at":"2025-03-15T12:53:40.000Z","dependencies_parsed_at":"2024-04-05T15:27:29.562Z","dependency_job_id":"de107955-1225-4595-9bea-e13bf019a75c","html_url":"https://github.com/InfinityFlowApp/aspire-temporal","commit_stats":null,"previous_names":["infinityflowapp/temporal-server-aspire-component","infinityflowapp/aspire-temporal-server","infinityflowapp/aspire-temporal"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfinityFlowApp%2Faspire-temporal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfinityFlowApp%2Faspire-temporal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfinityFlowApp%2Faspire-temporal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfinityFlowApp%2Faspire-temporal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InfinityFlowApp","download_url":"https://codeload.github.com/InfinityFlowApp/aspire-temporal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246815310,"owners_count":20838420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T11:00:19.999Z","updated_at":"2025-04-02T12:30:47.909Z","avatar_url":"https://github.com/InfinityFlowApp.png","language":"C#","funding_links":[],"categories":[".NET"],"sub_categories":["Libraries"],"readme":"# InfinityFlow.Aspire.Temporal\n\n[![NuGet](https://img.shields.io/nuget/v/InfinityFlow.Aspire.Temporal.svg?style=flat)](https://www.nuget.org/packages/InfinityFlow.Aspire.Temporal)\n \n[![Discord](https://discordapp.com/api/guilds/1148334798524383292/widget.png?style=banner2)](https://discord.gg/PXJFbP7PKk)\n\nAspire extension to start the temporal cli dev server as an container or executable resource. \n**Note: Only container works as expected. See https://github.com/dotnet/aspire/issues/1637 and https://github.com/temporalio/cli/issues/316**\n\n\n## Contents:\n- [Pre-Requisites](#pre-requisites)\n- [Getting Started](#getting-started)\n- [Observability](#observability)\n- [Configuration](#configuration)\n\n## Pre-requisites\n\n- [Temporal CLI](https://github.com/temporalio/cli) (ensure the binary is in your PATH)\n- An Aspire project. See [Aspire docs](https://learn.microsoft.com/en-us/dotnet/aspire/get-started/aspire-overview) to get started.\n\n## Getting Started\n\n### 1. Install the nuget package\n\n```sh\ndotnet add package InfinityFlow.Aspire.Temporal\n```\n\n### 2. Add Temporal dev server to your Aspire AppHost Program.cs\n\n```csharp\n// AppHost/Program.cs\nusing Aspire.Temporal.Server;\n\nvar builder = DistributedApplication.CreateBuilder(args);\n\n// Use the default server options\nvar temporal = await builder.AddTemporalServerContainer(\"temporal\")\n\n// OR customise server options with builder\n//      see config section for details\nvar temporal = await builder.AddTemporalServerContainer(\"temporal\", x =\u003e x\n    .WithLogFormat(LogFormat.Json)\n    .WithLogLevel(LogLevel.Info)\n    .WithNamespace(\"test1\", \"test2\"));\n```\n\n### 3. Run the Aspire application\n\nYou should see Temporal running under the Executables tab.\n\nTemporal will be available on its default ports:\n- Server: http://localhost:7233\n- UI: http://localhost:8233\n\n![Aspire dashboard temporal exe](./docs/aspire-dashboard-exe.png)\n\n### 4. Configure Client/Worker Applications\n\nThe Temporal client can then be added to a .NET project as normal using the instructions from the [temporal dotnet sdk repo](https://github.com/temporalio/sdk-dotnet/)\n\nIt can be included in Aspire orchestration like below and can optionally take a reference to the Temporal resource.\n\n```csharp\n// ./samples/AppHost/Program.cs\n\n// ...\n\nvar temporal = builder.AddTemporalServerExecutable(\"temporal\");\n\nbuilder.AddProject\u003cProjects.Worker\u003e(\"worker\") // my custom project\n    .WithReference(temporal);\n\n// ...\n```\n\nIf using [Temporalio.Extensions.Hosting](https://github.com/temporalio/sdk-dotnet/blob/main/src/Temporalio.Extensions.Hosting/README.md) the client registration might look something like below. If we took the reference to the Temporal Aspire resource, then the TargetHost property is automatically injected under the key `ConnectionStrings:\u003cAspire Resource Name\u003e`. (e.g., this will be `builder.Configuration[\"ConnectionStrings:temporal\"]` for a resource named \"temporal\" as above)\n\n```csharp\n// register a client -  ./samples/Api/Program.cs\nbuilder.Services\n    .AddTemporalClient(opts =\u003e\n    {\n        opts.TargetHost = builder.Configuration[\"ConnectionStrings:temporal\"]; // or just self-configure localhost:7233\n        opts.Namespace = \"default\";\n    })\n\n// or\n\n// register a worker - ./samples/Worker/Program.cs\nbuilder.Services\n    .AddTemporalClient(opts =\u003e\n    {\n        opts.TargetHost = builder.Configuration[\"ConnectionStrings:temporal\"]; // or just self-configure localhost:7233\n        opts.Namespace = \"default\";\n    })\n    .AddHostedTemporalWorker(\"my-task-queue\")\n    .AddScopedActivities\u003cMyActivities\u003e()\n    .AddWorkflow\u003cMyWorkflow\u003e();\n```\n\n## Observability\n\nThe extension doesn't provide any setup for observability, but you can follow [Temporalio.Extensions.DiagnosticSource](https://github.com/temporalio/sdk-dotnet/blob/main/src/Temporalio.Extensions.DiagnosticSource/README.md) and [Temporalio.Extensions.Hosting](https://github.com/temporalio/sdk-dotnet/blob/main/src/Temporalio.Extensions.Hosting/TemporalHostingServiceCollectionExtensions.cs) to configure this on the temporal client. If using the Aspire Service Defaults, you'll need to configure the metrics and tracing accordingly.\n\nThe sample folder has an example for configuring this with the Aspire Dashboard\n\n- [sample/Api/Program.cs](./sample/Api/Program.cs) for an example client\n- [sample/Worker/Program.cs](./sample/Worker/Program.cs) for an example worker\n- [sample/ServiceDefaults/Extensions.cs](./sample/ServiceDefaults/Extensions.cs) for an example of adding the custom meter and tracing sources to the service defaults.\n\nIf done correctly, you should tracing and metrics on the Aspire dashboard:\n\n#### Tracing\n\n![aspire dashboard temporal tracing](./docs/aspire-dashboard-temporal-tracing.png)\n\n#### Metrics\n\n![aspire dashboard temporal metrics](./docs/aspire-dashboard-temporal-metrics.png)\n\n\n## Configuration\n\nThe dev server can be configured with a fluent builder\n\n```csharp\nawait builder.AddTemporalServerContainer(\"temporal\", builder =\u003e builder.WithPort(1234))\n```\n\nYou 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.\n\nAvailable methods:\n\n```csharp\nbuilder\n    .WithDbFileName(\"/location/of/persistent/file\") // --db-filename\n    .WithNamespace(\"namespace-name\", ...)           // --namespace\n    .WithPort(7233)                                 // --port\n    .WithHttpPort(7234)                             // --http-port\n    .WithMetricsPort(7235)                          // --metrics-port\n    .UiPort(8233)                                   // --ui-port\n    .WithHeadlessUi(true)                           // --headless\n    .WithIp(\"127.0.0.1\")                            // --ip\n    .WithUiIp(\"127.0.0.1\")                          // --ui-ip\n    .WithUiAssetPath(\"/location/of/custom/assets\")  // --ui-asset-path\n    .WithUiCodecEndpoint(\"http://localhost:8080\")   // --ui-codec-endpoint\n    .WithLogFormat(LogFormat.Pretty)                // --log-format\n    .WithLogLevel(LogLevel.Info)                    // --log-level\n    .WithSQLitePragma(SQLitePragma.JournalMode)     // --sqlite-pragma\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FInfinityFlowApp%2Faspire-temporal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FInfinityFlowApp%2Faspire-temporal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FInfinityFlowApp%2Faspire-temporal/lists"}