Browse Source

Bunch of bug fixes for dapr support and fixing cancellation on stop async (#1036)

philliphoff-arm64
Justin Kotalik 5 years ago
committed by GitHub
parent
commit
a015acfdb9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      samples/dapr/pub-sub/orders/Startup.cs
  2. 2
      samples/dapr/pub-sub/orders/orders.csproj
  3. 2
      samples/dapr/pub-sub/products/products.csproj
  4. 2
      samples/dapr/pub-sub/store/store.csproj
  5. 4
      samples/dapr/service-invocation/SentenceApp/SentenceApp.csproj
  6. 14
      src/Microsoft.Tye.Extensions/Dapr/DaprExtension.cs
  7. 9
      src/Microsoft.Tye.Hosting/TyeHost.cs

3
samples/dapr/pub-sub/orders/Startup.cs

@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;

2
samples/dapr/pub-sub/orders/orders.csproj

@ -5,7 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapr.AspNetCore" Version="1.0.0-rc02" /> <PackageReference Include="Dapr.AspNetCore" Version="1.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

2
samples/dapr/pub-sub/products/products.csproj

@ -5,7 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapr.AspNetCore" Version="1.0.0-rc02" /> <PackageReference Include="Dapr.AspNetCore" Version="1.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

2
samples/dapr/pub-sub/store/store.csproj

@ -5,7 +5,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapr.AspNetCore" Version="1.0.0-rc02" /> <PackageReference Include="Dapr.AspNetCore" Version="1.0.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

4
samples/dapr/service-invocation/SentenceApp/SentenceApp.csproj

@ -5,8 +5,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapr.AspNetCore" Version="1.0.0-rc02" /> <PackageReference Include="Dapr.AspNetCore" Version="1.0.0" />
<PackageReference Include="Dapr.Client" Version="1.0.0-rc02" /> <PackageReference Include="Dapr.Client" Version="1.0.0" />
<PackageReference Include="Microsoft.Tye.Extensions.Configuration" Version="0.5.0-alpha.20555.1" /> <PackageReference Include="Microsoft.Tye.Extensions.Configuration" Version="0.5.0-alpha.20555.1" />
</ItemGroup> </ItemGroup>

14
src/Microsoft.Tye.Extensions/Dapr/DaprExtension.cs

@ -107,7 +107,7 @@ namespace Microsoft.Tye.Extensions.Dapr
// These environment variables are replaced with environment variables // These environment variables are replaced with environment variables
// defined for this service. // defined for this service.
Args = $"run --app-id {project.Name} --app-port %APP_PORT% --dapr-grpc-port %DAPR_GRPC_PORT% --dapr-http-port %DAPR_HTTP_PORT% --metrics-port %METRICS_PORT% --placement-host-address localhost:{daprPlacementPort}", Args = $"-app-id {project.Name} -app-port %APP_PORT% -dapr-grpc-port %DAPR_GRPC_PORT% --dapr-http-port %DAPR_HTTP_PORT% --metrics-port %METRICS_PORT% --placement-host-address localhost:{daprPlacementPort}",
}; };
// When running locally `-config` specifies a filename, not a configuration name. By convention // When running locally `-config` specifies a filename, not a configuration name. By convention
@ -117,7 +117,7 @@ namespace Microsoft.Tye.Extensions.Dapr
var configFile = Path.Combine(context.Application.Source.DirectoryName!, "components", $"{daprConfig}.yaml"); var configFile = Path.Combine(context.Application.Source.DirectoryName!, "components", $"{daprConfig}.yaml");
if (File.Exists(configFile)) if (File.Exists(configFile))
{ {
proxy.Args += $" --config \"{configFile}\""; proxy.Args += $" -config \"{configFile}\"";
} }
else else
{ {
@ -127,12 +127,12 @@ namespace Microsoft.Tye.Extensions.Dapr
if (config.Data.TryGetValue("log-level", out obj) && obj?.ToString() is string logLevel) if (config.Data.TryGetValue("log-level", out obj) && obj?.ToString() is string logLevel)
{ {
proxy.Args += $" --log-level {logLevel}"; proxy.Args += $" -log-level {logLevel}";
} }
if (config.Data.TryGetValue("components-path", out obj) && obj?.ToString() is string componentsPath) if (config.Data.TryGetValue("components-path", out obj) && obj?.ToString() is string componentsPath)
{ {
proxy.Args += $" --components-path {componentsPath}"; proxy.Args += $" -components-path {componentsPath}";
} }
// Add dapr proxy as a service available to everyone. // Add dapr proxy as a service available to everyone.
proxy.Dependencies.UnionWith(context.Application.Services.Select(s => s.Name)); proxy.Dependencies.UnionWith(context.Application.Services.Select(s => s.Name));
@ -271,7 +271,7 @@ namespace Microsoft.Tye.Extensions.Dapr
// Starting with dapr version 11, dapr is installed in user profile/home. // Starting with dapr version 11, dapr is installed in user profile/home.
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
var windowsPath = Environment.ExpandEnvironmentVariables("%HOMEDRIVE%/dapr/dapr.exe"); var windowsPath = Environment.ExpandEnvironmentVariables("%USERPROFILE%/.dapr/bin/daprd.exe");
if (File.Exists(windowsPath)) if (File.Exists(windowsPath))
{ {
return windowsPath; return windowsPath;
@ -279,7 +279,7 @@ namespace Microsoft.Tye.Extensions.Dapr
} }
else else
{ {
var nixpath = "/usr/local/bin/dapr"; var nixpath = Environment.ExpandEnvironmentVariables("%HOME%/.dapr/bin/daprd");
if (File.Exists(nixpath)) if (File.Exists(nixpath))
{ {
return nixpath; return nixpath;
@ -287,7 +287,7 @@ namespace Microsoft.Tye.Extensions.Dapr
} }
// Older version of dapr don't have dapr in the bin directory, but it is usually on the path. // Older version of dapr don't have dapr in the bin directory, but it is usually on the path.
return "dapr"; return "daprd";
} }
} }
} }

9
src/Microsoft.Tye.Hosting/TyeHost.cs

@ -339,7 +339,14 @@ namespace Microsoft.Tye.Hosting
if (DashboardWebApplication != null) if (DashboardWebApplication != null)
{ {
// Stop the host after everything else has been shutdown // Stop the host after everything else has been shutdown
await DashboardWebApplication.StopAsync(); try
{
await DashboardWebApplication.StopAsync();
}
catch (OperationCanceledException)
{
// ignore cancellation failures from stop async
}
} }
} }

Loading…
Cancel
Save