| **/.classpath | |||||
| **/.dockerignore | |||||
| **/.env | |||||
| **/.git | |||||
| **/.gitignore | |||||
| **/.project | |||||
| **/.settings | |||||
| **/.toolstarget | |||||
| **/.vs | |||||
| **/.vscode | |||||
| **/*.*proj.user | |||||
| **/*.dbmdl | |||||
| **/*.jfm | |||||
| **/azds.yaml | |||||
| **/bin | |||||
| **/charts | |||||
| **/docker-compose* | |||||
| **/Dockerfile* | |||||
| **/node_modules | |||||
| **/npm-debug.log | |||||
| **/obj | |||||
| **/secrets.dev.yaml | |||||
| **/values.dev.yaml | |||||
| LICENSE | |||||
| README.md |
| FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base | FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base | ||||
| WORKDIR /app | WORKDIR /app | ||||
| EXPOSE 80 | EXPOSE 80 | ||||
| EXPOSE 443 | |||||
| FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | ||||
| WORKDIR /src | WORKDIR /src | ||||
| COPY ["SpotifyService/SpotifyService.csproj", "SpotifyService/SpotifyService/"] | |||||
| COPY ["IdentityProvider/IdentityProvider.csproj", "IdentityProvider/IdentityProvider/"] | |||||
| COPY ["NemAnBlazor/NemAnBlazor.csproj", "NemAnBlazor/NemAnBlazor/"] | |||||
| COPY ["SpotifyWorker/SpotifyWorker.csproj", "SpotifyWorker/SpotifyWorker/"] | |||||
| COPY *.sln . | |||||
| COPY *.csproj ./ | |||||
| RUN dotnet restore "SpotifyService/SpotifyService.csproj" | |||||
| RUN dotnet restore "IdentityProvider/IdentityProvider.csproj" | |||||
| COPY ["NemAnBlazor.csproj", "NemAnBlazor/"] | |||||
| COPY ["GrpcShared/GrpcShared.csproj", "GrpcShared/"] | |||||
| RUN dotnet restore "NemAnBlazor/NemAnBlazor.csproj" | RUN dotnet restore "NemAnBlazor/NemAnBlazor.csproj" | ||||
| RUN dotnet restore "SpotifyWorker/SpotifyWorker.csproj" | |||||
| COPY . . | |||||
| WORKDIR "/src/SpotifyService/SpotifyService" | |||||
| RUN dotnet build "SpotifyService.csproj" -c Release -o /app/build | |||||
| COPY . . | COPY . . | ||||
| WORKDIR "/src/IdentityProvider/IdentityProvider" | |||||
| RUN dotnet build "IdentityProvider.csproj" -c Release -o /app/build1 | |||||
| COPY . . | |||||
| WORKDIR "/src/NemAnBlazor/NemAnBlazor" | |||||
| RUN dotnet build "NemAnBlazor.csproj" -c Release -o /app/build2 | |||||
| COPY . . | |||||
| WORKDIR "/src/SpotifyWorker/SpotifyWorker" | |||||
| RUN dotnet build "SpotifyWorker.csproj" -c Release -o /app/build3 | |||||
| WORKDIR "/src/NemAnBlazor" | |||||
| RUN dotnet build "NemAnBlazor.csproj" -c Release -o /app/build | |||||
| FROM build AS publish | FROM build AS publish | ||||
| RUN dotnet publish -c Release -o /app/publish "/src/SpotifyService/SpotifyService.csproj" | |||||
| RUN dotnet publish -c Release -o /app/publish1 "/src/IdentityProvider/IdentityProvider.csproj" | |||||
| RUN dotnet publish -c Release -o /app/publish2 "/src/NemAnBlazor/NemAnBlazor.csproj" | |||||
| RUN dotnet publish -c Release -o /app/publish3 "/src/SpotifyWorker/SpotifyWorker.csproj" | |||||
| RUN dotnet publish "NemAnBlazor.csproj" -c Release -o /app/publish | |||||
| FROM base AS final | FROM base AS final | ||||
| WORKDIR /app | WORKDIR /app | ||||
| COPY --from=publish /app/publish . | COPY --from=publish /app/publish . | ||||
| ENTRYPOINT ["dotnet", "SpotifyService.dll"] | |||||
| COPY --from=publish /app/publish1 . | |||||
| ENTRYPOINT ["dotnet", "IdentityProvider.dll"] | |||||
| COPY --from=publish /app/publish2 . | |||||
| ENTRYPOINT ["dotnet", "NemAnBlazor.dll"] | |||||
| COPY --from=publish /app/publish3 . | |||||
| ENTRYPOINT ["dotnet", "SpotifyWorker.dll"] | |||||
| ENTRYPOINT ["dotnet", "NemAnBlazor.dll"] |
| #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. | |||||
| FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base | |||||
| WORKDIR /app | |||||
| EXPOSE 80 | |||||
| EXPOSE 443 | |||||
| FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | |||||
| WORKDIR /src | |||||
| COPY ["IdentityProvider.csproj", "IdentityProvider/"] | |||||
| COPY ["GrpcShared/GrpcShared.csproj", "GrpcShared/"] | |||||
| RUN dotnet restore "IdentityProvider/IdentityProvider.csproj" | |||||
| COPY . . | |||||
| WORKDIR "/src/IdentityProvider" | |||||
| RUN dotnet build "IdentityProvider.csproj" -c Release -o /app/build | |||||
| FROM build AS publish | |||||
| RUN dotnet publish "IdentityProvider.csproj" -c Release -o /app/publish | |||||
| FROM base AS final | |||||
| WORKDIR /app | |||||
| COPY --from=publish /app/publish . | |||||
| ENTRYPOINT ["dotnet", "IdentityProvider.dll"] |
| <Project Sdk="Microsoft.NET.Sdk.Web"> | <Project Sdk="Microsoft.NET.Sdk.Web"> | ||||
| <PropertyGroup> | |||||
| <TargetFramework>net6.0</TargetFramework> | |||||
| <Nullable>enable</Nullable> | |||||
| <ImplicitUsings>enable</ImplicitUsings> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup> | |||||
| <TargetFramework>net6.0</TargetFramework> | |||||
| <Nullable>enable</Nullable> | |||||
| <ImplicitUsings>enable</ImplicitUsings> | |||||
| <UserSecretsId>25fedcaf-21d8-4904-9c0a-8cb4c1428e50</UserSecretsId> | |||||
| <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> | |||||
| <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <PackageReference Include="Grpc.AspNetCore" Version="2.40.0" /> | |||||
| <PackageReference Include="Grpc.AspNetCore.Web" Version="2.47.0" /> | |||||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.8" /> | |||||
| <PackageReference Include="MongoDB.Driver" Version="2.17.1" /> | |||||
| <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||||
| <PackageReference Include="protobuf-net.Grpc" Version="1.0.171" /> | |||||
| <PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.152" /> | |||||
| <PackageReference Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.0.152" /> | |||||
| <PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" /> | |||||
| <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.22.0" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <PackageReference Include="Grpc.AspNetCore" Version="2.40.0" /> | |||||
| <PackageReference Include="Grpc.AspNetCore.Web" Version="2.47.0" /> | |||||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.8" /> | |||||
| <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" /> | |||||
| <PackageReference Include="MongoDB.Driver" Version="2.17.1" /> | |||||
| <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||||
| <PackageReference Include="protobuf-net.Grpc" Version="1.0.171" /> | |||||
| <PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.152" /> | |||||
| <PackageReference Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.0.152" /> | |||||
| <PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" /> | |||||
| <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.22.0" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\GrpcShared\GrpcShared.csproj" /> | |||||
| <ProjectReference Include="..\NemAnBlazor\NemAnBlazor.csproj" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\GrpcShared\GrpcShared.csproj" /> | |||||
| </ItemGroup> | |||||
| </Project> | </Project> |
| using ProtoBuf.Grpc.Server; | using ProtoBuf.Grpc.Server; | ||||
| using Microsoft.Extensions.Options; | using Microsoft.Extensions.Options; | ||||
| using GrpcShared.DTO.Auth; | using GrpcShared.DTO.Auth; | ||||
| using Blazored.LocalStorage; | |||||
| using IdentityProvider.Models; | using IdentityProvider.Models; | ||||
| using IdentityProvider.Services; | using IdentityProvider.Services; | ||||
| builder.Services.AddGrpc(); | builder.Services.AddGrpc(); | ||||
| builder.Services.AddCodeFirstGrpc(); | builder.Services.AddCodeFirstGrpc(); | ||||
| builder.Services.AddCodeFirstGrpcReflection(); | builder.Services.AddCodeFirstGrpcReflection(); | ||||
| builder.Services.AddBlazoredLocalStorage(); | |||||
| //call spotify api | //call spotify api | ||||
| builder.Services.AddHttpClient(); | builder.Services.AddHttpClient(); | ||||
| "profiles": { | "profiles": { | ||||
| "IIS Express": { | "IIS Express": { | ||||
| "commandName": "IISExpress", | "commandName": "IISExpress", | ||||
| "launchBrowser": false, | |||||
| "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", | |||||
| "environmentVariables": { | "environmentVariables": { | ||||
| "ASPNETCORE_ENVIRONMENT": "Development" | "ASPNETCORE_ENVIRONMENT": "Development" | ||||
| } | |||||
| }, | |||||
| "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" | |||||
| }, | }, | ||||
| "SpotifyService": { | "SpotifyService": { | ||||
| "commandName": "Project", | "commandName": "Project", | ||||
| "dotnetRunMessages": "true", | |||||
| "launchBrowser": false, | |||||
| "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", | |||||
| "applicationUrl": "https://localhost:5001;http://localhost:5000", | |||||
| "environmentVariables": { | "environmentVariables": { | ||||
| "ASPNETCORE_ENVIRONMENT": "Development" | "ASPNETCORE_ENVIRONMENT": "Development" | ||||
| } | |||||
| }, | |||||
| "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", | |||||
| "applicationUrl": "https://localhost:5001;http://localhost:5000", | |||||
| "dotnetRunMessages": "true" | |||||
| }, | |||||
| "Docker": { | |||||
| "commandName": "Docker", | |||||
| "launchBrowser": false, | |||||
| "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", | |||||
| "publishAllPorts": true, | |||||
| "useSSL": true | |||||
| } | } | ||||
| } | } | ||||
| } | } |
| FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base | |||||
| WORKDIR /app | |||||
| EXPOSE 80 | |||||
| EXPOSE 443 | |||||
| FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | |||||
| WORKDIR /src | |||||
| COPY ["NemAnBlazor/NemAnBlazor.csproj", "NemAnBlazor/"] | |||||
| COPY ["GrpcShared/GrpcShared.csproj", "GrpcShared/"] | |||||
| RUN dotnet restore "NemAnBlazor/NemAnBlazor.csproj" | |||||
| COPY . . | |||||
| WORKDIR "/src/NemAnBlazor" | |||||
| RUN dotnet build "NemAnBlazor.csproj" -c Release -o /app/build | |||||
| FROM build AS publish | |||||
| RUN dotnet publish "NemAnBlazor.csproj" -c Release -o /app/publish | |||||
| FROM base AS final | |||||
| WORKDIR /app | |||||
| COPY --from=publish /app/publish . | |||||
| ENTRYPOINT ["dotnet", "NemAnBlazor.dll"] |
| <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> | <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> | ||||
| <PropertyGroup> | |||||
| <TargetFramework>net6.0</TargetFramework> | |||||
| <Nullable>enable</Nullable> | |||||
| <ImplicitUsings>enable</ImplicitUsings> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup> | |||||
| <TargetFramework>net6.0</TargetFramework> | |||||
| <Nullable>enable</Nullable> | |||||
| <UserSecretsId>c9c56d57-3d6d-46c6-b5d4-2dee92b6c31d</UserSecretsId> | |||||
| <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> | |||||
| <ImplicitUsings>enable</ImplicitUsings> | |||||
| <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | |||||
| <Optimize>True</Optimize> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | |||||
| <Optimize>True</Optimize> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | |||||
| <Optimize>False</Optimize> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | |||||
| <Optimize>False</Optimize> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <PackageReference Include="Blazored.LocalStorage" Version="4.2.0" /> | |||||
| <PackageReference Include="Grpc.Net.Client" Version="2.47.0" /> | |||||
| <PackageReference Include="Grpc.Net.Client.Web" Version="2.47.0" /> | |||||
| <PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.8" /> | |||||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.7" /> | |||||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.7" PrivateAssets="all" /> | |||||
| <PackageReference Include="protobuf-net.Grpc" Version="1.0.171" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <PackageReference Include="Blazored.LocalStorage" Version="4.2.0" /> | |||||
| <PackageReference Include="Grpc.Net.Client" Version="2.47.0" /> | |||||
| <PackageReference Include="Grpc.Net.Client.Web" Version="2.47.0" /> | |||||
| <PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="6.0.8" /> | |||||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.7" /> | |||||
| <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" /> | |||||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.7" PrivateAssets="all" /> | |||||
| <PackageReference Include="protobuf-net.Grpc" Version="1.0.171" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\GrpcShared\GrpcShared.csproj" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\GrpcShared\GrpcShared.csproj" /> | |||||
| </ItemGroup> | |||||
| </Project> | </Project> |
| "environmentVariables": { | "environmentVariables": { | ||||
| "ASPNETCORE_ENVIRONMENT": "Development" | "ASPNETCORE_ENVIRONMENT": "Development" | ||||
| } | } | ||||
| }, | |||||
| "Docker": { | |||||
| "commandName": "Docker", | |||||
| "launchBrowser": true, | |||||
| "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", | |||||
| "publishAllPorts": true, | |||||
| "useSSL": true | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. | |||||
| FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base | |||||
| WORKDIR /app | |||||
| EXPOSE 80 | |||||
| EXPOSE 443 | |||||
| FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | |||||
| WORKDIR /src | |||||
| COPY ["SpotifyService/SpotifyService.csproj", "SpotifyService/"] | |||||
| COPY ["GrpcShared/GrpcShared.csproj", "GrpcShared/"] | |||||
| RUN dotnet restore "SpotifyService/SpotifyService.csproj" | |||||
| COPY . . | |||||
| WORKDIR "/src/SpotifyService" | |||||
| RUN dotnet build "SpotifyService.csproj" -c Release -o /app/build | |||||
| FROM build AS publish | |||||
| RUN dotnet publish "SpotifyService.csproj" -c Release -o /app/publish | |||||
| FROM base AS final | |||||
| WORKDIR /app | |||||
| COPY --from=publish /app/publish . | |||||
| ENTRYPOINT ["dotnet", "SpotifyService.dll"] |
| using Grpc.Core; | using Grpc.Core; | ||||
| using Grpc.Net.Client; | |||||
| using GrpcShared.DTO.Db; | using GrpcShared.DTO.Db; | ||||
| using GrpcShared.Interfaces; | using GrpcShared.Interfaces; | ||||
| using Microsoft.Net.Http.Headers; | using Microsoft.Net.Http.Headers; | ||||
| using NemAnBlazor.Services.Interfaces; | |||||
| using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
| namespace SpotifyService.HttpUtils | namespace SpotifyService.HttpUtils |
| using Microsoft.AspNetCore.Server.Kestrel.Core; | |||||
| using NemAnBlazor.Services.Interfaces; | |||||
| using NemAnBlazor.Services; | |||||
| using ProtoBuf.Grpc.Server; | using ProtoBuf.Grpc.Server; | ||||
| using SpotifyService.Services; | using SpotifyService.Services; | ||||
| using GrpcShared.Interfaces; | using GrpcShared.Interfaces; | ||||
| using Polly; | using Polly; | ||||
| using Polly.Extensions.Http; | using Polly.Extensions.Http; | ||||
| using GrpcShared.DTO.Auth; | using GrpcShared.DTO.Auth; | ||||
| using IdentityProvider.Services; | |||||
| var builder = WebApplication.CreateBuilder(args); | var builder = WebApplication.CreateBuilder(args); | ||||
| builder.Services.AddCodeFirstGrpcReflection(); | builder.Services.AddCodeFirstGrpcReflection(); | ||||
| builder.Services.Configure<CodeRequest>(builder.Configuration.GetSection("AuthParams")); | builder.Services.Configure<CodeRequest>(builder.Configuration.GetSection("AuthParams")); | ||||
| builder.Services.AddScoped<IIdentityService, IdentityService>(); | |||||
| builder.Services.AddScoped<IAuthService, AuthService>(); | builder.Services.AddScoped<IAuthService, AuthService>(); | ||||
| var app = builder.Build(); | var app = builder.Build(); | ||||
| app.MapGrpcService<AuthService>().EnableGrpcWeb(); | app.MapGrpcService<AuthService>().EnableGrpcWeb(); | ||||
| app.MapGrpcService<TrackService>().EnableGrpcWeb(); | app.MapGrpcService<TrackService>().EnableGrpcWeb(); | ||||
| app.MapGrpcService<StatsService>().EnableGrpcWeb(); | app.MapGrpcService<StatsService>().EnableGrpcWeb(); | ||||
| app.MapGrpcService<IdentityService>().EnableGrpcWeb(); | |||||
| app.MapCodeFirstGrpcReflectionService(); | app.MapCodeFirstGrpcReflectionService(); |
| { | |||||
| { | |||||
| "iisSettings": { | "iisSettings": { | ||||
| "windowsAuthentication": false, | "windowsAuthentication": false, | ||||
| "anonymousAuthentication": true, | "anonymousAuthentication": true, | ||||
| "IIS Express": { | "IIS Express": { | ||||
| "commandName": "IISExpress", | "commandName": "IISExpress", | ||||
| "launchBrowser": true, | "launchBrowser": true, | ||||
| "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", | |||||
| "environmentVariables": { | "environmentVariables": { | ||||
| "ASPNETCORE_ENVIRONMENT": "Development" | "ASPNETCORE_ENVIRONMENT": "Development" | ||||
| } | |||||
| }, | |||||
| "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" | |||||
| }, | }, | ||||
| "SpotifyService": { | "SpotifyService": { | ||||
| "commandName": "Project", | "commandName": "Project", | ||||
| "dotnetRunMessages": "true", | |||||
| "launchBrowser": true, | "launchBrowser": true, | ||||
| "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", | |||||
| "applicationUrl": "https://localhost:5001;http://localhost:5000", | |||||
| "environmentVariables": { | "environmentVariables": { | ||||
| "ASPNETCORE_ENVIRONMENT": "Development" | "ASPNETCORE_ENVIRONMENT": "Development" | ||||
| } | |||||
| }, | |||||
| "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", | |||||
| "applicationUrl": "https://localhost:5001;http://localhost:5000", | |||||
| "dotnetRunMessages": "true" | |||||
| }, | |||||
| "Docker": { | |||||
| "commandName": "Docker", | |||||
| "launchBrowser": false, | |||||
| "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", | |||||
| "publishAllPorts": true, | |||||
| "useSSL": true | |||||
| } | } | ||||
| } | } | ||||
| } | |||||
| } |
| //using IdentityProvider.Protos.AuthService; | //using IdentityProvider.Protos.AuthService; | ||||
| using Blazored.LocalStorage; | |||||
| using Grpc.Core; | using Grpc.Core; | ||||
| using Grpc.Net.Client; | using Grpc.Net.Client; | ||||
| using GrpcShared; | using GrpcShared; |
| | | ||||
| using Grpc.Net.Client; | |||||
| using GrpcShared.DTO; | using GrpcShared.DTO; | ||||
| using GrpcShared.DTO.TopItem; | using GrpcShared.DTO.TopItem; | ||||
| using GrpcShared.DTO.Track; | using GrpcShared.DTO.Track; | ||||
| using GrpcShared.Interfaces; | using GrpcShared.Interfaces; | ||||
| using Microsoft.Net.Http.Headers; | using Microsoft.Net.Http.Headers; | ||||
| using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
| using ProtoBuf.Grpc.Client; | |||||
| using SpotifyService.HttpUtils; | using SpotifyService.HttpUtils; | ||||
| namespace SpotifyService.Services | namespace SpotifyService.Services | ||||
| private readonly IHttpClientFactory _httpClientFactory; | private readonly IHttpClientFactory _httpClientFactory; | ||||
| private IIdentityService _identityService; | private IIdentityService _identityService; | ||||
| private IAuthService _authService; | private IAuthService _authService; | ||||
| public StatsService(IHttpClientFactory httpClientFactory, IIdentityService identityService, IAuthService authService) | |||||
| public StatsService(IHttpClientFactory httpClientFactory, IAuthService authService) | |||||
| { | { | ||||
| _httpClientFactory = httpClientFactory; | _httpClientFactory = httpClientFactory; | ||||
| _identityService = identityService; | |||||
| _identityService = GrpcChannel.ForAddress("http://127.0.0.1:5002/").CreateGrpcService<IIdentityService>(); | |||||
| _authService = authService; | _authService = authService; | ||||
| } | } | ||||
| using Google.Rpc; | using Google.Rpc; | ||||
| using Grpc.Core; | using Grpc.Core; | ||||
| using Grpc.Net.Client; | |||||
| using GrpcShared; | using GrpcShared; | ||||
| using GrpcShared.DTO; | using GrpcShared.DTO; | ||||
| using GrpcShared.DTO.Search; | using GrpcShared.DTO.Search; | ||||
| using GrpcShared.Interfaces; | using GrpcShared.Interfaces; | ||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.Net.Http.Headers; | using Microsoft.Net.Http.Headers; | ||||
| using NemAnBlazor.Services; | |||||
| using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
| using ProtoBuf.Grpc.Client; | |||||
| using System.Text; | using System.Text; | ||||
| using System.Text.Json; | using System.Text.Json; | ||||
| using System.Web; | using System.Web; | ||||
| private IIdentityService _identityService; | private IIdentityService _identityService; | ||||
| private IAuthService _authService; | private IAuthService _authService; | ||||
| public TrackService(IHttpClientFactory httpClientFactory, IIdentityService identityService, IAuthService authService) | |||||
| public TrackService(IHttpClientFactory httpClientFactory, IAuthService authService) | |||||
| { | { | ||||
| _httpClientFactory = httpClientFactory; | _httpClientFactory = httpClientFactory; | ||||
| _identityService = identityService; | |||||
| _identityService = GrpcChannel.ForAddress("http://127.0.0.1:5002/").CreateGrpcService<IIdentityService>(); | |||||
| _authService = authService; | _authService = authService; | ||||
| } | } | ||||
| public async Task<SearchResponse> ListSearchAsync(SearchRequest request) | public async Task<SearchResponse> ListSearchAsync(SearchRequest request) |
| <Project Sdk="Microsoft.NET.Sdk.Web"> | <Project Sdk="Microsoft.NET.Sdk.Web"> | ||||
| <PropertyGroup> | |||||
| <TargetFramework>net6.0</TargetFramework> | |||||
| <Nullable>enable</Nullable> | |||||
| <ImplicitUsings>enable</ImplicitUsings> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup> | |||||
| <TargetFramework>net6.0</TargetFramework> | |||||
| <Nullable>enable</Nullable> | |||||
| <ImplicitUsings>enable</ImplicitUsings> | |||||
| <UserSecretsId>c9c56d57-3d6d-46c6-b5d4-2dee92b6c31d</UserSecretsId> | |||||
| <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> | |||||
| <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <PackageReference Include="Google.Api.CommonProtos" Version="2.6.0" /> | |||||
| <PackageReference Include="Grpc.AspNetCore" Version="2.40.0" /> | |||||
| <PackageReference Include="Grpc.AspNetCore.Web" Version="2.47.0" /> | |||||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.8" /> | |||||
| <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.8" /> | |||||
| <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||||
| <PackageReference Include="Polly" Version="7.2.3" /> | |||||
| <PackageReference Include="protobuf-net.Grpc" Version="1.0.171" /> | |||||
| <PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.152" /> | |||||
| <PackageReference Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.0.152" /> | |||||
| <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <PackageReference Include="Google.Api.CommonProtos" Version="2.6.0" /> | |||||
| <PackageReference Include="Grpc.AspNetCore" Version="2.40.0" /> | |||||
| <PackageReference Include="Grpc.AspNetCore.Web" Version="2.47.0" /> | |||||
| <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.8" /> | |||||
| <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.8" /> | |||||
| <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" /> | |||||
| <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | |||||
| <PackageReference Include="Polly" Version="7.2.3" /> | |||||
| <PackageReference Include="protobuf-net.Grpc" Version="1.0.171" /> | |||||
| <PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.152" /> | |||||
| <PackageReference Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.0.152" /> | |||||
| <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\GrpcShared\GrpcShared.csproj" /> | |||||
| <ProjectReference Include="..\IdentityProvider\IdentityProvider.csproj" /> | |||||
| <ProjectReference Include="..\NemAnBlazor\NemAnBlazor.csproj" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\GrpcShared\GrpcShared.csproj" /> | |||||
| </ItemGroup> | |||||
| </Project> | </Project> |
| #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. | |||||
| FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base | |||||
| WORKDIR /app | |||||
| FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | |||||
| WORKDIR /src | |||||
| COPY ["SpotifyWorker/SpotifyWorker.csproj", "SpotifyWorker/"] | |||||
| COPY ["IdentityProvider/IdentityProvider.csproj", "IdentityProvider/"] | |||||
| COPY ["GrpcShared/GrpcShared.csproj", "GrpcShared/"] | |||||
| COPY ["SpotifyService/SpotifyService.csproj", "SpotifyService/"] | |||||
| RUN dotnet restore "SpotifyWorker/SpotifyWorker.csproj" | |||||
| COPY . . | |||||
| WORKDIR "/src/SpotifyWorker" | |||||
| RUN dotnet build "SpotifyWorker.csproj" -c Release -o /app/build | |||||
| FROM build AS publish | |||||
| RUN dotnet publish "SpotifyWorker.csproj" -c Release -o /app/publish | |||||
| FROM base AS final | |||||
| WORKDIR /app | |||||
| COPY --from=publish /app/publish . | |||||
| ENTRYPOINT ["dotnet", "SpotifyWorker.dll"] |
| using Grpc.Net.Client; | |||||
| using Grpc.Net.Client.Web; | |||||
| using GrpcShared.Interfaces; | |||||
| using SpotifyService.Services; | |||||
| using SpotifyWorker; | using SpotifyWorker; | ||||
| { | |||||
| { | |||||
| "profiles": { | "profiles": { | ||||
| "SpotifyWorker": { | "SpotifyWorker": { | ||||
| "commandName": "Project", | "commandName": "Project", | ||||
| "dotnetRunMessages": true, | |||||
| "environmentVariables": { | "environmentVariables": { | ||||
| "DOTNET_ENVIRONMENT": "Development" | "DOTNET_ENVIRONMENT": "Development" | ||||
| } | |||||
| }, | |||||
| "dotnetRunMessages": true | |||||
| }, | |||||
| "Docker": { | |||||
| "commandName": "Docker" | |||||
| } | } | ||||
| } | } | ||||
| } | |||||
| } |
| <Project Sdk="Microsoft.NET.Sdk.Worker"> | <Project Sdk="Microsoft.NET.Sdk.Worker"> | ||||
| <PropertyGroup> | |||||
| <TargetFramework>net6.0</TargetFramework> | |||||
| <Nullable>enable</Nullable> | |||||
| <ImplicitUsings>enable</ImplicitUsings> | |||||
| <UserSecretsId>dotnet-SpotifyWorker-32F09870-7D1D-49C3-A41E-BCD7B23F1454</UserSecretsId> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup> | |||||
| <TargetFramework>net6.0</TargetFramework> | |||||
| <Nullable>enable</Nullable> | |||||
| <ImplicitUsings>enable</ImplicitUsings> | |||||
| <UserSecretsId>dotnet-SpotifyWorker-32F09870-7D1D-49C3-A41E-BCD7B23F1454</UserSecretsId> | |||||
| <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> | |||||
| <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <PackageReference Include="Google.Protobuf" Version="3.21.5" /> | |||||
| <PackageReference Include="Grpc" Version="2.46.3" /> | |||||
| <PackageReference Include="Grpc.AspNetCore.Server" Version="2.48.0" /> | |||||
| <PackageReference Include="Grpc.Tools" Version="2.48.0"> | |||||
| <PrivateAssets>all</PrivateAssets> | |||||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | |||||
| </PackageReference> | |||||
| <PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" /> | |||||
| <PackageReference Include="protobuf-net.Grpc" Version="1.0.171" /> | |||||
| <PackageReference Include="System.Net.Http" Version="4.3.4" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <PackageReference Include="Google.Protobuf" Version="3.21.5" /> | |||||
| <PackageReference Include="Grpc" Version="2.46.3" /> | |||||
| <PackageReference Include="Grpc.AspNetCore.Server" Version="2.48.0" /> | |||||
| <PackageReference Include="Grpc.Net.Client" Version="2.48.0" /> | |||||
| <PackageReference Include="Grpc.Tools" Version="2.48.0"> | |||||
| <PrivateAssets>all</PrivateAssets> | |||||
| <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | |||||
| </PackageReference> | |||||
| <PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" /> | |||||
| <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" /> | |||||
| <PackageReference Include="protobuf-net.Grpc" Version="1.0.171" /> | |||||
| <PackageReference Include="System.Net.Http" Version="4.3.4" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\SpotifyService\SpotifyService.csproj" /> | |||||
| <ProjectReference Include="..\IdentityProvider\IdentityProvider.csproj" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\SpotifyService\SpotifyService.csproj" /> | |||||
| <ProjectReference Include="..\IdentityProvider\IdentityProvider.csproj" /> | |||||
| </ItemGroup> | |||||
| </Project> | </Project> |
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk"> | |||||
| <PropertyGroup Label="Globals"> | |||||
| <ProjectVersion>2.1</ProjectVersion> | |||||
| <DockerTargetOS>Linux</DockerTargetOS> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <None Include="docker-compose.override.yml"> | |||||
| <DependentUpon>docker-compose.yml</DependentUpon> | |||||
| </None> | |||||
| <None Include="docker-compose.yml" /> | |||||
| <None Include=".dockerignore" /> | |||||
| </ItemGroup> | |||||
| </Project> |
| version: '3.4' | |||||
| services: | |||||
| spotifyworker: | |||||
| image: ${DOCKER_REGISTRY-}spotifyworker | |||||
| build: | |||||
| context: . | |||||
| dockerfile: SpotifyWorker/Dockerfile | |||||
| web: | |||||
| image: ${DOCKER_REGISTRY-}nemanblazor | |||||
| build: | |||||
| context: . | |||||
| dockerfile: NemAnBlazor/Dockerfile | |||||
| spotifyservice: | |||||
| image: ${DOCKER_REGISTRY-}spotifyservice | |||||
| build: | |||||
| context: . | |||||
| dockerfile: SpotifyService/Dockerfile | |||||
| identityprovider: | |||||
| image: ${DOCKER_REGISTRY-}identityprovider | |||||
| build: | |||||
| context: . | |||||
| dockerfile: IdentityProvider/Dockerfile | |||||