Sergey Karmanov 46295b1884
All checks were successful
Lint / Run linters (push) Successful in 39s
Build and deploy / Publish image (push) Successful in 1m45s
Build and deploy / Deploy image (push) Successful in 10s
Allow swagger on Production
2024-06-21 12:26:46 +03:00

Backend

Технологии:

  • ASP.NET
  • Aspire
  • PostgreSQL
  • Docker + Compose
  • Nginx
  • Github CI/CD

ApiService

Docker

docker run -d -p 8080:8080 \
--name Backend \
--restart=always \
-e DATABASE='Host=192.168.111.0;Port=5432;Database=prod;Username=prod;Password=' \
-e TZ=Europe/Moscow \
git.zetcraft.ru/hackathonpreparing/backend:main

Docker compose

version: '3.3'
services:
    backend:
        ports:
            - 8080:8080
        container_name: Backend
        restart: always
        environment:
            - DATABASE=Host=192.168.111.0;Port=5432;Database=prod;Username=prod;Password=
            - TZ=Europe/Moscow
        image: git.zetcraft.ru/hackathonpreparing/backend:main

Строка подключения в appsettings.json: username:postgres password:postgres host:localhost port:5432 database:prod

Если нет миграций в проекте то в папке HackathonPreparing.ApiService нужно писать:

dotnet ef migrations add UserContextMigration --context UserContext dotnet ef database update --context UserContext

dotnet ef migrations add WeatherForecastContextMigration --context WeatherForecastContext dotnet ef database update --context WeatherForecastContext

И так для каждого DbContext в проекте

Если в папке HackathonPreparing.ApiService есть папка Migrations и там есть миграции то можно просто сделать запрос post: /api/db/migrate. Все запросы к маршрутам /api/db/... доступны только в dev моде

/api/swagger - путь к свагеру

из свагера в dev моде можно запустить миграции в /api/db/migrate

Description
No description provided
Readme 336 KiB
Languages
C# 80.4%
CSS 10.3%
HTML 7.9%
Dockerfile 1.4%