markusrt / NRZMyk

The National Reference Center for Invasive Fungal Infections (NRZMyk) is the central contact point for diagnostics and management of invasive fungal infections.
https://www.nrz-myk.de
MIT License
0 stars 1 forks source link

NRZMyk

Build and code quality

GitHub

CodeQL Build and Publish Docker

Sonarcloud

Quality Gate Status Maintainability Rating Coverage Code Smells

Infrastructure setup

Database

First you need to create an empty database named, e.g. NRZMyk and then a corresponding user:

-- To be executed as admin on master database
CREATE LOGIN nrzmyk WITH password='******';

-- To be executed as admin on NRZMyk database
CREATE USER nrzmyk FROM LOGIN nrzmyk;
EXEC sp_addrolemember 'db_owner', 'nrzmyk';

After changing the connection string in appsettings.json it should be possible to apply entity framework migrations.

Development setup

Azure ADB2C

This app authenticates with Azure ADB2C. In order to run it locally you need to setup client and server apps according to this documentation:

https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant

Server App

Configure the following secrets for the server project:

cd NRZMyk.Server
dotnet user-secrets set "AzureAdB2C:Domain" "Your ADB2C domain"
dotnet user-secrets set "AzureAdB2C:ClientId" "Your server app client ID"
dotnet user-secrets set "AzureAdB2C:SignUpSignInPolicyId" "Your signin policy name"
dotnet user-secrets set "APPINSIGHTS:INSTRUMENTATIONKEY" "Your application insights key"
dotnet user-secrets set "Application:SendGridSenderEmail" "Address used to send messages to other users"
dotnet user-secrets set "Application:SendGridDynamicTemplateId" "Sendgrid dynamic template id"
dotnet user-secrets set "Application:AdministratorEmail" "Address of admin to receive registration requests"
dotnet user-secrets set "SendGrid:ApiKey" "Sendgrid API key"
dotnet user-secrets set "AzureAdB2C:ClientSecret" "Client secret for GraphAPI access"
dotnet user-secrets set "AzureAdB2C:B2cExtensionAppClientId" "B2C extensions app client id"

See also appsettings.json in server project.

Client App

Role support

Roles are currently supported by adding a custom attribute to the ADB2C users.

Flag based authentication on client side is still WIP.

Base tools to install

dotnet tool install --global dotnet-ef

Deployment setup

Make sure above mentioned secrets are also set correctly in your deployment environment. Usually this can be done via environment variables:

Development tasks

Entity framework migrations

List migrations in project NRZMyk.Services using

dotnet ef migrations --startup-project ../NRZMyk.Server/NRZMyk.Server.csproj list 

Add a new migration using

dotnet ef migrations --startup-project ../NRZMyk.Server/NRZMyk.Server.csproj add Entity_MigrationDetails 

Reference to third party licenses