Skip to content

Commit

Permalink
Merge pull request #777 from dolittle/dotnet9
Browse files Browse the repository at this point in the history
.NET 9 release
  • Loading branch information
mhelleborg authored Nov 14, 2024
2 parents bf87ba9 + 13fe43b commit 83b2aa1
Show file tree
Hide file tree
Showing 29 changed files with 214 additions and 111 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,5 @@ csharp_style_prefer_range_operator = false:none
dotnet_diagnostic.IDE0055.severity = none
# prefere brace indentation when creating objects etc
csharp_indent_braces = false

resharper_remove_redundant_braces_highlighting = none
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"
- name: Run Mongo container
run: docker run -p 27017:27017 -d dolittle/mongodb:4.2.2
- name: Run Benchmarks
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"
- name: Run Mongo container
run: docker run -p 27017:27017 -d dolittle/mongodb:4.2.2
- name: Test
run: dotnet test --filter Tag=IntegrationTest -f net8.0 --configuration Release
run: dotnet test --filter Tag=IntegrationTest -f net9.0 --configuration Release
24 changes: 12 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"
- name: Run Mongo container
run: docker run -p 27017:27017 -d dolittle/mongodb:4.2.2
- name: Run Benchmarks
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
file: ./Docker/Development/Dockerfile
build-args: |
VERSION=${{ needs.setup.outputs.next-version }}
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
tags: dolittle/runtime:${{ needs.setup.outputs.next-version }}-development
- name: Push Latest Tag Of Development Image to Docker Hub
uses: docker/build-push-action@v2
Expand All @@ -171,7 +171,7 @@ jobs:
file: ./Docker/Development/Dockerfile
build-args: |
VERSION=${{ needs.setup.outputs.next-version }}
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
tags: dolittle/runtime:latest-development

release-cli-tool:
Expand All @@ -183,7 +183,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"
- name: Update VersionInfo
uses: dolittle/update-version-info-action@v1
with:
Expand All @@ -203,7 +203,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.release-upload-url }}
asset_path: ./Source/CLI/bin/Release/net8.0/osx-x64/publish/Dolittle.Runtime.CLI
asset_path: ./Source/CLI/bin/Release/net9.0/osx-x64/publish/Dolittle.Runtime.CLI
asset_name: dolittle-macos-x64
asset_content_type: application/octet-stream
- name: Publish for macOS arm64
Expand All @@ -215,7 +215,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.release-upload-url }}
asset_path: ./Source/CLI/bin/Release/net8.0/osx-arm64/publish/Dolittle.Runtime.CLI
asset_path: ./Source/CLI/bin/Release/net9.0/osx-arm64/publish/Dolittle.Runtime.CLI
asset_name: dolittle-macos-arm64
asset_content_type: application/octet-stream
- name: Publish for Windows x64
Expand All @@ -227,7 +227,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.release-upload-url }}
asset_path: ./Source/CLI/bin/Release/net8.0/win-x64/publish/Dolittle.Runtime.CLI.exe
asset_path: ./Source/CLI/bin/Release/net9.0/win-x64/publish/Dolittle.Runtime.CLI.exe
asset_name: dolittle-win-x64.exe
asset_content_type: application/octet-stream
- name: Publish for Windows x86
Expand All @@ -239,7 +239,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.release-upload-url }}
asset_path: ./Source/CLI/bin/Release/net8.0/win-x86/publish/Dolittle.Runtime.CLI.exe
asset_path: ./Source/CLI/bin/Release/net9.0/win-x86/publish/Dolittle.Runtime.CLI.exe
asset_name: dolittle-win-x86.exe
asset_content_type: application/octet-stream
- name: Publish for Windows arm64
Expand All @@ -251,7 +251,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.release-upload-url }}
asset_path: ./Source/CLI/bin/Release/net8.0/win-arm64/publish/Dolittle.Runtime.CLI.exe
asset_path: ./Source/CLI/bin/Release/net9.0/win-arm64/publish/Dolittle.Runtime.CLI.exe
asset_name: dolittle-win-arm64.exe
asset_content_type: application/octet-stream
- name: Publish for Linux x64
Expand All @@ -263,7 +263,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.release-upload-url }}
asset_path: ./Source/CLI/bin/Release/net8.0/linux-x64/publish/Dolittle.Runtime.CLI
asset_path: ./Source/CLI/bin/Release/net9.0/linux-x64/publish/Dolittle.Runtime.CLI
asset_name: dolittle-linux-x64
asset_content_type: application/octet-stream
- name: Publish for Linux arm64
Expand All @@ -275,7 +275,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.release-upload-url }}
asset_path: ./Source/CLI/bin/Release/net8.0/linux-arm64/publish/Dolittle.Runtime.CLI
asset_path: ./Source/CLI/bin/Release/net9.0/linux-arm64/publish/Dolittle.Runtime.CLI
asset_name: dolittle-linux-arm64
asset_content_type: application/octet-stream
- name: Publish for Linux arm
Expand All @@ -287,6 +287,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.release-upload-url }}
asset_path: ./Source/CLI/bin/Release/net8.0/linux-arm/publish/Dolittle.Runtime.CLI
asset_path: ./Source/CLI/bin/Release/net9.0/linux-arm/publish/Dolittle.Runtime.CLI
asset_name: dolittle-linux-arm
asset_content_type: application/octet-stream
8 changes: 4 additions & 4 deletions .github/workflows/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "8.0.x"
dotnet-version: "9.0.x"
- name: Build
run: dotnet build --configuration Release -f net8.0
run: dotnet build --configuration Release -f net9.0
- name: Test
run: dotnet test --filter Tag!=IntegrationTest --no-build -f net8.0 --configuration Release --collect:"XPlat Code Coverage"
run: dotnet test --filter Tag!=IntegrationTest --no-build -f net9.0 --configuration Release --collect:"XPlat Code Coverage"

