Clean Architecture: Patterns, Practices, and Principles | Matthew Renze | Pluralsight
-
Update Connection Strings:
Project Configuration File Configuration Key ClassifiedAds.Migrator appsettings.json ConnectionStrings:ClassifiedAds ClassifiedAds.BackgroundServices appsettings.json ConnectionStrings:ClassifiedAds ClassifiedAds.GRPC appsettings.json ConnectionStrings:ClassifiedAds ClassifiedAds.IdentityServer appsettings.json ConnectionStrings:ClassifiedAds ClassifiedAds.NotificationServer appsettings.json ClassifiedAds.WebAPI appsettings.json ConnectionStrings:ClassifiedAds ClassifiedAds.WebMVC appsettings.json ConnectionStrings:ClassifiedAds ClassifiedAds.GraphQL appsettings.json ConnectionStrings:ClassifiedAds ClassifiedAds.Ocelot appsettings.json -
Run Migration:
- Option 1: Using dotnet cli:
- Install dotnet-ef cli:
dotnet tool install --global dotnet-ef --version="3.1"
- Navigate to ClassifiedAds.Migrator and run these commands:
dotnet ef migrations add Init --context AdsDbContext -o Migrations/AdsDb dotnet ef migrations add Init --context ConfigurationDbContext -o Migrations/ConfigurationDb dotnet ef migrations add Init --context PersistedGrantDbContext -o Migrations/PersistedGrantDb dotnet ef database update --context AdsDbContext dotnet ef database update --context ConfigurationDbContext dotnet ef database update --context PersistedGrantDbContext
- Install dotnet-ef cli:
- Option 2: Using Package Manager Console:
- Set ClassifiedAds.Migrator as StartUp Project
- Open Package Manager Console, select ClassifiedAds.Migrator as Default Project
- Run these commands:
Add-Migration -Context AdsDbContext Init -OutputDir Migrations/AdsDb Add-Migration -Context ConfigurationDbContext Init -OutputDir Migrations/ConfigurationDb Add-Migration -Context PersistedGrantDbContext Init -OutputDir Migrations/PersistedGrantDb Update-Database -Context AdsDbContext Update-Database -Context ConfigurationDbContext Update-Database -Context PersistedGrantDbContext
- Option 1: Using dotnet cli:
-
Open ClassifiedAds.WebMVC/appsettings.json and jump to Storage section.
"Storage": { "Provider": "Local", },
-
Use Local Files:
"Storage": { "Provider": "Local", "Local": { "Path": "E:\\files" }, },
-
Use Azure Blob:
"Storage": { "Provider": "Azure", "Azure": { "ConnectionString": "xxx", "Container": "classifiedadds" }, },
-
Use Amazon S3:
"Storage": { "Provider": "Amazon", "Amazon": { "AccessKeyID": "xxx", "SecretAccessKey": "xxx", "BucketName": "classifiedadds", "RegionEndpoint": "ap-southeast-1" } },
-
Open ClassifiedAds.WebMVC/appsettings.json and jump to MessageBroker section.
"MessageBroker": { "Provider": "RabbitMQ", }
-
Use RabbitMQ
"MessageBroker": { "Provider": "RabbitMQ", "RabbitMQ": { "HostName": "localhost", "UserName": "guest", "Password": "guest", "ExchangeName": "amq.direct", "RoutingKey_FileUploaded": "classifiedadds_fileuploaded", "RoutingKey_FileDeleted": "classifiedadds_filedeleted", "QueueName_FileUploaded": "classifiedadds_fileuploaded", "QueueName_FileDeleted": "classifiedadds_filedeleted" }, }
-
Use Kafka:
"MessageBroker": { "Provider": "Kafka", "Kafka": { "BootstrapServers": "localhost:9092", "Topic_FileUploaded": "classifiedadds_fileuploaded", "Topic_FileDeleted": "classifiedadds_filedeleted" }, }
-
Use Azure Queue Storage:
"MessageBroker": { "Provider": "AzureQueue", "AzureQueue": { "ConnectionString": "xxx", "QueueName_FileUploaded": "classifiedadds-fileuploaded", "QueueName_FileDeleted": "classifiedadds-filedeleted" }, }
-
Use Azure Service Bus:
"MessageBroker": { "Provider": "AzureServiceBus", "AzureServiceBus": { "ConnectionString": "xxx", "QueueName_FileUploaded": "classifiedadds_fileuploaded", "QueueName_FileDeleted": "classifiedadds_filedeleted" } }
-
Web MVC Home Page: https://localhost:44364/
-
Navigate to Health Checks UI https://localhost:44364/healthchecks-ui#/healthchecks and make sure everything is green.
-
Login on Identity Server:
- Option 1: Use default created account:
- User Name: phong@gmail.com
- Password: v*7Un8b4rcN@<-RN
- Option 2: Register new account at https://localhost:44367/Account/Register
- Option 1: Use default created account:
-
Add Migrations if you haven't done on previous steps:
- Install dotnet-ef cli:
dotnet tool install --global dotnet-ef --version="3.1"
- Navigate to ClassifiedAds.Migrator and run these commands:
dotnet ef migrations add Init --context AdsDbContext -o Migrations/AdsDb dotnet ef migrations add Init --context ConfigurationDbContext -o Migrations/ConfigurationDb dotnet ef migrations add Init --context PersistedGrantDbContext -o Migrations/PersistedGrantDb
- Install dotnet-ef cli:
-
Navigate to ClassifiedAds.Projects and run:
docker-compose build docker-compose up
-
Open Web MVC Home Page at: http://host.docker.internal:9003
-
Navigate to Health Checks UI http://host.docker.internal:9003/healthchecks-ui#/healthchecks and make sure everything is green.
-
Login on Identity Server:
- Use default created account: phong@gmail.com / v*7Un8b4rcN@<-RN
- Register new account at http://host.docker.internal:9000/Account/Register
Project | Launch URL | Docker Container URL | Docker Container URL |
---|---|---|---|
BackgroundServices | https://localhost:44318 | http://localhost:9004 | http://host.docker.internal:9004 |
GRPC | https://localhost:5001 | https://localhost:9005 | https://host.docker.internal:9005 |
IdentityServer | https://localhost:44367 | http://localhost:9000 | http://host.docker.internal:9000 |
NotificationServer | https://localhost:44390 | http://localhost:9001 | http://host.docker.internal:9001 |
WebAPI | https://localhost:44312 | http://localhost:9002 | http://host.docker.internal:9002 |
WebMVC | https://localhost:44364 | http://localhost:9003 | http://host.docker.internal:9003 |
GraphQL | https://localhost:44392 | http://localhost:9006 | http://host.docker.internal:9006 |
Ocelot | https://localhost:44340 | http://localhost:9007 | http://host.docker.internal:9007 |