Skip to content

Commit

Permalink
(#204) Upgrade .Net 8
Browse files Browse the repository at this point in the history
  • Loading branch information
phongnguyend committed Dec 15, 2023
1 parent b13aba3 commit 4a24332
Show file tree
Hide file tree
Showing 41 changed files with 186 additions and 214 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/.net-build-microservices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.101
dotnet-version: 8.0.100

- name: Build
run: dotnet build --configuration Release
Expand Down Expand Up @@ -61,58 +61,58 @@ jobs:
uses: actions/[email protected]
with:
name: ClassifiedAds.Services.AuditLog.Api
path: src/Microservices/Services.AuditLog/ClassifiedAds.Services.AuditLog.Api/bin/Release/net7.0/publish
path: src/Microservices/Services.AuditLog/ClassifiedAds.Services.AuditLog.Api/bin/Release/net8.0/publish

- name: Upload ClassifiedAds.Services.AuditLog.Grpc
uses: actions/[email protected]
with:
name: ClassifiedAds.Services.AuditLog.Grpc
path: src/Microservices/Services.AuditLog/ClassifiedAds.Services.AuditLog.Grpc/bin/Release/net7.0/publish
path: src/Microservices/Services.AuditLog/ClassifiedAds.Services.AuditLog.Grpc/bin/Release/net8.0/publish

- name: Upload ClassifiedAds.Services.Identity.Api
uses: actions/[email protected]
with:
name: ClassifiedAds.Services.Identity.Api
path: src/Microservices/Services.Identity/ClassifiedAds.Services.Identity.Api/bin/Release/net7.0/publish
path: src/Microservices/Services.Identity/ClassifiedAds.Services.Identity.Api/bin/Release/net8.0/publish

- name: Upload ClassifiedAds.Services.Identity.Grpc
uses: actions/[email protected]
with:
name: ClassifiedAds.Services.Identity.Grpc
path: src/Microservices/Services.Identity/ClassifiedAds.Services.Identity.Grpc/bin/Release/net7.0/publish
path: src/Microservices/Services.Identity/ClassifiedAds.Services.Identity.Grpc/bin/Release/net8.0/publish

- name: Upload ClassifiedAds.Services.Notification.Api
uses: actions/[email protected]
with:
name: ClassifiedAds.Services.Notification.Api
path: src/Microservices/Services.Notification/ClassifiedAds.Services.Notification.Api/bin/Release/net7.0/publish
path: src/Microservices/Services.Notification/ClassifiedAds.Services.Notification.Api/bin/Release/net8.0/publish

- name: Upload ClassifiedAds.Services.Notification.Background
uses: actions/[email protected]
with:
name: ClassifiedAds.Services.Notification.Background
path: src/Microservices/Services.Notification/ClassifiedAds.Services.Notification.Background/bin/Release/net7.0/publish
path: src/Microservices/Services.Notification/ClassifiedAds.Services.Notification.Background/bin/Release/net8.0/publish

- name: Upload ClassifiedAds.Services.Notification.Grpc
uses: actions/[email protected]
with:
name: ClassifiedAds.Services.Notification.Grpc
path: src/Microservices/Services.Notification/ClassifiedAds.Services.Notification.Grpc/bin/Release/net7.0/publish
path: src/Microservices/Services.Notification/ClassifiedAds.Services.Notification.Grpc/bin/Release/net8.0/publish

- name: Upload ClassifiedAds.Services.Product.Api
uses: actions/[email protected]
with:
name: ClassifiedAds.Services.Product.Api
path: src/Microservices/Services.Product/ClassifiedAds.Services.Product.Api/bin/Release/net7.0/publish
path: src/Microservices/Services.Product/ClassifiedAds.Services.Product.Api/bin/Release/net8.0/publish

- name: Upload ClassifiedAds.Services.Storage.Api
uses: actions/[email protected]
with:
name: ClassifiedAds.Services.Storage.Api
path: src/Microservices/Services.Storage/ClassifiedAds.Services.Storage.Api/bin/Release/net7.0/publish
path: src/Microservices/Services.Storage/ClassifiedAds.Services.Storage.Api/bin/Release/net8.0/publish

- name: Upload ClassifiedAds.Gateways.WebAPI
uses: actions/[email protected]
with:
name: ClassifiedAds.Gateways.WebAPI
path: src/Microservices/Gateways.WebAPI/ClassifiedAds.Gateways.WebAPI/bin/Release/net7.0/publish
path: src/Microservices/Gateways.WebAPI/ClassifiedAds.Gateways.WebAPI/bin/Release/net8.0/publish
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>ClassifiedAds.CrossCuttingConcerns</RootNamespace>
</PropertyGroup>

Expand All @@ -10,7 +10,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Text.Json" Version="7.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,74 +1,70 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>ClassifiedAds.Infrastructure</RootNamespace>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="AWSSDK.S3" Version="3.7.101.39" />
<PackageReference Include="AWSSDK.S3" Version="3.7.304.8" />
<PackageReference Include="Azure.Communication.Sms" Version="1.0.1" />
<PackageReference Include="Azure.Data.AppConfiguration" Version="1.2.0" />
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.2" />
<PackageReference Include="Azure.Identity" Version="1.8.0" />
<PackageReference Include="Azure.Messaging.EventGrid" Version="4.12.0" />
<PackageReference Include="Azure.Messaging.EventHubs" Version="5.7.5" />
<PackageReference Include="Azure.Messaging.EventHubs.Processor" Version="5.7.5" />
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.11.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.14.1" />
<PackageReference Include="Azure.Storage.Queues" Version="12.12.0" />
<PackageReference Include="Castle.Core" Version="5.1.0" />
<PackageReference Include="Confluent.Kafka" Version="1.9.3" />
<PackageReference Include="CryptographyHelper" Version="1.0.0" />
<PackageReference Include="Azure.Data.AppConfiguration" Version="1.3.0" />
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.3.0" />
<PackageReference Include="Azure.Identity" Version="1.10.4" />
<PackageReference Include="Azure.Messaging.EventGrid" Version="4.21.0" />
<PackageReference Include="Azure.Messaging.EventHubs" Version="5.10.0" />
<PackageReference Include="Azure.Messaging.EventHubs.Processor" Version="5.10.0" />
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.17.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.1" />
<PackageReference Include="Azure.Storage.Queues" Version="12.17.1" />
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="Confluent.Kafka" Version="2.3.0" />
<PackageReference Include="CryptographyHelper" Version="2.0.0" />
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="Dapper.StrongName" Version="2.0.123" />
<PackageReference Include="Dapper.StrongName" Version="2.1.24" />
<PackageReference Include="DinkToPdf" Version="1.0.8" />
<PackageReference Include="Google.Protobuf" Version="3.21.12" />
<PackageReference Include="Grpc.Net.Client" Version="2.50.0" />
<PackageReference Include="EntityFrameworkCore.SqlServer.SimpleBulks" Version="6.5.0" />
<PackageReference Include="IdentityModel" Version="6.0.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="7.0.1" />
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="5.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.1" />
<PackageReference Include="EntityFrameworkCore.SqlServer.SimpleBulks" Version="6.9.0" />
<PackageReference Include="IdentityModel" Version="6.2.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.0" />
<PackageReference Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="7.0.0" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.2.22" />
<PackageReference Include="MiniProfiler.EntityFrameworkCore" Version="4.2.22" />
<PackageReference Include="MiniProfiler.Providers.SqlServer" Version="4.2.22" />
<PackageReference Include="OpenTelemetry.Exporter.Jaeger" Version="1.4.0-rc.1" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.4.0-rc.1" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs" Version="1.4.0-rc.1" />
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.4.0-rc.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.4.0-rc.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9.10" />
<PackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.0" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.3.8" />
<PackageReference Include="MiniProfiler.EntityFrameworkCore" Version="4.3.8" />
<PackageReference Include="MiniProfiler.Providers.SqlServer" Version="4.3.8" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc9.10" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="1.0.0-alpha.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.1.0-beta.2" />
<PackageReference Include="PuppeteerSharp" Version="8.0.0" />
<PackageReference Include="Quartz" Version="3.5.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.4.0" />
<PackageReference Include="RazorLight" Version="2.3.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.5.1" />
<PackageReference Include="PuppeteerSharp" Version="13.0.2" />
<PackageReference Include="Quartz" Version="3.8.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
<PackageReference Include="RazorLight" Version="2.3.1" />
<PackageReference Include="SendGrid" Version="9.28.1" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.3.0" />
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.3" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Twilio" Version="6.2.0" />
<PackageReference Include="VaultSharp" Version="1.12.2" />
<PackageReference Include="Twilio" Version="6.15.2" />
<PackageReference Include="VaultSharp" Version="1.13.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ private static void UseClassifiedAdsLogger(this IWebHostEnvironment env, Logging
loggerConfiguration = loggerConfiguration
.MinimumLevel.Debug()
.Enrich.FromLogContext()
.Enrich.With<ActivityEnricher>()
.Enrich.WithMachineName()
.Enrich.WithEnvironmentUserName()
.Enrich.WithProperty("ProcessId", Environment.ProcessId)
Expand Down Expand Up @@ -249,7 +248,6 @@ private static void UseClassifiedAdsLogger(this IHostEnvironment env, LoggingOpt
loggerConfiguration = loggerConfiguration
.MinimumLevel.Debug()
.Enrich.FromLogContext()
.Enrich.With<ActivityEnricher>()
.Enrich.WithMachineName()
.Enrich.WithEnvironmentUserName()
.Enrich.WithProperty("ProcessId", Environment.ProcessId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
Expand Down Expand Up @@ -35,15 +34,6 @@ public static IServiceCollection AddClassifiedAdsOpenTelemetry(this IServiceColl
.AddEntityFrameworkCoreInstrumentation()
.AddHttpClientInstrumentation();

if (options?.Jaeger?.IsEnabled ?? false)
{
builder.AddJaegerExporter(jaegerOptions =>
{
jaegerOptions.AgentHost = options.Jaeger.AgentHost;
jaegerOptions.AgentPort = options.Jaeger.AgentPort;
});
}

if (options?.Zipkin?.IsEnabled ?? false)
{
builder.AddZipkinExporter(zipkinOptions =>
Expand Down Expand Up @@ -75,8 +65,7 @@ public static IServiceCollection AddClassifiedAdsOpenTelemetry(this IServiceColl
otlpOptions.Endpoint = new Uri(options.Otlp.Endpoint);
});
}
})
.StartWithHost();
});

