Coder Social home page Coder Social logo

spring-cloud-playground's Introduction

안녕하세요 👋

spring-cloud-playground's People

Contributors

jihwan2da avatar

Watchers

 avatar

spring-cloud-playground's Issues

MSA를 Docker 환경에 배포

내용

MSA를 Docker Container에 배포한다.

목적

도메인 마이크로 서비스는 포트포워딩을 하지 않고 배포하고(내부망 처럼 보이도록), API Gateway 서비스만 포트포워딩을 진행 시켜(외부와 통신이 가능) 실제 운영 MSA 배포 환경 처럼 보이도록 한다.

  • docker 이외의 infra 환경 필요 X

확장

현재는 Discovery와 API Gateway를 활용한 라우팅 및 로드밸런서 기능 뿐이지만, MSA간의 통신(단순 통신 , Kafka활용), 장애처리와 분산 추적, MSA 모니터링 까지 확장할 예정

API Gateway에서 인증에 대한 고찰...

개요

Token 방식으로 인증 인가를 처리하려고 하는데, 그 처리를 모든 MicroService가 자체적으로 하기에는 각자 다른 DB를 사용할 예정이라 한계가 있고, 공통된 코드가 많이 발생해 비효율적임. 그래서 API Gateway에서 인증/인가를 공통적으로 처리를 하고 라우팅을 할 생각인데 API Gateway에서 이를 처리하기 위한 방법으로 크게 두가지가 존재함.

API Gateway에서의 인증 인가 처리..

방법1
인증이 필요한 요청을 API Gateway -> 인증 서비스(유저 서비스)로 인증 요청 및 응답 처리 -> 해당 요청에 알맞는 마이크로서비스 로 처리하는 방법이다. 해당 방법을 활용하면 역할 및 책임이 확실하게 나누어져(API Gateway는 요청 라우팅 및 로드밸런서 역할, 인증서비스는 인증 역할) API Gateway와 인증 서비스 각각 역할에 맞는 알맞는 기술과 그 책임을 강화할 수 있게 된다. 하지만 두번의 네트워크 통신을 거쳐야하고, 인증서비스의 부하가 올 수 있다고 생각한다.

방법2
API Gateway에서 직접 인증, 인가 처리를 하는 방법이다. 따라서 인증이 필요한 요청은 앞의 방법과 다르게 API Gateway -> 해당 요청에 알맞는 마이크로서비스가 된다. API Gateway에 과도한 책임이 주어지는 단점이 있지만, 네트워크를 한번만 타게 되고, 인증 서비스를 두어도 되지 않아도된다. (리소스가 적다)

결정

해당 개인 레포는 특별한 보안 없이 단순히 jwt Token의 유효성만 검사하면 되기 때문에 API Gateway에서 직접 인증/인가 처리를 하도록 할 예정이다. (인증 서비스를 굳이 따로 둬서 개발 리소르를 늘릴 필요가 없다고 생각함)

방법

  • 토큰에 대한 검증을 하기 위해서는 DB 접근이 필요한데 API Gateway는 Spring Cloud Gateway(Webflux기반)를 활용하기 때문에 Reactive DB Driver가 필요하다. 이를 위해서 User에 대한 DB는 MongoDB를 활용할 것이다. ( 문서 많음, 자체 Reactive Driver 제공)

API Gateway

API Gateway

  • Nginx
  • Netflix Zuul
  • Spring cloud gateway

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.