System Architecture - 3sam5oh/webtoon-search-service GitHub Wiki

System Architecture (Temp) (no HA, no load balancing)

image


0. System Architecture - Entire system

image

1. System Architecture - System traffic architecture

image

2. System Architecture - Data flow architecture

2-1. Entire data flow

image

2-2. Caching data flow (Spring ~ Caching ~ Opensearch)

image

3. System Architecture - Monitoring / Logging architecture

3-1. Monitoring

image

3-2. Logging

(์ถ”๊ฐ€ ์˜ˆ์ • - ์–ด๋Š ๋ถ€๋ถ„์—์„œ ๋กœ๊ทธ๋ฅผ ์ทจ๋“ํ• ๊ฑด์ง€ ๊ฒฐ์ • ํ•„์š”)

๋งจ ์œ„๋กœ โ†‘

4. System Architecture - CICD architecture

image

Purpose of use

<Public>
IGW : ์™ธ๋ถ€ ์ธํ„ฐ๋„ท๊ณผ VPC ์—ฐ๊ฒฐ 
NLB : ์ฐจํ›„ HA ๊ตฌ์„ฑ์„ ์ ์šฉํ•˜๊ธฐ ์œ„ํ•œ LB 
NGW : Private Subnet ์— ์žˆ๋Š” Grafana๋ฅผ ์™ธ๋ถ€์—์„œ ์ ‘์†ํ•˜๊ธฐ ์œ„ํ•œ ๊ฒŒ์ดํŠธ์›จ์ด
nginx : TLS ์ธ์ฆ์„œ ์ฒ˜๋ฆฌ, ์ฐจํ›„ HA ๊ตฌ์„ฑ์„ ์ ์šฉํ•˜๊ธฐ ์œ„ํ•œ ALB ์—ญํ•  ๋‹ด๋‹น
ArgoCD : Dockerhub์˜ ์ด๋ฏธ์ง€ ๋ณ€ํ™˜ ๊ฐ์ง€๋ฅผ ํ†ตํ•œ CD ์‹คํ–‰
<Private>
Frontend Server : Vue3 ๋ฅผ ์‚ฌ์šฉ, ์‚ฌ์šฉ์ž ํ™”๋ฉด์„ ์ œ๊ณตํ•˜๋Š” ์„œ๋ฒ„ 
App : Spring boot๋ฅผ ์‚ฌ์šฉ, ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์„ ์ œ๊ณตํ•˜๋Š” ์„œ๋ฒ„ 
Prometheus & Grafana : App์„œ๋ฒ„ ๋ฉ”ํŠธ๋ฆญ ๋ชจ๋‹ˆํ„ฐ๋ง & ํ™”๋ฉด ์ œ๊ณต
Logstash(or Fluentbit) : S3์— ์ €์žฅ๋œ ์‚ฌ์šฉ์ž ์•ก์„ธ์Šค ๋กœ๊ทธ ํŒŒ์ผ์„ ์ฝ์–ด์™€ Opensearch ์— ์ž…๋ ฅ 
EC2 : Redis์šฉ ์„œ๋ฒ„ 
Redis : ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ ํ–ฅ์ƒ์„ ์œ„ํ•œ ์บ์‹ฑ ๊ธฐ๋Šฅ ๋‹ด๋‹น DB 
RDS(MySQL) : ํšŒ์›์˜ ๋ฉ”ํƒ€ ๋ฐ์ดํ„ฐ๊ฐ€ ์ €์žฅ๋˜๋Š” ํ…Œ์ด๋ธ”๋งŒ ์กด์žฌํ•˜๋Š” DB
OpenSearch : ์•ก์„ธ์Šค ๋กœ๊ทธ ๋ถ„์„, ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ์„ ์ง€์›ํ•˜๋Š” ๊ฒ€์ƒ‰ ์—”์ง„
<VPC ์˜์—ญ์™ธ ์„œ๋น„์Šค>
S3 : ์‚ฌ์šฉ์ž ์•ก์„ธ์Šค ๋กœ๊ทธ ํŒŒ์ผ ๋ฐ ์—๋Ÿฌ ๋กœ๊ทธ ํŒŒ์ผ์ด ์ €์žฅ๋˜๋Š” ์ €์žฅ์†Œ
Ollama(๋˜๋Š” OpenAI) : AWS์ƒ์— ์˜ฌ๋ฆฌ๊ธฐ์—๋Š” ์ตœ์†Œ RAM ์š”๊ตฌ๋Ÿ‰์ด ๋งŽ์•„์„œ ๋กœ์ปฌ์—์„œ ์‹คํ–‰, ngrok๋“ฑ์„ ์‚ฌ์šฉํ•ด ์™ธ๋ถ€์—์„œ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋„๋ก ์„ค์ •
Github : ๊ฐœ๋ฐœ ์ฝ”๋“œ์˜ ๋ฒ„์ „ ๊ด€๋ฆฌ ๋ฐ ๋ฐฐํฌ
Github Action : ํ…Œ์ŠคํŠธ์ฝ”๋“œ ์ •์ƒ ๋™์ž‘ ํ™•์ธ ๋ฐ CI ์‹คํ–‰
Dockerhub : ์ƒ์„ฑ๋œ docker image ๋ฐฐํฌ  
<๋กœ๊ทธ ์˜ˆ์ƒ ํ๋ฆ„>
์‚ฌ์šฉ์ž์˜ ํŠน์ • ๋‹จ์–ด ๊ฒ€์ƒ‰ -> 
์กฐํšŒ ๋ฉ”์†Œ๋“œ์— Aspect ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž ์ •๋ณด ๋ฐ ๊ฒ€์ƒ‰ ์ •๋ณด๋ฅผ ๋กœ์ปฌ ํŒŒ์ผ์— ๋กœ๊น… -> 
์ผ์ • ๊ธฐ๊ฐ„(ํ˜„์žฌ ๋งค์ผ 00์‹œ 1ํšŒ ์˜ˆ์ƒ)์ด ๋  ๋•Œ๋งˆ๋‹ค Logstash(๋˜๋Š” fluentbit)๋ฅผ ํ†ตํ•ด Opensearch๋กœ ๋กœ๊ทธ ์ „์†ก -> 
์ผ์ • ๊ธฐ๊ฐ„(ํ˜„์žฌ ๋งค์ผ 00์‹œ 1ํšŒ ์˜ˆ์ƒ)์ด ๋  ๋•Œ๋งˆ๋‹ค S3 Glacier์— ์žฅ๊ธฐ ๋ณด๊ด€์šฉ ๋กœ๊ทธ ์ „์†ก  