return services;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ public class OpenTelemetryOptions

public ZipkinOptions Zipkin { get; set; }

public JaegerOptions Jaeger { get; set; }

public OtlpOptions Otlp { get; set; }
}

Expand All @@ -20,15 +18,6 @@ public class ZipkinOptions
public string Endpoint { get; set; }
}

public class JaegerOptions
{
public bool IsEnabled { get; set; }

public string AgentHost { get; set; }

public int AgentPort { get; set; }
}

public class OtlpOptions
{
public bool IsEnabled { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<UserSecretsId>4a8b7447-cb04-4631-8420-8ac41700e230</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.1" />
<PackageReference Include="Ocelot" Version="18.0.0" />
<PackageReference Include="Yarp.ReverseProxy" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.0" />
<PackageReference Include="Ocelot" Version="22.0.1" />
<PackageReference Include="Yarp.ReverseProxy" Version="2.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /ClassifiedAds.Microservices

# Copy csproj and restore as distinct layers
Expand All @@ -17,7 +17,7 @@ COPY . ./
RUN dotnet publish ./Gateways.WebAPI/ClassifiedAds.Gateways.WebAPI/ClassifiedAds.Gateways.WebAPI.csproj -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /ClassifiedAds.Microservices
COPY --from=build-env /ClassifiedAds.Microservices/out .

Expand Down
2 changes: 1 addition & 1 deletion src/Microservices/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@

- Build
```
docker-compose build
docker compose build
```

- Tag
Expand Down
Loading

0 comments on commit 4a24332

Please sign in to comment.