build-prod-docker-image:
name: Build Production Docker Image
Expand Down Expand Up @@ -64,4 +64,4 @@ jobs:
file: ./Docker/Development/Dockerfile
build-args: |
VERSION=0.0.0
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
68 changes: 36 additions & 32 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,69 +8,73 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Dolittle.Contracts" Version="$(ContractsVersion)" />
<PackageVersion Include="Autofac" Version="8.1.0" />
<PackageVersion Include="Autofac" Version="8.1.1" />
<PackageVersion Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="ConsoleTables" Version="2.6.1" />
<PackageVersion Include="ConsoleTables" Version="2.6.2" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="Docker.DotNet" Version="3.125.15" />
<PackageVersion Include="Grpc.AspNetCore" Version="2.65.0" />
<PackageVersion Include="Grpc.AspNetCore.Web" Version="2.65.0" />
<PackageVersion Include="Grpc.AspNetCore.Server.Reflection" Version="2.65.0" />
<PackageVersion Include="Grpc.AspNetCore.HealthChecks" Version="2.65.0" />
<PackageVersion Include="Grpc.AspNetCore" Version="2.66.0" />
<PackageVersion Include="Grpc.AspNetCore.Web" Version="2.66.0" />
<PackageVersion Include="Grpc.AspNetCore.Server.Reflection" Version="2.66.0" />
<PackageVersion Include="Grpc.AspNetCore.HealthChecks" Version="2.66.0" />
<PackageVersion Include="Grpc.Core.Testing" Version="2.46.6" />
<PackageVersion Include="Grpc.Tools" Version="2.66.0">
<PackageVersion Include="Grpc.Tools" Version="2.67.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="Grpc.Net.Client" Version="2.65.0" />
<PackageVersion Include="Grpc.Net.Client" Version="2.66.0" />
<PackageVersion Include="Machine.Specifications" Version="1.1.2" />
<PackageVersion Include="Machine.Specifications.Should" Version="1.0.0" />
<PackageVersion Include="Machine.Specifications.Runner.VisualStudio" Version="2.10.2" />
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Physical" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="MongoDB.Driver" Version="2.28.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Physical" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.0.0" />
<PackageVersion Include="MongoDB.Driver" Version="2.30.0" />
<PackageVersion Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="1.5.0" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="FluentAssertions" Version="6.12.1" />
<PackageVersion Include="FluentAssertions" Version="6.12.2" />
<PackageVersion Include="NetEscapades.Configuration.Yaml" Version="3.1.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Nito.AsyncEx" Version="5.1.2" />
<PackageVersion Include="Nito.AsyncEx.Tasks" Version="5.1.2" />
<PackageVersion Include="Polly" Version="8.4.1" />
<PackageVersion Include="Polly" Version="8.5.0" />
<PackageVersion Include="prometheus-net" Version="8.2.1" />
<PackageVersion Include="prometheus-net.AspNetCore" Version="8.2.1" />
<PackageVersion Include="prometheus-net.DotNetRuntime" Version="4.4.0" />
<PackageVersion Include="prometheus-net.DotNetRuntime" Version="4.4.1" />
<PackageVersion Include="Proto.Actor" Version="1.7.1-alpha.0.1" />
<PackageVersion Include="Proto.Remote" Version="1.7.1-alpha.0.1" />
<PackageVersion Include="Proto.OpenTelemetry" Version="1.7.1-alpha.0.1" />
<PackageVersion Include="Proto.Cluster" Version="1.7.1-alpha.0.1" />
<PackageVersion Include="Proto.Cluster.CodeGen" Version="1.7.1-alpha.0.1" />
<PackageVersion Include="Google.Protobuf" Version="3.28.1" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.7.3" />
<PackageVersion Include="Google.Protobuf" Version="3.28.3" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="7.0.0" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="System.Security.Claims" Version="4.3.0" />
<PackageVersion Include="OpenTelemetry.Api" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Api" Version="1.10.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.10.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.9.0-beta.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageVersion Include="Testcontainers.MongoDb" Version="3.10.0" />
<PackageVersion Include="xunit" Version="2.9.0" />
<PackageVersion Include="Testcontainers.MongoDb" Version="4.0.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
</Project>
64 changes: 29 additions & 35 deletions Docker/Development/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# DotNet Build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS dotnet-build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS dotnet-build
SHELL ["/bin/bash", "-c"]
ARG VERSION
ARG TARGETARCH
Expand All @@ -13,62 +13,56 @@ COPY Specifications /app/Specifications/

