joni7777 / netcore-seed Goto Github PK
View Code? Open in Web Editor NEW.NetCore project with swagger seed repo
.NetCore project with swagger seed repo
add default isolate logic to be overrided per service
Need to implement config service, that loads the configuration from the config dir and overwrite the configuration by environments
config\
with c# env development the configs will be read by the following order:
default.json -> development.json -> development.local.json
creating unioned configuration
Add some default error wrapping to follow bp errors default models
create bp-init dll to register the service on the endpointer, and init all the stuff that are required for each service
Add readme.md with all the info required for running the seed, forking it and creating new seed
By configuration auto add the contexts to the api runner
we just need to implement this interface ILogEventSink
maybe something like this:
public abstract class HttpSink : ILogEventSink
{
private readonly HttpClient _httpClient;
protected virtual HttpMethod HttpMethod { get; } = HttpMethod.Post;
protected HttpSink(HttpClient httpClient) => _httpClient = httpClient;
public void Emit(LogEvent logEvent)
{
var request = new HttpRequestMessage(HttpMethod, GenerateRequestUri(logEvent))
{
Content = GenerateRequestBody(logEvent)
};
_httpClient.SendAsync(request);
}
protected abstract string GenerateRequestUri(LogEvent logEvent);
protected abstract HttpContent GenerateRequestBody(LogEvent logEvent);
}
public class MattermostHttpSink : HttpSink
{
private readonly string _mattermostHookUrl;
public MattermostHttpSink(HttpClient httpClient, string mattermostHookUrl) : base(httpClient)
{
_mattermostHookUrl = mattermostHookUrl;
}
protected override HttpContent GenerateRequestBody(LogEvent logEvent)
{
logEvent.Properties.TryGetValue("swaggerOperationId", out var swaggerOperationId);
logEvent.Properties.TryGetValue("serviceName", out var serviceName);
var mattermostMessage = "...";
var builder = new StringBuilder();
builder.Append('{');
builder.Append("\"username\":\"").Append(serviceName).Append("\",");
builder.Append("\"text\":\"").Append(mattermostMessage).Append("\"");
builder.Append("\"");
builder.Append('}');
return new StringContent(builder.ToString(), Encoding.UTF8, "application/json");
}
protected override string GenerateRequestUri(LogEvent logEvent) => _mattermostHookUrl;
}
Create endpointer and swagger-client services to allow using other microservices by service name, and operation id on the service
Current idea for implementing the abillity to have swagger client for different services:
Creating nuget package named: Bp.Endpointer
the package reads the config for the endpointer url
have register method
Each service should be a nuget package compiled with AutoRest based on the swagger.json file, and after generating the SDK for javascript, typescript, C# - the output will be uploaded to nuget source and npm source so every service will be a package and the c# sdk will extension method of the nuget package Bp.Endpointer
for example
var loginResponse = await Bp.Endpointer.AuthService.Login("username", "password");
This issue requires creating package.json script for generating sdk and dotnet script as well
the script will also publish the current sdk files to the npm, nuget under as Bp.ServiceName with version from the service config and the branch name, and if the branch is mater it will uploaded without the branch name
also to add a git hook for each service that on push to the master to run the script
and like this, every service that wants to connect with another will install the Bp.Endpointer and the Bp.ServiceName
Add health-checks as dll to the service
After forking the seed, find a way to edit the sln name and dir name to the git repo name
Add main logger object, with prewritten handlers for:
Splunk
Mattermost
Add default logs for each request to measure it, for errors
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.