SagiK-Repository / Learn_CleanArchitecture

Learn CleanArchitecture
0 stars 0 forks source link

Image Loader Service 구성 #35

Open SAgiKPJH opened 5 days ago

SAgiKPJH commented 5 days ago

진행 과정

기초

서비스 구성

서비스 구현

모니터링 구현

SAgiKPJH commented 5 days ago

docker 기반 hellow world 서비스 구성

SAgiKPJH commented 5 days ago

docker 기반 di 서비스 구성

var build = new ConfigurationBuilder();

build.SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json", optional: true) .AddEnvironmentVariables();

var host = Host.CreateDefaultBuilder() .ConfigureServices((context, services) => { services.AddTransient<IPrint, PrintConsole>(); }) .Build();

var printService = host.Services.GetRequiredService(); printService.Print("Hello World!");

```cs
public interface IPrint
{
    public void Print(string message);
}

public class PrintConsole : IPrint
{
    public void Print(string message) =>
        Console.WriteLine(message);
}

image

SAgiKPJH commented 5 days ago

docker 기반 grpc 서비스 구성

namespace DockerGrpcServer.Services;

public class HelloService : Hello.HelloBase { public HelloService() { }

public override async Task<HelloReply> Hello(HelloRequest request, ServerCallContext context)
{
    await Task.CompletedTask;
    return new HelloReply() { Reply = "Hello World!" };
}

}

```cs
using DockerGrpcServer.Services;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddGrpc();

var app = builder.Build();

// Configure the HTTP request pipeline.
app.MapGrpcService<HelloService>();
app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");

app.Run();

image

SAgiKPJH commented 4 days ago

docker 기반 grpc 서비스 2개간 통신 구성