Skip to content

A playground for building minimal grpc endpoints using featherhttp

License

Notifications You must be signed in to change notification settings

clarkezone/featherservicetest

Repository files navigation

featherservicetest

A playground for building minimal grpc service endpoints in donetcore using featherhttp.

.NET Coverage Status

Backlog Phase 1

Theme: Hello world for frontend, Infra

  • Get basic working gRPC endpoint running using featherhttp

  • Simple unit test

  • Dockerize

  • Set up basic CI/CD pipeline using github actions

  • Enforce PR workflow gated by tests

  • Add git versioning https://github.com/dotnet/Nerdbank.GitVersioning

  • Dotnetcore cli client

  • Bicep for creating ACR infra

  • Local docker build works using selfsigned cert with test client

  • Release branch push prod container to ACR

  • Figure out ACR login via docker

  • Fix client-side logging

  • Investigate adding code coverage metrics

  • Add basic editor config

  • Add service-side logging using Grfana Loki

  • Support plain-text gRPC

  • Add self-signed cert support when hosted on Linux

  • Script / action to deploy to k3s cluster

  • Script / action to deploy to ACI

  • Helm chart to deploy to K8s

  • More infra goodness from https://github.com/martincostello/dotnet-minimal-api-integration-testing

  • Add basic Prometheus metric publishing

  • Add basic health probe

  • Replace greeter with bi-directional simple streaming ping/pong gRPC with multiple clients

Backlog Phase 2

Theme: Hello microservice

  • Add production SSL cert with Azure keyvault
  • Add a backend microsevice (eg a simple in-memory queue)
  • Add Open Telemetry / Grafana Tempo / Jaeger distributed tracing
  • Add Project Tye
  • Add OSM support
  • Add DAPR support
  • Golang client ? Authentication for front end gRPC

Backlog Phase 3

Theme: Moah backend service integration

Dev setup

Pre-requs

  • VSCode
  • Docker
  • dotnet 5 RTM

Steps

  1. Build docker image:
    • cd src\BasicService
    • docker build -t feathertestservice:0 .
  2. Create self-signed cert (Taken from https://docs.microsoft.com/en-us/dotnet/core/additional-tools/self-signed-certificates-guide)
    • powershell .\localdev\createsscert.ps1
    • Start certmgr
    • Confirm that contoso.com is listed in Trusted Root Certificate Authorities\Certificates
  3. Add an entry for contoso.com in hosts file
    • code C:\Windows\System32\drivers\etc\hosts
    • add hosts entry 127.0.0.1 contoso.com
  4. Run docker image:
    • docker run --rm -it -p 3000:3000 -p 3001:3001 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORT=3001 -e ASPNETCORE_ENVIRONMENT=Development -e ASPNETCORE_Kestrel__Certificates__Default__Password="password" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/contoso.com.pfx -e Logging__LogLevel__Microsoft=Debug -e Logging__LogLevel__Grpc=Debug -v /c/certs:/https/ feathertestservice:0
  5. Run client
    • cd src\BasicClient
    • dotnet run

Running locally with plan text

  1. pull the image
  2. docker run --rm -it -p=5000:80 -e ASPNETCORE_URLS="http://+" -e ASPNETCORE_HTTP_PORT=5000 clarkezonecontainerregistry2.azurecr.io/fstrefs/pull/15/merge:2b876cf

Running locally

  1. pull the image
  2. follow instructions to create private cert as above
  3. create a docker-compose.yml file with contents:
    services:
        BasicService:
            image: feathertestservice:0
            ports:
            - "3001:3001"
            environment:
            - ASPNETCORE_URLS=https://+;http://+
            - ASPNETCORE_HTTPS_PORT=3001
            - ASPNETCORE_ENVIRONMENT=Production
            - ASPNETCORE_Kestrel__Certificates__Default__Password=password
            - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/contoso.com.pfx
            - Logging__LogLevel__Microsoft=Debug
            - Logging__LogLevel__Grpc=Debug
            - basicservice_logendpoint=http://loki:3100 #loki prefix is important
            volumes:
            - /c/certs:/https/
            networks:
            - loki
    
        loki:
            image: grafana/loki:master
            ports:
            - "3100:3100"
            command: -config.file=/etc/loki/local-config.yaml
            networks:
            - loki
    
        grafana:
            image: grafana/grafana:master
            ports:
            - "3000:3000"
            networks:
            - loki
    
    networks:
        loki:
    
    
    
  4. docker compose up
  5. Navigate to localhost:3000
  6. Go to configuration -> Datasources
  7. Add a loki datasource pointing to http://loki:3100
  8. Go to explore and enter the following query: {Application="BasicService"}