Skip to content

The Blazing Pizza Workshop updated with containerization, PostgreSQL, Redis, OAuth 2, and SMTP Mailing

License

Notifications You must be signed in to change notification settings

nakigoe/donate

 
 

Repository files navigation

ENGLISH | РУССКИЙ

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)

Project Structure

  • 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.

Additional manual configuration required before launch:

Blazor:

  • SMTP provider settings, in this project an app key for Gmail is required;
  • OAuth2 key settings for GitHub;

Redis Commander:

  • Add a Redis database as in docker-compose.yml, by default Redis Commander won't see it.

PgAdmin:

  • Add a Server, then a Postgres database as in docker-compose.yml, by default PgAdmin won't see the database.

Project Launch on Windows

  • 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 the dotnet run command.

Passwords

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.

Files where password transmission via environment variables needs to be reconfigured

  • SMTP Mail: /BlazingPizza/appsettings.json
  • OAuth2 provider settings, GitHub example provided, see its section: BlazingPizza/Program.cs

Free Customized GPT for Consultations

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.

дополнительной ручной конфигурации перед запуском требуют:

Blazor:

  • настройки SMTP-провайдера, в данном проекте требуется ключ приложения для Gmail (app-key);
  • настройки Oauth2 ключей для GitHub;

Redis Commander:

  • добавить базу данных Redis, как в docker-compose.yml, просто по дефолтным настройкам Redis Commander её не будет видно.

PgAdmin:

  • добавить Server, затем базу данных Postgres, как в docker-compose.yml, просто по дефолтным настройкам PgAdmin базы данных не будет видно.

Запуск проекта на Windows

  • Установить .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

Бесплатные кастомизированные GPT для консультаций

Put stars on GitHub and share!!!


Please cast an eye on my website:

© NAKIGOE.ORG

All rights reserved and no permissions are granted.

Please add stars to the repositories!

About

The Blazing Pizza Workshop updated with containerization, PostgreSQL, Redis, OAuth 2, and SMTP Mailing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 52.2%
  • C# 30.4%
  • CSS 14.5%
  • JavaScript 2.9%