melittleman / BlazorIdentityAdmin

A .NET 8 OpenID Connect provider & Identity administration dashboard based on the MudBlazor Server template with per-page interactivity and without Entity Framework.
1 stars 0 forks source link

RedisKit package not found & Initial setup #1

Open rwxzig opened 2 months ago

rwxzig commented 2 months ago

I was trying to run this project but it could not find the RedisKit package, however I resolved that by cloning the project and referencing it in the projects. Could you provide some more details on how to setup the application, as I am getting error on unable to connect to https server.

melittleman commented 1 month ago

Hi @rwxzig, thanks for checking out the project! As you can probably tell, this is very much a work in progress and I haven't been able to work on it over the last couple of months, but I am hoping to get back to it soon.

I need to add the RedisKit library to Nuget to make things much simpler, but in the meantime the package is hosted using GitHub (https://github.com/melittleman/RedisKit/pkgs/nuget/RedisKit) so if you'd like to use that instead of directly referencing it, you can create a GitHub PAT with the "read:packages" scope and then use the command: dotnet nuget add source https://nuget.pkg.github.com/melittleman/index.json --name melittleman --username YOUR_USERNAME --password YOUR_PAT --store-password-in-clear-text to be able to download and install packages from that repo.

Hope that helps! Let me know if you have any questions.

rwxzig commented 1 month ago

Thank you for your reply, I was wondering if you could provide some information about the first startup, on how to setup the application for initial startup, what are the prerequisites etc.

Even after adding your account as package provider, I still get this error:

RedisKit.RedisConnection: Information: Configuring Redis endpoints: Unspecified/localhost:6379 RedisKit.RedisConnection: Information: Attempting connection to Redis endpoints: Unspecified/localhost:6379

Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider: Error: An error occurred while reading the key ring.

System.InvalidOperationException: Redis multiplexer is not connected. We have lost connection to the server... at RedisKit.RedisConnection.get_Multiplexer() at RedisKit.RedisConnection.get_Db() at RedisKit.DependencyInjection.Extensions.RedisConnectionBuilderExtensions.<>c__DisplayClass0_1.b__1() at Microsoft.AspNetCore.DataProtection.StackExchangeRedis.RedisXmlRepository.GetAllElementsCore()+MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Microsoft.AspNetCore.DataProtection.StackExchangeRedis.RedisXmlRepository.GetAllElements() at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.GetAllKeys() at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow, Boolean forceRefresh) BlazorIdentityAdmin.Infrastructure.Hosted.RedisIndexCreationService: Information: RedisIndexCreationService is executing on startup. 'BlazorIdentityAdmin.Web.exe' (CoreCLR: clrhost): Loaded '..\BlazorIdentityAdmin\src\Web\bin\Debug\net8.0\NRedisStack.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

The exception is thrown on line 76 at RedisIndexCreationService.cs:

if (await _connection.Db.FT().CreateIndexAsync("idx:users", createParams, schema) is false)

melittleman commented 1 month ago

There are only a couple of dependencies required to get the project up and running (I will try to better document them in the main README this weekend).

The first is obviously Redis so I would recommend setting that up via Docker using the command: docker run -d -v redis:/data -p 6379:6379 --name redis redis/redis-stack-server:latest at which point this exception will go away.

The seconds is SendGrid for emails, so would recommend setting up a free Developer account (https://sendgrid.com) and then under Settings > Sender authentication > Single Sender Verification add the email address that you would like to send emails from. Once that is setup, you'll need to add 2 User Secrets as below:

I hope that this helps! Let me know how you get on.

rwxzig commented 1 month ago

Perfect, it looks very good to begin with. A couple of points if I may.

  1. How easy or difficult is to implement a traditional db, like sqlite, postgresql etc, with this architecture?
  2. SendGrid email service should not be stopper for development.

First is a question, and I understand that it is a design choice, but the second is more like a suggestion.

melittleman commented 1 month ago

Great to hear you got it up and working, and thanks for the feedback!

  1. It would be very simple to swap it out I'm sure as there are plenty of other identity administration applications out there already using different database technologies (https://github.com/Nfactor26/pixel-identity, https://github.com/OrchardCMS/OrchardCore) but I built this app to showcase how simple it can be to use something like Redis as there's no need for database schema / migrations etc. and it can double-up as a search engine for very fast querying.
  2. Agreed, and this is very simple to swap out with a 'Mock', 'Null' or any other IEmailSender implementation if needed. I wanted this application to be very opinionated just to showcase how the underlying identity scaffolding works in .NET 8 with the new Static Server Rendering, without being overwhelming to get started if there are too many technology decisions to make.

Hope that all makes sense!