Skip to content

Basic asp.net core web api sample project including containerization with docker.

Notifications You must be signed in to change notification settings

OliverZott/velosaurus-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Velosaurus - Backend

  • Backend: ASP.Net Core
  • Frontend: React
  • Database: Postgres MongoDB
  • Repo & Pipelines: Github
  • Hosting: Heroku amd Azure
  • DevOps: Azure DevOps

Project Structure

Prerequisites

  • .NET 9 SDK
  • Postgres
  • Docker (if run containerized)
  • Seq (optional - Serilog Sink
  • PGAdmin (optional)

Run App

local

docker

Issues

  • Linux postgres port problems: check port usage sudo lsof -i :5434 and sudo kill -9 <PID>

    • adapt docker-compose.yml:
    velosaurusdb:
      ports:
        - "5434:5432"

Database (Postgres)

Postgres database updates (Migrations)

  • Add-Migration MigrationDescription
  • Update-Database

psql in docker container

  • docker exec -it velosaurus-db psql -U postgres

Postgres commands

psql -U postgres
\l 
\c <dbname>
\d
SELECT table_name, column_name, data_type FROM information_schema.columns WHERE table_name='Activities';
SELECT * from "Activities";

Setup project

  • Create Project and Solution ASP.NET Core Web API
  • CORS configuration Link
  • Serilog and Seq
    • ps script for checking and starting mongodb and seq service
  • Database driver and configuration (Secrets for Credentials)
    • Postgres MongoDB

Github Pipeline

  • File paths arerelative to the root of the repository (GitHub Actions workflows run in the context of your repository.)
  • Github Secret and env vars for connectionstring
  • main_velosaurus-api.yml adaption to substitute before deployment

Next steps

  • location properties: name, summit, mountain range, subgroup

    • e.g. Mutters, Saile, Stubai Alps, Kalkkögel
  • Environments Dev / Prod(Demo)

  • UnitTests

  • Github Pipeline cleanup and optimization

  • Patterns:

    • Unit Of Work ?
    • Repository Pattern ?
    • CQRS ? (Probably complete overkill)
  • DEPLOYMENT?

Remarks

Docker

  • Dockerfile / docker-compose.yml
  • docker build -t velo-image .
  • docker run --name velo-container -p 8000:80 velo-image
  • http://localhost:8000/swagger

Seq

  • Install seq and use Sink in appsettings.json
  • Using RequestID in search to find all request related stuff: RequestId = "0HMHQ499O1RPJ:0000001B"

MongoDB

Json Serializer

Resources

Docker:

MongoDB:

Deployment Links:

Serilog:

About

Basic asp.net core web api sample project including containerization with docker.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published