A : ํ๋ฆ„์€ ๋กœ์ปฌ ํŒŒ์ผ -> fluentbit -> opensearch -> ์ดํ›„ ์ฒ˜๋ฆฌ(s3์ €์žฅ์ด ํ•„์š”ํ•˜๋‹ค๋ฉด ์ดํ›„์— ์ถ”๊ฐ€ํ•  ์ˆ˜ ๋„ ์žˆ์ง€๋งŒ ๋ณ„๋„์˜ ์„œ๋น„์Šค๋ฅผ ๋”ฐ๋กœ ๋งŒ๋“ค์–ด์•ผ ํ•˜๋‹ˆ ํ˜„์žฌ๋Š” ์ถ”์ฒœ ์•ˆํ•จ) 
A2 : ์•กํ‹ฐ๋ธŒ ๋กœ๊ทธ ์ข…๋ฅ˜๋Š” ์ ๋‹นํ•จ 
A3 : opensearch ๋กœ๊ทธ ์ €์žฅ ์ฃผ๊ธฐ๋Š” ํ•œ๋ฒˆ ์ƒ๊ฐํ•ด๋ณด๊ธฐ - ๋น„์šฉ ๋ฌธ์ œ๋กœ ์‹ค๋ฌด๋งŒํผ ์ž์ฃผ๋Š” ๋ชป ์˜ฌ๋ฆฌ๋”๋ผ๋„ ํ•˜๋ฃจ ํ•œ ๋ฒˆ์€ ๊ฒฐ๊ณผ ํ™•์ธ์ด ๋„ˆ๋ฌด ํž˜๋“ค ๊ฒƒ ๊ฐ™๋‹ค. ์ ๋‹นํ•œ ์ฃผ๊ธฐ๋ฅผ ์ฐพ์•„๋ณผ ๊ฒƒ (1์‹œ๊ฐ„?) 
mermaid-diagram-2024-07-11-190236
<Q>
1. nginx์˜ ์œ„์น˜๊ฐ€ ๋งž๋Š”์ง€?(Public์ธ์ง€ Private์ธ์ง€, LB ์ „/ํ›„)
-> A: Public์— ์œ„์น˜ํ•  ๋ช…ํ™•ํ•œ ์ด์œ ๊ฐ€ ์žˆ์œผ๋ฉด Public์— ์œ„์น˜ํ•ด๋„ ๋จ. ๊ทธ๊ฒŒ ์•„๋‹ˆ๋ผ๋ฉด Private๋กœ ๋„˜๊ธธ ๊ฒƒ. 
ํ˜„์žฌ ์•„ํ‚คํ…์ณ์—์„œ๋Š” ์™ธ๋ถ€๋กœ๋ถ€ํ„ฐ์˜ ํŠธ๋ž˜ํ”ฝ์„ NLB๊ฐ€ public์—์„œ ๋ฐ›์•„์ฃผ๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— nginx๊นŒ์ง€ public์— ์œ„์น˜ํ•  ํ•„์š”๋Š” ์—†์„ ๊ฒƒ ๊ฐ™์Œ 
โš ๏ธ **GitHub.com Fallback** โš ๏ธ