WORKDIR /app/Source/Server
RUN dotnet restore
RUN dotnet publish -c "Release" -p:Version=${VERSION} -f net7.0 -p:RuntimeIdentifier="linux-${TARGETARCH/amd64/x64}" -o out
RUN dotnet publish -c "Release" -p:Version=${VERSION} -f net9.0 -p:RuntimeIdentifier="linux-${TARGETARCH/amd64/x64}" -o out

# Runtime Image
FROM mcr.microsoft.com/dotnet/aspnet:7.0
FROM mcr.microsoft.com/dotnet/aspnet:9.0
SHELL ["/bin/bash", "-c"]
ARG TARGETARCH

ENV Logging__Console__FormatterName=""

WORKDIR /app
COPY --from=dotnet-build /app/Source/Server/out ./
COPY --from=dotnet-build /app/Source/Server/.dolittle ./.dolittle

# Install MongoDB dependencies

ENV \
MONGODB_VERSION=7.0 \
MONGODB_PORT=27017

# Install MongoDB and tini
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
wget \
gnupg \
&& rm -rf /var/lib/apt/lists/*

# Hack to get MongoDB to install even without systemctl
# See https://www.julienrouse.com/blog/systemctl_not_found_while_installing_mongodb_server/#spoiler-a-solution
RUN ln -s /bin/true /usr/local/sbin/systemctl
RUN ln -s /bin/true /usr/local/bin/systemctl
RUN ln -s /bin/true /usr/sbin/systemctl
RUN ln -s /bin/true /usr/bin/systemctl
RUN ln -s /bin/true /sbin/systemctl
RUN ln -s /bin/true /bin/systemctl

# Install MongoDB
RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - \
&& echo "deb [ arch=$TARGETARCH ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.2.list \
ca-certificates \
curl \
gnupg \
tini \
# Add MongoDB repository
&& curl -fsSL https://pgp.mongodb.com/server-${MONGODB_VERSION}.asc | gpg -o /usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg --dearmor \
&& echo "deb [signed-by=/usr/share/keyrings/mongodb-server-${MONGODB_VERSION}.gpg] http://repo.mongodb.org/apt/debian bookworm/mongodb-org/${MONGODB_VERSION} main" | tee /etc/apt/sources.list.d/mongodb-org-${MONGODB_VERSION}.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
mongodb-org-server \
mongodb-org-shell \
mongodb-org \
&& rm -rf /var/lib/apt/lists/*

# Setup MongoDB as single-node replicaset

# Create directories for MongoDB
RUN mkdir -p /data/db /data/configdb \
&& chown -R mongodb:mongodb /data/db /data/configdb \
&& mongod --logpath /var/log/mongodb/initdb.log --replSet "rs0" --bind_ip 0.0.0.0 --fork \
&& mongo --eval 'rs.initiate({_id: "rs0", members: [{ _id: 0, host: "localhost:27017"}]})' \
&& mongo admin --eval 'db.shutdownServer()'
&& chown -R mongodb:mongodb /data/db /data/configdb

# Copy MongoDB configuration
COPY Docker/Development/mongod.conf /etc/mongod.conf
RUN chown mongodb:mongodb /etc/mongod.conf

VOLUME /data/db /data/configdb

# Add Tini to get a real init process
ADD "https://github.com/krallin/tini/releases/download/v0.19.0/tini-$TARGETARCH" /usr/bin/tini
RUN chmod +x /usr/bin/tini

# Create entrypoint that runs both MongoDB and Runtime
COPY Docker/Development/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
RUN chmod +x /usr/bin/docker-entrypoint.sh

WORKDIR /app
COPY --from=dotnet-build /app/Source/Server/out ./
COPY --from=dotnet-build /app/Source/Server/.dolittle ./.dolittle

# Expose the ports
EXPOSE 9700 50052 50053 51052 27017

ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/usr/bin/docker-entrypoint.sh"]
ENTRYPOINT ["tini", "-v", "--", "docker-entrypoint.sh"]
Loading

0 comments on commit 83b2aa1

Please sign in to comment.