Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 20 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ env:
AWS_CODE_DEPLOY_GROUP_RELEASE: imdang-release-deploy

jobs:
# develop 브랜치
deploy-develop:
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,10 +58,26 @@ jobs:
- name: Build and Test
run: ./gradlew imdang-container:clean imdang-container:assemble

- name: Build Batch Module
run: ./gradlew batch:clean batch:assemble

# 빌드 파일을 zip 형식으로 압축 - S3에서는 jar 저장이 안되기 때문에 zip으로 생성
# - name: Make zip file
# run: zip -r ./$GITHUB_SHA.zip .
# shell: bash

# backend(root)/
# -- imdang-container/
# ---- build/libs/imdang-container.jar
# -- batch/
# ---- build/libs/batch.jar
# -- build.gradle
# -- .github/workflows/main.yml
- name: Make zip file
run: zip -r ./$GITHUB_SHA.zip .
shell: bash
run: |
mkdir deploy
cp imdang-container/build/libs/*.jar deploy/
cp batch/build/libs/*.jar

# AWS 권한
- name: AWS credential 설정
Expand All @@ -78,6 +95,7 @@ jobs:
- name: EC2에 배포
run: aws deploy create-deployment --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name ${{ env.AWS_CODE_DEPLOY_GROUP }} --s3-location bucket=$AWS_S3_BUCKET,key=$GITHUB_SHA.zip,bundleType=zip

# release 브랜치
deploy-release:
if: github.ref == 'refs/heads/release'
runs-on: ubuntu-latest
Expand Down
97 changes: 80 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,80 @@
# Backend
- Java, Spring Boot, MySQL, JPA

### 규칙
- 커밋 컨벤션
- 깃 브랜치 전략
- 코드 컨벤션
- 서버 아키텍처

### 기술 문서
- CI/CD 파이프라인 구축
- ERD
- 시스템 아키텍처

### 개선 필요
- 자주 조회되는 인사이트에 대해 캐싱 적용
- 알림(notification) 조회 시 is_checked를 true로 변경할 때 일괄 바꾸는 것이 성능 측면에서 더 좋을 것이다. 헥사고날 아키텍처에서 어떻게 효과적으로 구현할 수 있을까?
# 아파트임당(Imdang)

## 1. 프로젝트 개요 (Overview)
- 임장 후기 공유 플랫폼
[Link]

### # 주요 기능
- 인사이트 등록/수정
- 인사이트 교환(교환 요청/수락/거절)

## 2. 시스템 아키텍처 (System Architecture)
### # 개요
- Hexagonal Architecture 기반 설계 (참고: https://github.com/agelenler/food-ordering-system)
- 레이어 모듈화
```text
|-- insight-application-service
|-- insight-application-messaging
|-- insight-domain
|- infra
```
- Inbound Adapter (외부 → 시스템)
- Application Layer
- API 요청이 들어오는 레이어
- `@RestController`
- Messaging Layer
- 메시지 브로커나 이벤트 시스템과의 연동
- `@KafkaListener`
- `@EventListener`
- `@Scheduled`
- Application Service : usecase 수행
- Domain Application Layer
- Application Service Layer : Use Case 정의, 도메인 로직 호출
- Domain Core Layer : 도메인 로직을 담당
- Outbound Adapter (시스템 → 외부)
- Persistence Layer : 외부 데이터베이스 등과 통신 (Output)
- `FeignClient`
- `RestTemplate`
- `KafkaTemplate`
- `JpaRepository`
- dependency : Application/Persistence → Domain Application → Domain Core
- 역참조 방지
- 주요 기술 스택
- Backend: Spring Boot, Java 17, JPA, ~~Kafka, Redis,~~ Spring Batch
- Database: MySQL
- CI/CD: Github Actions, ~~Docker~~
- Frontend: AOS, IOS
- Infrastructure: AWS(EC2, RDS, S3, CodeDeploy)
- ~~Load Test: Locust~~
- 오픈 소스 부하 테스트 도구
- 사용자가 Python으로 시나리오를 작성하여 웹 애플리케이션의 성능을 측정
- ~~Monitoring~~

## 3. 모듈 구조 및 도메인 모델링
### # backend(rootProject)

### # insight-service
- 인사이트 관련 서비스
- `Insight`
### # member-service
- `Member`
### # setting-service
- 알림 관련 서비스
- `Notification`
### ~~# admin-service~~
### # common
- 각 모듈에서 공통적으로 사용하는 클래스 모음
### # batch
### # infrastructure

## 4. 데이터베이스 설계 (Database Design, ERD)

## 5. 기능 정의 (Feature Specification)

## 6. CI/CD
- 빌드, 서버 배포 자동화
- `.github/workflows/main.yml`
- `develop` 혹은 `release` 브랜치에 코드 push
- 프로젝트 빌드
- AWS S3에 zip으로 업로드
- AWS CodeDeploy를 통해 EC2에 배포
48 changes: 48 additions & 0 deletions TEST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 성능 테스트

### 성능 지표
#### 1. 처리량(Throughput)
- 시스템 측면의 성능을 평가하는 KPI

##### # TPS(Transactions per Seconds)
- 단위 시간당 대상 시스템에서 처리되고 있는 요청 건수
- 초당 발생하는 Business Transaction

#### 2. 응답시간(Response Time)
- 사용자 측면에서의 성능을 평가하는 KPI
- 사용자가 해당 업무를 요청한 시점부터 서버로부터 그 결과에 대한 응답을 받아서 사용자 화면에 디스플레이할 때까지 소요된 총 시간
```text
Response Time = Client Time + Network Time + Server Processing + Sending Time
```
### 처리량과 응답시간의 상관 관계
- 부하가 증가할수록 (사용자의 요청이 증가할수록) 어느 수준까지는 처리량이 선형적으로 증가한다.
- 그러나, 어느 시점에 이르면 처리량이 더 이상 증가하지 않고 일정한 수준을 유지하게 되는데, 이 변곡점을 포화점/임계점이라고 한다.

```text
spring:
datasource:
hikari:
minimum-idle: 10
maximum-pool-size: 10
idle-timeout: 30000
connection-timeout: 20000
```
* minimum-idle
- 최소 유휴 커넥션 수
- 초기 설정 시 최소한의 커넥션만 유지
- TPS가 낮을 때 리소스 절약 가능

* maximum-pool-size
- 커넥션 풀의 최대 크기
- TPS가 높아질 때 최대 N개의 커넥션까지 생성해서 요청을 처리

* idle-timeout
- 지정된 시간(ms)동안 유휴 상태인 커넥션이 있을 경우 풀에서 제거
- 트래픽이 낮아질 때 자동으로 풀 크기를 줄이는 데 기여

* connection-timeout
- 커넥션을 얻기 위해 대기하는 최대 시간
- 해당 시간 내에 커넥션을 확보하지 못하면 예외가 발생


-
3 changes: 3 additions & 0 deletions batch/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/gradlew text eol=lf
*.bat text eol=crlf
*.jar binary
37 changes: 37 additions & 0 deletions batch/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
24 changes: 24 additions & 0 deletions batch/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.4'
id 'io.spring.dependency-management' version '1.1.6'
}

bootJar {
enabled = true
}
jar {
enabled = false
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-batch'
// implementation 'org.springframework.boot:spring-boot-starter-quartz'
runtimeOnly 'com.mysql:mysql-connector-j'

// testRuntimeOnly 'com.h2database:h2:2.1.214'
}

tasks.named('bootJar') {
mainClass.set('com.project.imdang.BatchApplication')
}
Binary file added batch/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions batch/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading