Open sourced solution for Blazor Web Assembly ASP.NET Core hosted model and built with Radzen Components.
Hobby project related to a Veterinary Clinic System. Which is designed on a modular monolithic architecture consisting of the following applications:
Clinic Management, caring on Staffing (clients, clinics, patients, and doctors).
Scheduling, caring on Patient's appointments.
Public, handling appointment confirmations requested from Client's emails.
Identity, caring on authentication/authorization.
Pre-requisites before having the solution deployed:
For local development/testing purposes we need a certificate installed on each device where we'll have a secure communication between client and server. For this example, we're going to register public and internal services in the same certificate. Currently, there are two options to get achieve this:
Currently, at _docker/certs folder you will find a demo certificate ready to get it installed.
Import the Personal Information Exchange file:
.../VeterinaryClinic/_docker/certs/veterinaryclinic.pfx
where the requested password will be:
VeterinaryClinic123!
and then install the Security Certificate file:
.../VeterinaryClinic/_docker/certs/veterinaryclinic.crt
Using OpenSSL open-source cryptographic library, execute the following commands:
Create the Security Certificate (with password set as VeterinaryClinic123!):
openssl req -x509 -newkey rsa:4096 -keyout veterinaryclinic.key -out veterinaryclinic.crt -subj "/CN=vc.local" -addext "subjectAltName=DNS:localhost,DNS:vc.local,DNS:identity-api.vc.local,DNS:clinicmanagement-api.vc.local,DNS:clinicmanagement-blazor.vc.local,DNS:clinicmanagementnotifications-api.vc.local,DNS:scheduling-api.vc.local,DNS:scheduling-blazor.vc.local,DNS:schedulingnotifications-api.vc.local,DNS:schedulingemailsender-api.vc.local,DNS:emailservice-api.vc.local,DNS:public-web.vc.local,DNS:identity-api,DNS:clinicmanagement-api,DNS:clinicmanagement-blazor,DNS:clinicmanagementnotifications-api,DNS:scheduling-api,DNS:scheduling-blazor,DNS:schedulingnotifications-api,DNS:schedulingemailsender-api" -days=365
Export the Personal Information Exchange:
openssl pkcs12 -export -in veterinaryclinic.crt -inkey veterinaryclinic.key -out veterinaryclinic.pfx -name "Veterinary Clinic Development"
Then replace those files in /certs folder and import them:
.../VeterinaryClinic/_docker/certs
After getting the certificate ready you should re-open your browser (if it's already open).
The hosts file (also referred as etc/hosts) is a text file used by operating systems (Linux/Windows) to map IP addresses to domain names. These domain names will allow us to get them linked to our applications.
Hosts file path in Linux:
/etc/hosts
Hosts file path in Windows:
C:\Windows\System32\drivers\etc\hosts
Add the following lines into your hosts file at the end of the document:
127.0.0.1 vc.local
127.0.0.1 identity-api.vc.local
127.0.0.1 clinicmanagement-blazor.vc.local
127.0.0.1 scheduling-blazor.vc.local
127.0.0.1 public-web.vc.local
After getting the Hosts file configured. You must flush your DNS records by using your terminal to get changes be reflected immediately.
Using Linux:
sudo systemd-resolve --flush-caches
Using Windows:
ipconfig /flushdns
You will find Docker Compose files at the repository root folder which will represent profiles (options) to deploy and run the entire solution.
Those deployment profiles (Deployment options) are:
Just choose your poison, where the first one is the most toxic and the other two options are the less painful deployments.
The docker-compose.yml file which only deploys a basic infrastructure (RabbitMQ and SQL Server) lets you run each project and set it as preferred.
Open your terminal and set yourself at repository root folder to build the images:
docker compose build --no-cache
After the images were build proceed to create and start containers:
docker compose up -d
Then you will have RabbitMQ and SQL Server containers ready to use them.
...\Fnunez.VeterinaryClinic.Identity.Api> dotnet run --launch-profile=https
...\Fnunez.VeterinaryClinic.ClinicManagement.BlazorClient.Server> dotnet run --launch-profile=https
...\Fnunez.VeterinaryClinic.ClinicManagement.Api> dotnet run --launch-profile=https
...\Fnunez.VeterinaryClinic.ClinicManagementNotifications.Api> dotnet run --launch-profile=https
...\Fnunez.VeterinaryClinic.Scheduling.BlazorClient.Server> dotnet run --launch-profile=https
...\Fnunez.VeterinaryClinic.Scheduling.Api> dotnet run --launch-profile=https
...\Fnunez.VeterinaryClinic.SchedulingNotifications.Api> dotnet run --launch-profile=https
...\Fnunez.VeterinaryClinic.SchedulingEmailSender.Api> dotnet run --launch-profile=https
...\Fnunez.VeterinaryClinic.EmailService.Api> dotnet run --launch-profile=https
...\Fnunez.VeterinaryClinic.Public.Web> dotnet run --launch-profile=https
Stop and remove the containers:
docker compose down
The docker-compose.DockerDevelopment.yml file provides full deploy and gets ready to test the entire solution.
Open your terminal and set yourself at repository root folder to build the images:
docker compose -f docker-compose.DockerDevelopment.yml build --no-cache
After the images were build proceed to create and start containers:
docker compose -f docker-compose.DockerDevelopment.yml up -d
Once containers are created and started, test the access of the following links:
Stop and remove the containers:
docker compose -f docker-compose.DockerDevelopment.yml down
The docker-compose.DockerNginx.yml has the same deployment infrastructure as the second profile but contains a fancy deployment behind Nginx server as reverse proxy for those applications that need to be protected from the outside (Internet).
Open your terminal and set yourself at repository root folder to build the images:
docker compose -f docker-compose.DockerNginx.yml build --no-cache
After the images were build proceed to create and start containers:
docker compose -f docker-compose.DockerNginx.yml up -d
Once containers are created and started, test the access of the following links:
Stop and remove the containers:
docker compose -f docker-compose.DockerNginx.yml down
In every solution folder you can run the test cases. As an example:
...\VeterinaryClinic\ClinicManagement> dotnet test
Run specified tests for unit.
dotnet test --filter FullyQualifiedName~UnitTests
Run specified tests for integration. Keep in mind these tests are longests because perform operations against database.
dotnet test --filter FullyQualifiedName~IntegrationTests
If you liked this project, please give it a star. Thanks! (n_n)/ :star:
This project was inspired from: