Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cs-tudy/cstudy_backend

๐Ÿ“– ์ทจ์—… CS ๊ฑฑ์ •ํ•˜์ง€๋งˆ, CStudy
https://github.com/cs-tudy/cstudy_backend

java11 jpa querydsl spring-boot

Last synced: about 1 month ago
JSON representation

๐Ÿ“– ์ทจ์—… CS ๊ฑฑ์ •ํ•˜์ง€๋งˆ, CStudy

Awesome Lists containing this project

README

        

# ๐Ÿ“– ์ทจ์—… CS ๊ฑฑ์ •ํ•˜์ง€๋งˆ, CS;tudy

### ~~๐Ÿ“ข [๋ฐฐํฌ ์‚ฌ์ดํŠธ ๋ฐ”๋กœ๊ฐ€๊ธฐ - [ ๋ฐ”๋กœ๊ฐ€๊ธฐ ]](https://cstudying.site/)~~


| ``2023. 10`` ~ ``2023.12``
- ๋น„์šฉ ๋ฌธ์ œ๋กœ ``23. 12. 18``์ดํ›„๋กœ ๋น„ํ™œ์„ฑํ™”ํ•ฉ๋‹ˆ๋‹ค.

## โœจ ํ”„๋กœ์ ํŠธ ์†Œ๊ฐœ

### [ ํ”„๋กœ์ ํŠธ ๊ฐ„๋‹จ ์†Œ๊ฐœ ]

- ์ทจ์—…์— ์žˆ์–ด ํ•„์š”ํ•œ CS ์ง€์‹์„ ํ•™์Šตํ•  ์ˆ˜ ์žˆ๋Š” ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”Œ๋žซํผ ์ž…๋‹ˆ๋‹ค. ์นดํ…Œ๊ณ ๋ฆฌ ๋ณ„ ๋ฌธ์ œ๋ฅผ ํ†ตํ•ด ํ•„์š”ํ•œ ์ง€์‹์„ ๋น ๋ฅด๊ฒŒ ํ•™์Šตํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ํ‹€๋ฆฐ ๋ฌธ์ œ๋ฅผ ๋ชจ์•„์„œ ๋ถ€์กฑํ•œ ๋ถ€๋ถ„์„ ๋น ๋ฅด๊ฒŒ ์ธ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ
๊ฒฝ์Ÿ์„ ํ†ตํ•˜์—ฌ ์ง€๋ฃจํ•œ CS ํ•™์Šต์— ์žฌ๋ฏธ๋ฅผ ๋ถ€์—ฌํ•˜๋ฉฐ ์„ ์˜์˜ ๊ฒฝ์Ÿ์„ ํ†ตํ•ด ๋™๋ฃŒ์™€ ํ•จ๊ป˜ ์„ฑ์žฅ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.


### [ ํ”„๋กœ์ ํŠธ๋ฅผ ์ฒ˜์Œ ๊ธฐํš์„ ์ƒ๊ฐํ•œ ์ด์œ  ]

