Beyond Blazing Pizza eShop: .NET 8, ASP.NET Core Blazor, Redis, Postgres, OAuth2, SMTP mailer (Gmail)
Based on https://github.com/csharpfritz/BlazingPizzaWorkshop
Official Microsoft tutorial videos available at: https://www.youtube.com/watch?v=sWTpxFcHbfY&list=PLdo4fOcmZ0oXv32dOd36UydQYLejKR61R&index=78
Added on top of the original project:
-
Redis, Postgres, OAuth2, SMTP mailer (Gmail), site containerization upon publishing.
-
For self-education purposes, dummy services have been added, which can be further developed or removed along with the corresponding three interfaces and project classes (client-server interaction):
builder.Services.AddScoped<IOrderService, OrderService>();
(program.cs server)builder.Services.AddScoped<IOrderService, HttpOrderService>();
(program.cs client)
docker-compose.yml
launches 4 containers: Redis, Redis Commander, Postgres, PgAdmin.- Blazor site on .NET 8 (full-stack, focused on the server side with integrated APIs, the client is part of the project). When publishing the site on a hosting using the
dotnet publish
command with the appropriate commands, the project is automatically packaged into a container with all dependencies, containerization settings via .NET SDK are in the file/BlazingPizza/BlazingPizza.csproj
.
- SMTP provider settings, in this project an app key for Gmail is required;
- OAuth2 key settings for GitHub;
- Add a Redis database as in
docker-compose.yml
, by default Redis Commander won't see it.
- Add a Server, then a Postgres database as in
docker-compose.yml
, by default PgAdmin won't see the database.
- Install .NET 8 SDK;
- Install and launch Podman Desktop to run the containers;
- Run
docker-compose up -d
from the root directory of the project; - Run the site from the
BlazingPizza
folder with thedotnet run
command.
Important! Secrets and passwords should not get into Git!!! Therefore, before using Git, replace all passwords with environment variables or load passwords from files not included in Git. In Visual Studio, right-click on the BlazingPizza
folder, select Manage User Secrets
.
- SMTP Mail:
/BlazingPizza/appsettings.json
- OAuth2 provider settings, GitHub example provided, see its section:
BlazingPizza/Program.cs
- ASP.NET Core Blazor
- God's C#
- God's Docker
- God's PostgreSQL
- God's JavaScript
- God's CSS
- God's HTML
- PowerShell Breaker
Add stars to the pepositories!!!
Нечто большее, чем онлайн-пиццерия: .NET 8, ASP.NET core Blazor, Redis, Postgres, Oauth2, SMTP mailer (Gmail)
Проект основан на https://github.com/csharpfritz/BlazingPizzaWorkshop
Официальные обучающие видео от Microsoft доступны: https://www.youtube.com/watch?v=sWTpxFcHbfY&list=PLdo4fOcmZ0oXv32dOd36UydQYLejKR61R&index=78
Что добавлено в исходный проект:
-
Redis, Postgres, Oauth2, SMTP mailer (Gmail), контейнеризация сайта при публикации.
-
В целях самообразования добавлены dummy-сервисы, которые можно или развивать далее, или удалить вместе с сответствующими тремя интерфейсами и классами проекта (взаимодействие клиент-сервер):
- builder.Services.AddScoped<IOrderService, OrderService>(); (program.cs сервер)
- builder.Services.AddScoped<IOrderService, HttpOrderService>(); (progrm.cs клиент)
- docker-compose.yml запускает 4 контейнера: Redis, Redis Commander, Postgres, PgAdmin.
- сайт Blazor на .NET 8 (фул-стек, упор на серверную часть с интегрированными API, клиент является частью проекта). При публикации сайта на хостинг командой
dotnet publish
с сответсвующими командами проект упаковывается в контейнер автоматически со всеми зависимостями, настройки контейнеризации средствами .NET SDK находятся в файле/BlazingPizza/BlazingPizza.csproj
.
- настройки SMTP-провайдера, в данном проекте требуется ключ приложения для Gmail (app-key);
- настройки Oauth2 ключей для GitHub;
- добавить базу данных Redis, как в docker-compose.yml, просто по дефолтным настройкам Redis Commander её не будет видно.
- добавить Server, затем базу данных Postgres, как в docker-compose.yml, просто по дефолтным настройкам PgAdmin базы данных не будет видно.
- Установить .NET 8 SDK;
- установить и запустить Podman Desktop для запуска контейнеров;
- запустить из командной строки из корневой директории проекта docker-compose.yml командой
docker-compose up -d
- запустить сайт из командной строки из папки
BlazingPizza
командойdotnet run
Важно! Секреты и пароли не должны попадать в Git!!! Поэтому перед использованием Git замените все пароли на переменные окружения или загружайте пароли из файлов, не входящих в Git. При разработке в Visual Studio правый щелчок мыши на папке BlazingPizza
, опция Manage User Secrets
.
- Почта SMTP:
/BlazingPizza/appsettings.json
- Настройки провайдеров Oauth2, для демонстрации приведён GitHub, смотрите его раздел:
BlazingPizza/Program.cs
- ASP.NET Core Blazor
- God's C#
- God's Docker
- God's PostgreSQL
- God's JavaScript
- God's CSS
- God's HTML
- PowerShell Breaker
Please cast an eye on my website:
© NAKIGOE.ORG
All rights reserved and no permissions are granted.
Please add stars to the repositories!