diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index db6bdb8..f4f3bac 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -1,189 +1,188 @@ - name: Build and Push Microservices - - on: - push: - branches: - - master - workflow_dispatch: - - jobs: - build-sphere: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup NBGV - uses: dotnet/nbgv@master - id: nbgv - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push DysonNetwork.Sphere Docker image - uses: docker/build-push-action@v6 - with: - file: DysonNetwork.Sphere/Dockerfile - context: . - push: true - tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-sphere:latest - platforms: linux/amd64 - - build-pass: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup NBGV - uses: dotnet/nbgv@master - id: nbgv - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push DysonNetwork.Pass Docker image - uses: docker/build-push-action@v6 - with: - file: DysonNetwork.Pass/Dockerfile - context: . - push: true - tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-pass:latest - platforms: linux/amd64 - - build-pusher: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup NBGV - uses: dotnet/nbgv@master - id: nbgv - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push DysonNetwork.Pusher Docker image - uses: docker/build-push-action@v6 - with: - file: DysonNetwork.Pusher/Dockerfile - context: . - push: true - tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-pusher:latest - platforms: linux/amd64 - - build-drive: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup NBGV - uses: dotnet/nbgv@master - id: nbgv - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push DysonNetwork.Drive Docker image - uses: docker/build-push-action@v6 - with: - file: DysonNetwork.Drive/Dockerfile - context: . - push: true - tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-drive:latest - platforms: linux/amd64 - - build-gateway: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup NBGV - uses: dotnet/nbgv@master - id: nbgv - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push DysonNetwork.Gateway Docker image - uses: docker/build-push-action@v6 - with: - file: DysonNetwork.Gateway/Dockerfile - context: . - push: true - tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-gateway:latest - platforms: linux/amd64 - - build-develop: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup NBGV - uses: dotnet/nbgv@master - id: nbgv - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push DysonNetwork.Develop Docker image - uses: docker/build-push-action@v6 - with: - file: DysonNetwork.Develop/Dockerfile - context: . - push: true - tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-develop:latest - platforms: linux/amd64 - +name: Build and Push Microservices + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + build-sphere: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup NBGV + uses: dotnet/nbgv@master + id: nbgv + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push DysonNetwork.Sphere Docker image + uses: docker/build-push-action@v6 + with: + file: DysonNetwork.Sphere/Dockerfile + context: . + push: true + tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-sphere:latest + platforms: linux/amd64 + + build-pass: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup NBGV + uses: dotnet/nbgv@master + id: nbgv + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push DysonNetwork.Pass Docker image + uses: docker/build-push-action@v6 + with: + file: DysonNetwork.Pass/Dockerfile + context: . + push: true + tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-pass:latest + platforms: linux/amd64 + + build-ring: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup NBGV + uses: dotnet/nbgv@master + id: nbgv + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push DysonNetwork.Pusher Docker image + uses: docker/build-push-action@v6 + with: + file: DysonNetwork.Ring/Dockerfile + context: . + push: true + tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-ring:latest + platforms: linux/amd64 + + build-drive: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup NBGV + uses: dotnet/nbgv@master + id: nbgv + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push DysonNetwork.Drive Docker image + uses: docker/build-push-action@v6 + with: + file: DysonNetwork.Drive/Dockerfile + context: . + push: true + tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-drive:latest + platforms: linux/amd64 + + build-gateway: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup NBGV + uses: dotnet/nbgv@master + id: nbgv + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push DysonNetwork.Gateway Docker image + uses: docker/build-push-action@v6 + with: + file: DysonNetwork.Gateway/Dockerfile + context: . + push: true + tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-gateway:latest + platforms: linux/amd64 + + build-develop: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup NBGV + uses: dotnet/nbgv@master + id: nbgv + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push DysonNetwork.Develop Docker image + uses: docker/build-push-action@v6 + with: + file: DysonNetwork.Develop/Dockerfile + context: . + push: true + tags: ghcr.io/${{ vars.PACKAGE_OWNER }}/dyson-develop:latest + platforms: linux/amd64 diff --git a/DysonNetwork.Gateway/appsettings.json b/DysonNetwork.Gateway/appsettings.json index ccb508b..3357c9a 100644 --- a/DysonNetwork.Gateway/appsettings.json +++ b/DysonNetwork.Gateway/appsettings.json @@ -21,7 +21,7 @@ "DomainMappings": { "DysonNetwork.Pass": "id.solsynth.dev", "DysonNetwork.Drive": "drive.solsynth.dev", - "DysonNetwork.Pusher": "push.solsynth.dev", + "DysonNetwork.Ring": "push.solsynth.dev", "DysonNetwork.Sphere": "sphere.solsynth.dev" }, "PathAliases": { @@ -31,7 +31,7 @@ "DirectRoutes": [ { "Path": "/ws", - "Service": "DysonNetwork.Pusher" + "Service": "DysonNetwork.Ring" }, { "Path": "/api/tus", diff --git a/DysonNetwork.Pass/Account/AccountEventService.cs b/DysonNetwork.Pass/Account/AccountEventService.cs index 1e86f65..73233c1 100644 --- a/DysonNetwork.Pass/Account/AccountEventService.cs +++ b/DysonNetwork.Pass/Account/AccountEventService.cs @@ -14,7 +14,7 @@ public class AccountEventService( Wallet.PaymentService payment, ICacheService cache, IStringLocalizer localizer, - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, SubscriptionService subscriptions, Pass.Leveling.ExperienceService experienceService ) diff --git a/DysonNetwork.Pass/Account/AccountService.cs b/DysonNetwork.Pass/Account/AccountService.cs index a1b9fed..ab5a39b 100644 --- a/DysonNetwork.Pass/Account/AccountService.cs +++ b/DysonNetwork.Pass/Account/AccountService.cs @@ -28,7 +28,7 @@ public class AccountService( FileReferenceService.FileReferenceServiceClient fileRefs, AccountUsernameService uname, EmailService mailer, - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, IStringLocalizer localizer, IStringLocalizer emailLocalizer, ICacheService cache, diff --git a/DysonNetwork.Pass/Account/RelationshipService.cs b/DysonNetwork.Pass/Account/RelationshipService.cs index f64086d..ed627c8 100644 --- a/DysonNetwork.Pass/Account/RelationshipService.cs +++ b/DysonNetwork.Pass/Account/RelationshipService.cs @@ -10,7 +10,7 @@ namespace DysonNetwork.Pass.Account; public class RelationshipService( AppDatabase db, ICacheService cache, - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, IStringLocalizer localizer ) { diff --git a/DysonNetwork.Pass/Auth/AuthController.cs b/DysonNetwork.Pass/Auth/AuthController.cs index b5eb8d3..b71cc25 100644 --- a/DysonNetwork.Pass/Auth/AuthController.cs +++ b/DysonNetwork.Pass/Auth/AuthController.cs @@ -22,7 +22,7 @@ public class AuthController( AuthService auth, GeoIpService geo, ActionLogService als, - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, IConfiguration configuration, IStringLocalizer localizer ) : ControllerBase diff --git a/DysonNetwork.Pass/Email/EmailService.cs b/DysonNetwork.Pass/Email/EmailService.cs index 1c19a60..77b68e0 100644 --- a/DysonNetwork.Pass/Email/EmailService.cs +++ b/DysonNetwork.Pass/Email/EmailService.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Components; namespace DysonNetwork.Pass.Email; public class EmailService( - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, RazorViewRenderer viewRenderer, ILogger logger ) diff --git a/DysonNetwork.Pass/Program.cs b/DysonNetwork.Pass/Program.cs index e1a24c4..6a344fa 100644 --- a/DysonNetwork.Pass/Program.cs +++ b/DysonNetwork.Pass/Program.cs @@ -22,7 +22,7 @@ builder.Services.AddAppServices(builder.Configuration); builder.Services.AddAppRateLimiting(); builder.Services.AddAppAuthentication(); builder.Services.AddAppSwagger(); -builder.Services.AddPusherService(); +builder.Services.AddRingService(); builder.Services.AddDriveService(); builder.Services.AddDevelopService(); diff --git a/DysonNetwork.Pass/Startup/ServiceCollectionExtensions.cs b/DysonNetwork.Pass/Startup/ServiceCollectionExtensions.cs index 44bbd66..858b568 100644 --- a/DysonNetwork.Pass/Startup/ServiceCollectionExtensions.cs +++ b/DysonNetwork.Pass/Startup/ServiceCollectionExtensions.cs @@ -53,7 +53,7 @@ public static class ServiceCollectionExtensions options.MaxSendMessageSize = 16 * 1024 * 1024; // 16MB }); - services.AddPusherService(); + services.AddRingService(); // Register OIDC services services.AddScoped(); diff --git a/DysonNetwork.Pass/Wallet/PaymentService.cs b/DysonNetwork.Pass/Wallet/PaymentService.cs index 389c9be..c4e7b45 100644 --- a/DysonNetwork.Pass/Wallet/PaymentService.cs +++ b/DysonNetwork.Pass/Wallet/PaymentService.cs @@ -17,7 +17,7 @@ namespace DysonNetwork.Pass.Wallet; public class PaymentService( AppDatabase db, WalletService wat, - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, IStringLocalizer localizer, INatsConnection nats ) diff --git a/DysonNetwork.Pass/Wallet/SubscriptionService.cs b/DysonNetwork.Pass/Wallet/SubscriptionService.cs index 77b0154..82dccea 100644 --- a/DysonNetwork.Pass/Wallet/SubscriptionService.cs +++ b/DysonNetwork.Pass/Wallet/SubscriptionService.cs @@ -18,7 +18,7 @@ public class SubscriptionService( AppDatabase db, PaymentService payment, AccountService accounts, - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, IStringLocalizer localizer, IConfiguration configuration, ICacheService cache, diff --git a/DysonNetwork.Pusher/Dockerfile b/DysonNetwork.Pusher/Dockerfile deleted file mode 100644 index e0017cf..0000000 --- a/DysonNetwork.Pusher/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base -WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - libkrb5-dev - -USER $APP_UID - -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build -ARG BUILD_CONFIGURATION=Release -WORKDIR /src -COPY ["DysonNetwork.Pusher/DysonNetwork.Pusher.csproj", "DysonNetwork.Pusher/"] -RUN dotnet restore "DysonNetwork.Pusher/DysonNetwork.Pusher.csproj" -COPY . . -WORKDIR "/src/DysonNetwork.Pusher" -RUN dotnet build "./DysonNetwork.Pusher.csproj" -c $BUILD_CONFIGURATION -o /app/build - -FROM build AS publish -ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "./DysonNetwork.Pusher.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "DysonNetwork.Pusher.dll"] diff --git a/DysonNetwork.Pusher/AppDatabase.cs b/DysonNetwork.Ring/AppDatabase.cs similarity index 98% rename from DysonNetwork.Pusher/AppDatabase.cs rename to DysonNetwork.Ring/AppDatabase.cs index 422c208..d7d8a65 100644 --- a/DysonNetwork.Pusher/AppDatabase.cs +++ b/DysonNetwork.Ring/AppDatabase.cs @@ -1,6 +1,6 @@ using System.Linq.Expressions; using System.Reflection; -using DysonNetwork.Pusher.Notification; +using DysonNetwork.Ring.Notification; using DysonNetwork.Shared.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; @@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Query; using NodaTime; using Quartz; -namespace DysonNetwork.Pusher; +namespace DysonNetwork.Ring; public class AppDatabase( DbContextOptions options, diff --git a/DysonNetwork.Pusher/Connection/ClientTypeMiddleware.cs b/DysonNetwork.Ring/Connection/ClientTypeMiddleware.cs similarity index 97% rename from DysonNetwork.Pusher/Connection/ClientTypeMiddleware.cs rename to DysonNetwork.Ring/Connection/ClientTypeMiddleware.cs index 3d87e94..f66c6fa 100644 --- a/DysonNetwork.Pusher/Connection/ClientTypeMiddleware.cs +++ b/DysonNetwork.Ring/Connection/ClientTypeMiddleware.cs @@ -1,4 +1,4 @@ -namespace DysonNetwork.Pusher.Connection; +namespace DysonNetwork.Ring.Connection; public class ClientTypeMiddleware(RequestDelegate next) { diff --git a/DysonNetwork.Pusher/Connection/IWebSocketPacketHandler.cs b/DysonNetwork.Ring/Connection/IWebSocketPacketHandler.cs similarity index 88% rename from DysonNetwork.Pusher/Connection/IWebSocketPacketHandler.cs rename to DysonNetwork.Ring/Connection/IWebSocketPacketHandler.cs index 969285b..0613398 100644 --- a/DysonNetwork.Pusher/Connection/IWebSocketPacketHandler.cs +++ b/DysonNetwork.Ring/Connection/IWebSocketPacketHandler.cs @@ -1,7 +1,7 @@ using System.Net.WebSockets; using DysonNetwork.Shared.Proto; -namespace DysonNetwork.Pusher.Connection; +namespace DysonNetwork.Ring.Connection; public interface IWebSocketPacketHandler { diff --git a/DysonNetwork.Pusher/Connection/WebSocketController.cs b/DysonNetwork.Ring/Connection/WebSocketController.cs similarity index 98% rename from DysonNetwork.Pusher/Connection/WebSocketController.cs rename to DysonNetwork.Ring/Connection/WebSocketController.cs index cdc59ff..6a8e241 100644 --- a/DysonNetwork.Pusher/Connection/WebSocketController.cs +++ b/DysonNetwork.Ring/Connection/WebSocketController.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; -namespace DysonNetwork.Pusher.Connection; +namespace DysonNetwork.Ring.Connection; [ApiController] public class WebSocketController(WebSocketService ws, ILogger logger) : ControllerBase diff --git a/DysonNetwork.Pusher/Connection/WebSocketPacket.cs b/DysonNetwork.Ring/Connection/WebSocketPacket.cs similarity index 98% rename from DysonNetwork.Pusher/Connection/WebSocketPacket.cs rename to DysonNetwork.Ring/Connection/WebSocketPacket.cs index 87277d8..3050de0 100644 --- a/DysonNetwork.Pusher/Connection/WebSocketPacket.cs +++ b/DysonNetwork.Ring/Connection/WebSocketPacket.cs @@ -4,7 +4,7 @@ using DysonNetwork.Shared.Proto; using NodaTime; using NodaTime.Serialization.SystemTextJson; -namespace DysonNetwork.Pusher.Connection; +namespace DysonNetwork.Ring.Connection; public class WebSocketPacket { diff --git a/DysonNetwork.Pusher/Connection/WebSocketService.cs b/DysonNetwork.Ring/Connection/WebSocketService.cs similarity index 97% rename from DysonNetwork.Pusher/Connection/WebSocketService.cs rename to DysonNetwork.Ring/Connection/WebSocketService.cs index add7645..7454798 100644 --- a/DysonNetwork.Pusher/Connection/WebSocketService.cs +++ b/DysonNetwork.Ring/Connection/WebSocketService.cs @@ -5,7 +5,7 @@ using DysonNetwork.Shared.Data; using DysonNetwork.Shared.Proto; using Grpc.Core; -namespace DysonNetwork.Pusher.Connection; +namespace DysonNetwork.Ring.Connection; public class WebSocketService { @@ -159,7 +159,7 @@ public class WebSocketService clientKeyPath, clientCertPassword ); - var client = new PusherHandlerService.PusherHandlerServiceClient(callInvoker); + var client = new RingHandlerService.RingHandlerServiceClient(callInvoker); try { diff --git a/DysonNetwork.Ring/Dockerfile b/DysonNetwork.Ring/Dockerfile new file mode 100644 index 0000000..d054998 --- /dev/null +++ b/DysonNetwork.Ring/Dockerfile @@ -0,0 +1,27 @@ +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + libkrb5-dev + +USER $APP_UID + +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["DysonNetwork.Ring/DysonNetwork.Ring.csproj", "DysonNetwork.Ring/"] +RUN dotnet restore "DysonNetwork.Ring/DysonNetwork.Ring.csproj" +COPY . . +WORKDIR "/src/DysonNetwork.Ring" +RUN dotnet build "./DysonNetwork.Ring.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./DysonNetwork.Ring.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "DysonNetwork.Ring.dll"] diff --git a/DysonNetwork.Pusher/DysonNetwork.Pusher.csproj b/DysonNetwork.Ring/DysonNetwork.Ring.csproj similarity index 97% rename from DysonNetwork.Pusher/DysonNetwork.Pusher.csproj rename to DysonNetwork.Ring/DysonNetwork.Ring.csproj index 49445bb..ae8a231 100644 --- a/DysonNetwork.Pusher/DysonNetwork.Pusher.csproj +++ b/DysonNetwork.Ring/DysonNetwork.Ring.csproj @@ -5,6 +5,7 @@ enable enable Linux + DysonNetwork.Pusher diff --git a/DysonNetwork.Pusher/Email/EmailService.cs b/DysonNetwork.Ring/Email/EmailService.cs similarity index 98% rename from DysonNetwork.Pusher/Email/EmailService.cs rename to DysonNetwork.Ring/Email/EmailService.cs index e544653..c815704 100644 --- a/DysonNetwork.Pusher/Email/EmailService.cs +++ b/DysonNetwork.Ring/Email/EmailService.cs @@ -1,7 +1,7 @@ using MailKit.Net.Smtp; using MimeKit; -namespace DysonNetwork.Pusher.Email; +namespace DysonNetwork.Ring.Email; public class EmailServiceConfiguration { diff --git a/DysonNetwork.Pusher/Migrations/20250713122638_InitialMigration.Designer.cs b/DysonNetwork.Ring/Migrations/20250713122638_InitialMigration.Designer.cs similarity index 95% rename from DysonNetwork.Pusher/Migrations/20250713122638_InitialMigration.Designer.cs rename to DysonNetwork.Ring/Migrations/20250713122638_InitialMigration.Designer.cs index 25b1168..f0fe8d4 100644 --- a/DysonNetwork.Pusher/Migrations/20250713122638_InitialMigration.Designer.cs +++ b/DysonNetwork.Ring/Migrations/20250713122638_InitialMigration.Designer.cs @@ -1,7 +1,7 @@ // using System; using System.Collections.Generic; -using DysonNetwork.Pusher; +using DysonNetwork.Ring; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; @@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace DysonNetwork.Pusher.Migrations +namespace DysonNetwork.Ring.Migrations { [DbContext(typeof(AppDatabase))] [Migration("20250713122638_InitialMigration")] @@ -27,7 +27,7 @@ namespace DysonNetwork.Pusher.Migrations NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - modelBuilder.Entity("DysonNetwork.Pusher.Notification.Notification", b => + modelBuilder.Entity("DysonNetwork.Ring.Notification.Notification", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -89,7 +89,7 @@ namespace DysonNetwork.Pusher.Migrations b.ToTable("notifications", (string)null); }); - modelBuilder.Entity("DysonNetwork.Pusher.Notification.PushSubscription", b => + modelBuilder.Entity("DysonNetwork.Ring.Notification.PushSubscription", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/DysonNetwork.Pusher/Migrations/20250713122638_InitialMigration.cs b/DysonNetwork.Ring/Migrations/20250713122638_InitialMigration.cs similarity index 98% rename from DysonNetwork.Pusher/Migrations/20250713122638_InitialMigration.cs rename to DysonNetwork.Ring/Migrations/20250713122638_InitialMigration.cs index b5ac718..40139e9 100644 --- a/DysonNetwork.Pusher/Migrations/20250713122638_InitialMigration.cs +++ b/DysonNetwork.Ring/Migrations/20250713122638_InitialMigration.cs @@ -5,7 +5,7 @@ using NodaTime; #nullable disable -namespace DysonNetwork.Pusher.Migrations +namespace DysonNetwork.Ring.Migrations { /// public partial class InitialMigration : Migration diff --git a/DysonNetwork.Pusher/Migrations/20250724070546_UpdateNotificationMeta.Designer.cs b/DysonNetwork.Ring/Migrations/20250724070546_UpdateNotificationMeta.Designer.cs similarity index 95% rename from DysonNetwork.Pusher/Migrations/20250724070546_UpdateNotificationMeta.Designer.cs rename to DysonNetwork.Ring/Migrations/20250724070546_UpdateNotificationMeta.Designer.cs index 17e17e0..b4c31ac 100644 --- a/DysonNetwork.Pusher/Migrations/20250724070546_UpdateNotificationMeta.Designer.cs +++ b/DysonNetwork.Ring/Migrations/20250724070546_UpdateNotificationMeta.Designer.cs @@ -1,7 +1,7 @@ // using System; using System.Collections.Generic; -using DysonNetwork.Pusher; +using DysonNetwork.Ring; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; @@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace DysonNetwork.Pusher.Migrations +namespace DysonNetwork.Ring.Migrations { [DbContext(typeof(AppDatabase))] [Migration("20250724070546_UpdateNotificationMeta")] @@ -27,7 +27,7 @@ namespace DysonNetwork.Pusher.Migrations NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - modelBuilder.Entity("DysonNetwork.Pusher.Notification.Notification", b => + modelBuilder.Entity("DysonNetwork.Ring.Notification.Notification", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -90,7 +90,7 @@ namespace DysonNetwork.Pusher.Migrations b.ToTable("notifications", (string)null); }); - modelBuilder.Entity("DysonNetwork.Pusher.Notification.PushSubscription", b => + modelBuilder.Entity("DysonNetwork.Ring.Notification.PushSubscription", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/DysonNetwork.Pusher/Migrations/20250724070546_UpdateNotificationMeta.cs b/DysonNetwork.Ring/Migrations/20250724070546_UpdateNotificationMeta.cs similarity index 96% rename from DysonNetwork.Pusher/Migrations/20250724070546_UpdateNotificationMeta.cs rename to DysonNetwork.Ring/Migrations/20250724070546_UpdateNotificationMeta.cs index 63ef74d..d487270 100644 --- a/DysonNetwork.Pusher/Migrations/20250724070546_UpdateNotificationMeta.cs +++ b/DysonNetwork.Ring/Migrations/20250724070546_UpdateNotificationMeta.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace DysonNetwork.Pusher.Migrations +namespace DysonNetwork.Ring.Migrations { /// public partial class UpdateNotificationMeta : Migration diff --git a/DysonNetwork.Pusher/Migrations/AppDatabaseModelSnapshot.cs b/DysonNetwork.Ring/Migrations/AppDatabaseModelSnapshot.cs similarity index 95% rename from DysonNetwork.Pusher/Migrations/AppDatabaseModelSnapshot.cs rename to DysonNetwork.Ring/Migrations/AppDatabaseModelSnapshot.cs index 55dfdcd..561038b 100644 --- a/DysonNetwork.Pusher/Migrations/AppDatabaseModelSnapshot.cs +++ b/DysonNetwork.Ring/Migrations/AppDatabaseModelSnapshot.cs @@ -1,7 +1,7 @@ // using System; using System.Collections.Generic; -using DysonNetwork.Pusher; +using DysonNetwork.Ring; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; @@ -10,7 +10,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace DysonNetwork.Pusher.Migrations +namespace DysonNetwork.Ring.Migrations { [DbContext(typeof(AppDatabase))] partial class AppDatabaseModelSnapshot : ModelSnapshot @@ -24,7 +24,7 @@ namespace DysonNetwork.Pusher.Migrations NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - modelBuilder.Entity("DysonNetwork.Pusher.Notification.Notification", b => + modelBuilder.Entity("DysonNetwork.Ring.Notification.Notification", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -87,7 +87,7 @@ namespace DysonNetwork.Pusher.Migrations b.ToTable("notifications", (string)null); }); - modelBuilder.Entity("DysonNetwork.Pusher.Notification.PushSubscription", b => + modelBuilder.Entity("DysonNetwork.Ring.Notification.PushSubscription", b => { b.Property("Id") .ValueGeneratedOnAdd() diff --git a/DysonNetwork.Pusher/Notification/Notification.cs b/DysonNetwork.Ring/Notification/Notification.cs similarity index 94% rename from DysonNetwork.Pusher/Notification/Notification.cs rename to DysonNetwork.Ring/Notification/Notification.cs index 322dca7..c997fed 100644 --- a/DysonNetwork.Pusher/Notification/Notification.cs +++ b/DysonNetwork.Ring/Notification/Notification.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema; using DysonNetwork.Shared.Data; using NodaTime; -namespace DysonNetwork.Pusher.Notification; +namespace DysonNetwork.Ring.Notification; public class Notification : ModelBase { diff --git a/DysonNetwork.Pusher/Notification/NotificationController.cs b/DysonNetwork.Ring/Notification/NotificationController.cs similarity index 99% rename from DysonNetwork.Pusher/Notification/NotificationController.cs rename to DysonNetwork.Ring/Notification/NotificationController.cs index 2df3465..0552094 100644 --- a/DysonNetwork.Pusher/Notification/NotificationController.cs +++ b/DysonNetwork.Ring/Notification/NotificationController.cs @@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using NodaTime; -namespace DysonNetwork.Pusher.Notification; +namespace DysonNetwork.Ring.Notification; [ApiController] [Route("/api/notifications")] diff --git a/DysonNetwork.Pusher/Notification/NotificationFlushHandler.cs b/DysonNetwork.Ring/Notification/NotificationFlushHandler.cs similarity index 94% rename from DysonNetwork.Pusher/Notification/NotificationFlushHandler.cs rename to DysonNetwork.Ring/Notification/NotificationFlushHandler.cs index 514b6a0..893e460 100644 --- a/DysonNetwork.Pusher/Notification/NotificationFlushHandler.cs +++ b/DysonNetwork.Ring/Notification/NotificationFlushHandler.cs @@ -3,7 +3,7 @@ using EFCore.BulkExtensions; using NodaTime; using Quartz; -namespace DysonNetwork.Pusher.Notification; +namespace DysonNetwork.Ring.Notification; public class NotificationFlushHandler(AppDatabase db) : IFlushHandler { diff --git a/DysonNetwork.Pusher/Notification/PushService.cs b/DysonNetwork.Ring/Notification/PushService.cs similarity index 98% rename from DysonNetwork.Pusher/Notification/PushService.cs rename to DysonNetwork.Ring/Notification/PushService.cs index 2f31969..29b5eb8 100644 --- a/DysonNetwork.Pusher/Notification/PushService.cs +++ b/DysonNetwork.Ring/Notification/PushService.cs @@ -1,13 +1,13 @@ using CorePush.Apple; using CorePush.Firebase; -using DysonNetwork.Pusher.Connection; -using DysonNetwork.Pusher.Services; +using DysonNetwork.Ring.Connection; +using DysonNetwork.Ring.Services; using DysonNetwork.Shared.Proto; using Microsoft.EntityFrameworkCore; using NodaTime; -using WebSocketPacket = DysonNetwork.Pusher.Connection.WebSocketPacket; +using WebSocketPacket = DysonNetwork.Ring.Connection.WebSocketPacket; -namespace DysonNetwork.Pusher.Notification; +namespace DysonNetwork.Ring.Notification; public class PushService { diff --git a/DysonNetwork.Pusher/Notification/PushSubscription.cs b/DysonNetwork.Ring/Notification/PushSubscription.cs similarity index 93% rename from DysonNetwork.Pusher/Notification/PushSubscription.cs rename to DysonNetwork.Ring/Notification/PushSubscription.cs index 1b50367..753aff5 100644 --- a/DysonNetwork.Pusher/Notification/PushSubscription.cs +++ b/DysonNetwork.Ring/Notification/PushSubscription.cs @@ -3,7 +3,7 @@ using DysonNetwork.Shared.Data; using Microsoft.EntityFrameworkCore; using NodaTime; -namespace DysonNetwork.Pusher.Notification; +namespace DysonNetwork.Ring.Notification; public enum PushProvider { diff --git a/DysonNetwork.Pusher/Program.cs b/DysonNetwork.Ring/Program.cs similarity index 95% rename from DysonNetwork.Pusher/Program.cs rename to DysonNetwork.Ring/Program.cs index 7bfb0ba..2425a43 100644 --- a/DysonNetwork.Pusher/Program.cs +++ b/DysonNetwork.Ring/Program.cs @@ -1,5 +1,5 @@ -using DysonNetwork.Pusher; -using DysonNetwork.Pusher.Startup; +using DysonNetwork.Ring; +using DysonNetwork.Ring.Startup; using DysonNetwork.Shared.Auth; using DysonNetwork.Shared.Http; using DysonNetwork.Shared.Registry; diff --git a/DysonNetwork.Pusher/Properties/launchSettings.json b/DysonNetwork.Ring/Properties/launchSettings.json similarity index 100% rename from DysonNetwork.Pusher/Properties/launchSettings.json rename to DysonNetwork.Ring/Properties/launchSettings.json diff --git a/DysonNetwork.Pusher/Services/PusherServiceGrpc.cs b/DysonNetwork.Ring/Services/PusherServiceGrpc.cs similarity index 96% rename from DysonNetwork.Pusher/Services/PusherServiceGrpc.cs rename to DysonNetwork.Ring/Services/PusherServiceGrpc.cs index 09dd973..bb21a56 100644 --- a/DysonNetwork.Pusher/Services/PusherServiceGrpc.cs +++ b/DysonNetwork.Ring/Services/PusherServiceGrpc.cs @@ -1,19 +1,19 @@ -using DysonNetwork.Pusher.Connection; -using DysonNetwork.Pusher.Email; -using DysonNetwork.Pusher.Notification; +using DysonNetwork.Ring.Connection; +using DysonNetwork.Ring.Email; +using DysonNetwork.Ring.Notification; using DysonNetwork.Shared.Proto; using DysonNetwork.Shared.Registry; using Google.Protobuf.WellKnownTypes; using Grpc.Core; using System.Text.Json; -namespace DysonNetwork.Pusher.Services; +namespace DysonNetwork.Ring.Services; -public class PusherServiceGrpc( +public class RingServiceGrpc( QueueService queueService, WebSocketService websocket, PushService pushService -) : PusherService.PusherServiceBase +) : RingService.RingServiceBase { public override async Task SendEmail(SendEmailRequest request, ServerCallContext context) { diff --git a/DysonNetwork.Pusher/Services/QueueBackgroundService.cs b/DysonNetwork.Ring/Services/QueueBackgroundService.cs similarity index 97% rename from DysonNetwork.Pusher/Services/QueueBackgroundService.cs rename to DysonNetwork.Ring/Services/QueueBackgroundService.cs index d39e444..bb3b357 100644 --- a/DysonNetwork.Pusher/Services/QueueBackgroundService.cs +++ b/DysonNetwork.Ring/Services/QueueBackgroundService.cs @@ -1,6 +1,6 @@ using System.Text.Json; -using DysonNetwork.Pusher.Email; -using DysonNetwork.Pusher.Notification; +using DysonNetwork.Ring.Email; +using DysonNetwork.Ring.Notification; using DysonNetwork.Shared.Proto; using DysonNetwork.Shared.Registry; using DysonNetwork.Shared.Stream; @@ -10,7 +10,7 @@ using NATS.Client.JetStream; using NATS.Client.JetStream.Models; using NATS.Net; -namespace DysonNetwork.Pusher.Services; +namespace DysonNetwork.Ring.Services; public class QueueBackgroundService( INatsConnection nats, diff --git a/DysonNetwork.Pusher/Services/QueueService.cs b/DysonNetwork.Ring/Services/QueueService.cs similarity index 98% rename from DysonNetwork.Pusher/Services/QueueService.cs rename to DysonNetwork.Ring/Services/QueueService.cs index 094d504..3a3622c 100644 --- a/DysonNetwork.Pusher/Services/QueueService.cs +++ b/DysonNetwork.Ring/Services/QueueService.cs @@ -4,7 +4,7 @@ using NATS.Client.Core; using NATS.Client.JetStream; using NATS.Net; -namespace DysonNetwork.Pusher.Services; +namespace DysonNetwork.Ring.Services; public class QueueService(INatsConnection nats) { diff --git a/DysonNetwork.Pusher/Startup/ApplicationConfiguration.cs b/DysonNetwork.Ring/Startup/ApplicationConfiguration.cs similarity index 89% rename from DysonNetwork.Pusher/Startup/ApplicationConfiguration.cs rename to DysonNetwork.Ring/Startup/ApplicationConfiguration.cs index 9af303a..0c00e5f 100644 --- a/DysonNetwork.Pusher/Startup/ApplicationConfiguration.cs +++ b/DysonNetwork.Ring/Startup/ApplicationConfiguration.cs @@ -1,9 +1,9 @@ using System.Net; -using DysonNetwork.Pusher.Services; +using DysonNetwork.Ring.Services; using DysonNetwork.Shared.Http; using Microsoft.AspNetCore.HttpOverrides; -namespace DysonNetwork.Pusher.Startup; +namespace DysonNetwork.Ring.Startup; public static class ApplicationConfiguration { @@ -39,7 +39,7 @@ public static class ApplicationConfiguration public static WebApplication ConfigureGrpcServices(this WebApplication app) { - app.MapGrpcService(); + app.MapGrpcService(); return app; } diff --git a/DysonNetwork.Pusher/Startup/ScheduledJobsConfiguration.cs b/DysonNetwork.Ring/Startup/ScheduledJobsConfiguration.cs similarity index 93% rename from DysonNetwork.Pusher/Startup/ScheduledJobsConfiguration.cs rename to DysonNetwork.Ring/Startup/ScheduledJobsConfiguration.cs index 239ada7..d26d76a 100644 --- a/DysonNetwork.Pusher/Startup/ScheduledJobsConfiguration.cs +++ b/DysonNetwork.Ring/Startup/ScheduledJobsConfiguration.cs @@ -1,7 +1,7 @@ -using DysonNetwork.Pusher.Notification; +using DysonNetwork.Ring.Notification; using Quartz; -namespace DysonNetwork.Pusher.Startup; +namespace DysonNetwork.Ring.Startup; public static class ScheduledJobsConfiguration { diff --git a/DysonNetwork.Pusher/Startup/ServiceCollectionExtensions.cs b/DysonNetwork.Ring/Startup/ServiceCollectionExtensions.cs similarity index 94% rename from DysonNetwork.Pusher/Startup/ServiceCollectionExtensions.cs rename to DysonNetwork.Ring/Startup/ServiceCollectionExtensions.cs index 0a51bd2..63677b4 100644 --- a/DysonNetwork.Pusher/Startup/ServiceCollectionExtensions.cs +++ b/DysonNetwork.Ring/Startup/ServiceCollectionExtensions.cs @@ -3,10 +3,10 @@ using System.Text.Json.Serialization; using System.Threading.RateLimiting; using CorePush.Apple; using CorePush.Firebase; -using DysonNetwork.Pusher.Connection; -using DysonNetwork.Pusher.Email; -using DysonNetwork.Pusher.Notification; -using DysonNetwork.Pusher.Services; +using DysonNetwork.Ring.Connection; +using DysonNetwork.Ring.Email; +using DysonNetwork.Ring.Notification; +using DysonNetwork.Ring.Services; using DysonNetwork.Shared.Cache; using Microsoft.AspNetCore.RateLimiting; using Microsoft.OpenApi.Models; @@ -14,7 +14,7 @@ using NodaTime; using NodaTime.Serialization.SystemTextJson; using StackExchange.Redis; -namespace DysonNetwork.Pusher.Startup; +namespace DysonNetwork.Ring.Startup; public static class ServiceCollectionExtensions { @@ -44,7 +44,7 @@ public static class ServiceCollectionExtensions services.AddGrpc(); // Register gRPC services - services.AddScoped(); + services.AddScoped(); // Register OIDC services services.AddControllers().AddJsonOptions(options => @@ -88,7 +88,7 @@ public static class ServiceCollectionExtensions options.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", - Title = "Dyson Pusher", + Title = "Dyson Ring", Description = "The pusher service of the Dyson Network. Mainly handling emailing, notifications and websockets.", TermsOfService = new Uri("https://solsynth.dev/terms"), License = new OpenApiLicense diff --git a/DysonNetwork.Pusher/appsettings.json b/DysonNetwork.Ring/appsettings.json similarity index 97% rename from DysonNetwork.Pusher/appsettings.json rename to DysonNetwork.Ring/appsettings.json index 5f77b41..228bc9f 100644 --- a/DysonNetwork.Pusher/appsettings.json +++ b/DysonNetwork.Ring/appsettings.json @@ -44,7 +44,7 @@ "::1" ], "Service": { - "Name": "DysonNetwork.Pusher", + "Name": "DysonNetwork.Ring", "Url": "https://localhost:7259", "ClientCert": "../Certificates/client.crt", "ClientKey": "../Certificates/client.key" diff --git a/DysonNetwork.Shared/Proto/GrpcClientHelper.cs b/DysonNetwork.Shared/Proto/GrpcClientHelper.cs index 29570b4..65ca1d6 100644 --- a/DysonNetwork.Shared/Proto/GrpcClientHelper.cs +++ b/DysonNetwork.Shared/Proto/GrpcClientHelper.cs @@ -110,15 +110,15 @@ public static class GrpcClientHelper clientCertPassword)); } - public static async Task CreatePusherServiceClient( + public static async Task CreateRingServiceClient( IEtcdClient etcdClient, string clientCertPath, string clientKeyPath, string? clientCertPassword = null ) { - var url = await GetServiceUrlFromEtcd(etcdClient, "DysonNetwork.Pusher"); - return new PusherService.PusherServiceClient(CreateCallInvoker(url, clientCertPath, clientKeyPath, + var url = await GetServiceUrlFromEtcd(etcdClient, "DysonNetwork.Ring"); + return new RingService.RingServiceClient(CreateCallInvoker(url, clientCertPath, clientKeyPath, clientCertPassword)); } diff --git a/DysonNetwork.Shared/Proto/pusher.proto b/DysonNetwork.Shared/Proto/pusher.proto index ef391e5..aba6010 100644 --- a/DysonNetwork.Shared/Proto/pusher.proto +++ b/DysonNetwork.Shared/Proto/pusher.proto @@ -10,8 +10,8 @@ import "google/protobuf/wrappers.proto"; import "account.proto"; -// PusherService provides methods to send various types of notifications. -service PusherService { +// RingService provides methods to send various types of notifications. +service RingService { // Sends an email. rpc SendEmail(SendEmailRequest) returns (google.protobuf.Empty) {} @@ -117,7 +117,7 @@ message GetWebsocketConnectionStatusResponse { } -service PusherHandlerService { +service RingHandlerService { rpc ReceiveWebSocketPacket(ReceiveWebSocketPacketRequest) returns (google.protobuf.Empty) {} } diff --git a/DysonNetwork.Shared/Registry/ServiceInjectionHelper.cs b/DysonNetwork.Shared/Registry/ServiceInjectionHelper.cs index ad032bd..bd1d997 100644 --- a/DysonNetwork.Shared/Registry/ServiceInjectionHelper.cs +++ b/DysonNetwork.Shared/Registry/ServiceInjectionHelper.cs @@ -7,9 +7,9 @@ namespace DysonNetwork.Shared.Registry; public static class ServiceInjectionHelper { - public static IServiceCollection AddPusherService(this IServiceCollection services) + public static IServiceCollection AddRingService(this IServiceCollection services) { - services.AddSingleton(sp => + services.AddSingleton(sp => { var etcdClient = sp.GetRequiredService(); var config = sp.GetRequiredService(); @@ -18,7 +18,7 @@ public static class ServiceInjectionHelper var clientCertPassword = config["Service:CertPassword"]; return GrpcClientHelper - .CreatePusherServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword) + .CreateRingServiceClient(etcdClient, clientCertPath, clientKeyPath, clientCertPassword) .GetAwaiter() .GetResult(); }); diff --git a/DysonNetwork.Sphere/Chat/ChatRoomController.cs b/DysonNetwork.Sphere/Chat/ChatRoomController.cs index 2665ee3..895539d 100644 --- a/DysonNetwork.Sphere/Chat/ChatRoomController.cs +++ b/DysonNetwork.Sphere/Chat/ChatRoomController.cs @@ -26,7 +26,7 @@ public class ChatRoomController( FileService.FileServiceClient files, FileReferenceService.FileReferenceServiceClient fileRefs, ActionLogService.ActionLogServiceClient als, - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, AccountClientHelper accountsHelper ) : ControllerBase { diff --git a/DysonNetwork.Sphere/Chat/ChatService.cs b/DysonNetwork.Sphere/Chat/ChatService.cs index c8419cc..b1c6e1f 100644 --- a/DysonNetwork.Sphere/Chat/ChatService.cs +++ b/DysonNetwork.Sphere/Chat/ChatService.cs @@ -202,7 +202,7 @@ public partial class ChatService( message.ChatRoom = room; using var scope = scopeFactory.CreateScope(); - var scopedNty = scope.ServiceProvider.GetRequiredService(); + var scopedNty = scope.ServiceProvider.GetRequiredService(); var scopedCrs = scope.ServiceProvider.GetRequiredService(); var members = await scopedCrs.ListRoomMembers(room.Id); diff --git a/DysonNetwork.Sphere/Connection/WebsocketHandler.cs b/DysonNetwork.Sphere/Connection/WebsocketHandler.cs index a982804..4dbf760 100644 --- a/DysonNetwork.Sphere/Connection/WebsocketHandler.cs +++ b/DysonNetwork.Sphere/Connection/WebsocketHandler.cs @@ -6,8 +6,8 @@ using Grpc.Core; namespace DysonNetwork.Sphere.Connection; -public class WebSocketHandlerGrpc(PusherService.PusherServiceClient pusher, ChatRoomService crs, ChatService cs) - : PusherHandlerService.PusherHandlerServiceBase +public class WebSocketHandlerGrpc(RingService.RingServiceClient pusher, ChatRoomService crs, ChatService cs) + : RingHandlerService.RingHandlerServiceBase { public override async Task ReceiveWebSocketPacket( ReceiveWebSocketPacketRequest request, diff --git a/DysonNetwork.Sphere/Post/PostService.cs b/DysonNetwork.Sphere/Post/PostService.cs index fc02344..8c3d1d2 100644 --- a/DysonNetwork.Sphere/Post/PostService.cs +++ b/DysonNetwork.Sphere/Post/PostService.cs @@ -25,7 +25,7 @@ public partial class PostService( ILogger logger, FileService.FileServiceClient files, FileReferenceService.FileReferenceServiceClient fileRefs, - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, PollService polls, Publisher.PublisherService ps, WebReaderService reader @@ -165,7 +165,7 @@ public partial class PostService( var sender = post.Publisher; using var scope = factory.CreateScope(); var pub = scope.ServiceProvider.GetRequiredService(); - var nty = scope.ServiceProvider.GetRequiredService(); + var nty = scope.ServiceProvider.GetRequiredService(); var accounts = scope.ServiceProvider.GetRequiredService(); try { @@ -534,7 +534,7 @@ public partial class PostService( { using var scope = factory.CreateScope(); var pub = scope.ServiceProvider.GetRequiredService(); - var nty = scope.ServiceProvider.GetRequiredService(); + var nty = scope.ServiceProvider.GetRequiredService(); var accounts = scope.ServiceProvider.GetRequiredService(); try { @@ -937,7 +937,7 @@ public partial class PostService( { using var scope = factory.CreateScope(); var pub = scope.ServiceProvider.GetRequiredService(); - var nty = scope.ServiceProvider.GetRequiredService(); + var nty = scope.ServiceProvider.GetRequiredService(); var accounts = scope.ServiceProvider.GetRequiredService(); var accountsHelper = scope.ServiceProvider.GetRequiredService(); try diff --git a/DysonNetwork.Sphere/Program.cs b/DysonNetwork.Sphere/Program.cs index 1087936..8700d83 100644 --- a/DysonNetwork.Sphere/Program.cs +++ b/DysonNetwork.Sphere/Program.cs @@ -26,7 +26,7 @@ builder.Services.AddAppAuthentication(); builder.Services.AddAppSwagger(); builder.Services.AddDysonAuth(); builder.Services.AddAccountService(); -builder.Services.AddPusherService(); +builder.Services.AddRingService(); builder.Services.AddDriveService(); // Add flush handlers and websocket handlers diff --git a/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs b/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs index 4907b9a..013e273 100644 --- a/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs +++ b/DysonNetwork.Sphere/Publisher/PublisherSubscriptionService.cs @@ -13,7 +13,7 @@ public class PublisherSubscriptionService( PostService ps, IStringLocalizer localizer, ICacheService cache, - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, AccountService.AccountServiceClient accounts ) { diff --git a/DysonNetwork.Sphere/Realm/RealmService.cs b/DysonNetwork.Sphere/Realm/RealmService.cs index 8a50d6f..6afc257 100644 --- a/DysonNetwork.Sphere/Realm/RealmService.cs +++ b/DysonNetwork.Sphere/Realm/RealmService.cs @@ -10,7 +10,7 @@ namespace DysonNetwork.Sphere.Realm; public class RealmService( AppDatabase db, - PusherService.PusherServiceClient pusher, + RingService.RingServiceClient pusher, AccountService.AccountServiceClient accounts, IStringLocalizer localizer, AccountClientHelper accountsHelper, diff --git a/DysonNetwork.sln b/DysonNetwork.sln index 5e3c276..4a515f3 100644 --- a/DysonNetwork.sln +++ b/DysonNetwork.sln @@ -12,7 +12,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DysonNetwork.Pass", "DysonN EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DysonNetwork.Shared", "DysonNetwork.Shared\DysonNetwork.Shared.csproj", "{DB46D1A6-79B4-43FC-A9A9-115CDA26947A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DysonNetwork.Pusher", "DysonNetwork.Pusher\DysonNetwork.Pusher.csproj", "{D5DAFB0D-487E-48EF-BA2F-C581C846F63B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DysonNetwork.Ring", "DysonNetwork.Ring\DysonNetwork.Ring.csproj", "{D5DAFB0D-487E-48EF-BA2F-C581C846F63B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DysonNetwork.Drive", "DysonNetwork.Drive\DysonNetwork.Drive.csproj", "{8DE0B783-8852-494D-B90A-201ABBB71202}" EndProject diff --git a/compose.yaml b/compose.yaml index 7ee1c9f..fee2329 100644 --- a/compose.yaml +++ b/compose.yaml @@ -57,15 +57,15 @@ services: etcd: condition: service_healthy - pusher: - image: xsheep2010/dyson-pusher:latest + ring: + image: xsheep2010/dyson-ring:latest ports: - "8003:8080" environment: - ConnectionStrings__Etcd=http://etcd:2379 - Etcd__Insecure=true - - Service__Name=DysonNetwork.Pusher - - Service__Url=http://pusher:8080 + - Service__Name=DysonNetwork.Ring + - Service__Url=http://ring:8080 depends_on: etcd: condition: service_healthy