- ๊ตญ๋น„์ง€์›์—์„œ ํ”„๋กœ์ ํŠธ [IPMS](https://github.com/KMGeon/IPMS)๋ฅผ ๋งŒ๋“ค๊ณ  ์•„์‰ฌ์›€์„ ๊ฐ€์ง€๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋ชจ๋“  ํŒ€์›์ด ํฌํŠธํด๋ฆฌ์˜ค๋ฅผ ์œ„ํ•˜์—ฌ ๋งŒ๋“ค์—ˆ๊ธฐ ๋•Œ๋ฌธ์— ์‹ค์ œ ์„œ๋น„์Šค๋ฅผ ํ•˜๊ธฐ์— ์ ์ ˆํ•œ ๋„๋ฉ”์ธ์ด ์•„๋‹ˆ๋ผ๊ณ  ํŒ๋‹จํ•˜์—ฌ ์ƒˆ๋กœ์šด ์„œ๋น„์Šค๋ฅผ ๋งŒ๋“ค๊ฒ ๋‹ค๊ณ  ์ƒ๊ฐ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.
- ์ทจ์—…์„ ์ค€๋น„ํ•˜๋ฉด์„œ ํ•™๊ณผ์—์„œ ๋ฐฐ์šด CS ๊ณต๋ถ€๊ฐ€ ์žฌ๋ฏธ๋„ ์žˆ์ง€๋งŒ ๋‹จ์ˆœํžˆ Github์˜ ์ •๋ฆฌ, ๋™์˜์ƒ, ์ฑ…์„ ํ†ตํ•ด์„œ ํ•™์Šตํ•˜์—ฌ ์ง€๋ฃจํ•จ์„ ๋Š๋ผ๊ฒŒ ๋˜์—ˆ๊ณ , ์ด๋ฅผ ๊ฐœ์„ ํ•˜๊ณ ์ž ๋ฌธ์ œ๋ฅผ ํ’€์–ด ์žฌ๋ฏธ์žˆ๊ฒŒ ํ•™์Šตํ•˜๋Š” ์„œ๋น„์Šค๋ฅผ ๋งŒ๋“ค๊ณ ์ž ์ƒ๊ฐ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.


### [ ์ฒ˜์Œ๋งŒ๋‚œ ์‚ฌ๋žŒ๋“ค์„ ๋ฆฌ๋”ฉํ•˜์—ฌ ์„ฑ๊ณต์ ์œผ๋กœ ํ”„๋กœ์ ํŠธ๋ฅผ ์™„์„ฑํ•  ์ˆ˜ ์žˆ์—ˆ๋˜ ์ด์œ  ]

![img.png](image/1.png)

- ํ”„๋กœ์ ํŠธ๋ฅผ ํ•˜๋ฉด์„œ `ํ˜‘์—…`์„ ๊ฐ€์žฅ ์ค‘์š”ํ•˜๊ฒŒ ์ƒ๊ฐ์„ ํ•˜์˜€์Šต๋‹ˆ๋‹ค. `ํด๋ผ์ด์–ธํŠธ`์™€ `์„œ๋ฒ„`์˜ ์ดํ•ด๋„, ์ธ์ง€์˜ ์ฐจ์ด๊ฐ€ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์—ฌ ์ตœ๋Œ€ํ•œ ๊ฐ„๋‹จํ•˜๊ฒŒ ์„ค๋ช… ( ๊ธ€, ๊ทธ๋ฆผ์„ ํ†ตํ•˜์—ฌ )ํ•˜๊ณ , ์ด๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ธ์ •์ ์ธ ์ปค๋ฎค๋‹ˆ์ผ€์ด์…˜์„ ํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ๋…ธ๋ ฅํ•˜์˜€์Šต๋‹ˆ๋‹ค.


## ๐Ÿ‘จโ€๊ธฐ์ˆ  ์Šคํƒ

์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜







DB




์ธํ”„๋ผ






๋ฌธ์„œ / ํ˜‘์—…








## ๐ŸŽจ ERD Diagram

![img.png](image/2.png)


## ๐Ÿ–ฅ ๋ชจ๋‹ˆํ„ฐ๋ง

![img.png](image/3.png)
![img.png](image/4.png)

[ ํ˜„์žฌ ์„œ๋น„์Šค ์šด์˜ ๋ฌธ์ œ์  ]
- ์„œ๋ฒ„๋ฅผ ์šด์˜ํ•˜๋ฉด์„œ CPU 100%๊ฐ€ ๋˜์–ด์„œ ์‹œ์Šคํ…œ์˜ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒ.
- ์„œ๋ฒ„ ๋น„์šฉ์˜ ๋ฌธ์ œ๋กœ ์ธํ•˜์—ฌ ํ™•์žฅ์„ฑ์ด ๋ถ€์กฑํ•œ EC2์— DB ์„ค์น˜ํ•˜์—ฌ ์šด์˜.
- DB ์„œ๋ฒ„๊ฐ€ CPU 100%๊ฐ€ ๋˜๋ฉด ์„œ๋น„์Šค ์˜ค๋ฅ˜, ์ƒˆ๋ฒฝ 2์‹œ์— Redis Backup์„ ์ˆ˜ํ–‰ํ•˜์ง€ ๋ชปํ•˜๋Š” ๋ฌธ์ œ ๋ฐœ์ƒ

[ ํ˜„์žฌ ๋ฌธ์ œ ๊ฐœ์„  ]
- ํ˜„์žฌ๋Š” ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ๋ฉ”๋ชจ๋ฆฌ Swap, EC2 ๋ฒ„์ŠคํŠธ ํ˜„์ƒ์˜ Credit ๋ถ€์กฑ์„ ๋ง‰๊ธฐ ์œ„ํ•˜์—ฌ ์ธ์Šคํ„ด์Šค ์œ ํ˜• ๋ณ€๊ฒฝ, Stop & Start ๋ฐฉ์‹์œผ๋กœ ๋ฌธ์ œ ํ•ด๊ฒฐ
- Stop & Start ๋ฐฉ์‹์„ ์ˆ˜ํ–‰ํ•˜๋ฉด์„œ ๋ชจ๋‹ˆํ„ฐ๋ง์˜ ์ค‘์š”์„ฑ์ด ์ฆ๊ฐ€ํ•˜์—ฌ ์ด๋ฅผ ์ž๋™ํ™” ํ•˜๊ธฐ ์œ„ํ•˜์—ฌ `CloudWatch`, `Lambda`, `Slack`์„ ์ด์šฉํ•˜์—ฌ ์ž๋™ํ™” ๋ณ€๊ฒฝ

[ ๊ฐœ์„ ํ•ด์•ผ ๋˜๋Š” ๋ถ€๋ถ„ ]
- ์•Œ๋ฆผ์„ ํ†ตํ•˜์—ฌ ์ž๋™ํ™”๋ฅผ ํ•˜์—ฌ๋„ ํ˜„์žฌ Stop & Start ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์žฌ์‹œ์ž‘์„ ํ•ด์•ผ๋˜๋Š” ๋ฌธ์ œ
- ์ด๋ฅผ ๊ฐœ์…˜ํ•˜๊ธฐ ์œ„ํ•˜์—ฌ Lambda Trigger๋ฅผ ํ†ตํ•˜์—ฌ Stop & Start ๋ฐฉ์‹์˜ ๋ฌธ์ œ์ ์„ ๊ฐœ์„  ํ•„์š”
- Lambda๋ฅผ ํ†ตํ•˜์—ฌ Stop & Start์˜ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜์—ฌ๋„ ์žฌ์‹œ์ž‘ํ•˜๋Š” ๋™์•ˆ ์„œ๋น„์Šค๊ฐ€ ์ž ์‹œ ์‚ฌ์šฉํ•˜์ง€ ๋ชปํ•œ๋‹ค. ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ๋ถ„์‚ฐ ํ™˜๊ฒฝ์œผ๋กœ ๋ณ€๊ฒฝ์„ ํ•ด์•ผ๋œ๋‹ค.


## ๐ŸงTest Code

### Controller

- ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋Š” ๋‹จ์ˆœํžˆ ๋ฐ์ดํ„ฐ์˜ ์ •ํ•ฉ์„ฑ์„ ๊ฒ€์ฆํ•˜๋Š” ๋กœ์ง์ด ์•„๋‹ˆ๋ผ ๋‚ด ์ฝ”๋“œ๋ฅผ ์ฝ๋Š” ์ƒ๋Œ€๋ฐฉ์—๊ฒŒ ์„ค๋ช…ํ•˜๋Š” ์ฝ”๋“œ๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.
- ``Controller``์˜ ํ…Œ์ŠคํŠธ๋Š” Mock์„ ํ†ตํ•˜์—ฌ HTTP ์š”์ฒญ, ๊ฒ€์ฆ์—์„œ ์ฑ…์ž„, ์ฃผ์š” ๊ด€์‹ฌ์‚ฌ๋ฅผ ๋ถ„๋ฆฌํ•˜์—ฌ ``์š”์ฒญ,๊ฒ€์ฆ``์„ ๋ถ„๋ฆฌ๋ฅผ ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

![img.png](image/5.png)

### Service

``Service Layer Test``์˜ ๊ฒฝ์šฐ์— Test Double(Mocking)์„ ํ†ตํ•˜์—ฌ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰์„ ํ•˜์˜€์„ ๋•Œ Repository์˜ ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ ๋ณ€ํ™”๋ฅผ ํ•˜๋ฉด ์‹คํŒจ๋ฅผ ํ•œ๋‹ค.

- ๋‹จ์œ„ ํ…Œ์ŠคํŠธ์—์„œ Mocking์„ ํ•˜๋ฉด ์—ฐ๊ด€ ๊ด€๊ณ„์˜ ``์ธํ„ฐํŽ˜์ด์Šค์™€ ๊ฐ•ํ•˜๊ฒŒ ์˜์กด``ํ•˜์—ฌ ๋ฆฌํŽ™ํ† ๋ง์„ ์–ด๋ ต๊ธฐ ๋•Œ๋ฌธ์— Classic ๋ฐฉ์‹์„ ํ†ตํ•˜์—ฌ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰์„ ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
- ์ œ์–ดํ•  ์ˆ˜ ์—†๋Š” ์ฝ”๋“œ์ธ ๊ฒฝ์šฐ์—๋งŒ Test Double์„ ์‚ฌ์šฉ์„ ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
- ``LocalDateTime.now()``์˜ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ๋Š” ํ•ญ์ƒ ์ผ๊ด€์„ฑ์„ ๋ณด์žฅํ•˜๊ธฐ ํž˜๋“ค์–ด Service์— ๋ณ€์ˆ˜๋ฅผ ๋„˜๊ฒจ์ฃผ๋Š” ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝ

![img.png](image/6.png)


## ๐Ÿ“‹ API ๋ฌธ์„œ - [๋ฌธ์„œ ๋ณด๊ธฐ](https://documenter.getpostman.com/view/23650109/2s9YXk41jC)


## ๐Ÿ“•CStudy์˜ ์—ฌ์ •์˜ ๊ธฐ๋Šฅ์„ ์†Œ๊ฐœํ• ๊ฒŒ์š”.

![img.png](image/7.png)


## ๐Ÿ›๏ธ CI/CD ์•„ํ‚คํ…์ฒ˜ (๋ฐฐํฌ ์ž๋™ํ™”)

### 1. ๊ธฐ์กด์— Jenkins๋ฅผ ํ†ตํ•˜์—ฌ ๋ฐฐํฌ ์ž๋™ํ™”

![img.png](image/8.png)

๋ธ”๋กœ๊ทธ : [Jenkins Pipeline์„ ์ด์šฉํ•œ CI/CD + SSHAgent](https://pos04167.tistory.com/195)

- ์ฒ˜์Œ ๋ฐฐํฌ๋ฅผ ์„ ํƒํ•œ `ํŒŒ์ดํ”„๋ผ์ธ`์ž…๋‹ˆ๋‹ค. ์ด๋•Œ Jenkins๋ฅผ ์„ ํƒํ•œ ์ด์œ ๋Š” ์Šคํ„ฐ๋””๋ฅผ ํ†ตํ•˜์—ฌ Jenkins๋ฅผ ํ•™์Šตํ•œ ๊ฒฝํ—˜์ด ์žˆ์–ด ๋‹ค๋ฅธ 2๊ฐœ์˜ ๊ธฐ์ˆ ๋ณด๋‹ค ๋Ÿฌ๋‹์ปค๋ธŒ๊ฐ€ ๋‚ฎ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์—ฌ ์ ์šฉ์„ ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
- Jenkins๋ฅผ ํ†ตํ•˜์—ฌ ๋ฐฐํฌ์˜ ๋ฌธ์ œ์ ์€ ํŠธ๋ž˜ํ”ฝ์ด ์ฆ๊ฐ€๋ฅผ ํ•˜์˜€์„ ๋•Œ Auto Scailing์„ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์ถ”๊ฐ€์ ์ธ ์ž‘์—…์ด ํ•„์š”ํ•˜์—ฌ ์Šคํ”„๋ง ๋ถ€ํŠธ์™€ AWS๋กœ ํ˜ผ์ž ๊ตฌํ˜„ํ•˜๋Š” ์›น ์„œ๋น„์Šค์˜ ๋ฌด์ค‘๋‹จ ๋ฐฐํฌ๋กœ ๊ตฌ์กฐ๋ฅผ ๋ณ€๊ฒฝ์„
ํ–ˆ์Šต๋‹ˆ๋‹ค.

### 2. ํ˜„์žฌ ๋ฐฐํฌ์˜ ๊ตฌ์กฐ / ์„ ํƒํ•œ ์ด์œ  (Github Action ๋ฐฐํฌ ์ž๋™ํ™” ๋ณ€๊ฒฝ)

![img.png](image/9.png)

![img.png](image/infra.png)

๋ธ”๋กœ๊ทธ : [Github Actions CI + CodeDeploy๋กœ CI/CD ๊ตฌํ˜„ํ•˜๊ธฐ](https://velog.io/@geon_km/Github-Actions-CI-CodeDeploy%EB%A1%9C-CICD-%EA%B5%AC%ED%98%84%ED%95%98%EA%B8%B0-vum9u82d)

[ ํ˜„์žฌ ๋ฌธ์ œ ]

- SSE๋ฅผ ์ถ”๊ฐ€ํ•˜๋ฉด์„œ ๋ถ„์‚ฐ ํ™˜๊ฒฝ์— ๋Œ€ํ•œ ์ œ์•ฝ์‚ฌํ•ญ์ด ๋ฐœ์ƒ์„ ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
- ์ด๋Ÿฌํ•œ ๋ฌธ์ œ๋กœ WAS๋ฅผ 1๊ฐœ๋งŒ ์‚ฌ์šฉํ•˜๊ฒŒ ๋ณ€๊ฒฝ

[ ํ˜„์žฌ ์ ์šฉ ]

- Git๊ณผ ์—ฐ๋™์„ฑ์ด ์ข‹์€ Github Action์„ ํ†ตํ•œ ๋ฐฐํฌ ์ž๋™ํ™”๋กœ ๋ณ€๊ฒฝ์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.
- ๋ณ€๊ฒฝํ•œ ์ด์œ ๋Š” ๊ฐ€์žฅ ๊ฐ„๋‹จํ•˜๊ฒŒ ๋ฐฐํฌ ์ž๋™ํ™”๋ฅผ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ์—ˆ๊ณ , ์ œํ•œ๋œ Resource๋ฅผ ํ†ตํ•˜์—ฌ ์ตœ๋Œ€์˜ ํšจ์œจ๋กœ ๊ด€๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค. ( Action๋งŒ ์‚ฌ์šฉํ•˜์—ฌ ํŒŒ์ดํ”„๋ผ์ธ ํšจ์œจ์  ๊ด€๋ฆฌ, ๋ฐฐํฌ ์„ฑ๊ณต์‹œ ์•Œ๋žŒ์ด ๋‚˜์˜ค๋Š”
ChatOps๋ฅผ ํ†ตํ•ด ์„œ๋น„์Šค ์˜ค๋ฅ˜์— ๋น ๋ฅด๊ฒŒ ๋Œ€์‘์ด ๊ฐ€๋Šฅํ•˜๋‹ค. )

[ ๋ณ€๊ฒฝ์„ ์ƒ๊ฐํ•˜๋Š” ๋ถ€๋ถ„ ]

- ํ˜„์žฌ SSE์˜ ํ™•์žฅ์„ฑ์„ ์ƒ๊ฐํ•˜์—ฌ ๋ฉ”์„ธ์ง€(Kafka)๋ฅผ ์ ์šฉํ•˜์—ฌ AWS ๊ณ ๊ฐ€์šฉ์„ฑ ์•„ํ‚คํ…์ฒ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐฐํฌ๋ฅผ ๊ณ ๋ คํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.


## ๐Ÿฅƒ Wireframe

[๐Ÿ“ Figma ๋ฐ”๋กœ๊ฐ€๊ธฐ ](https://www.figma.com/file/67asFaSpQCu4s2CKAJqxac/Untitled?type=design&node-id=0-1&mode=design&t=DdRtY5ictOvnNkSn-0)

![image](https://github.com/CStudyTeam/CStudy-backend/assets/103854287/cf4eae6b-43b5-409d-9125-178e33b89473)