Skip to content
Merged

Dev #117

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
04a80c6
fix: bid와 ask 수정사항 적용
Junh-b May 12, 2025
7602e2a
feat: 종목 재사용성 증가
109an94 May 19, 2025
4e5f50d
Merge branch 'dev' of https://github.com/CleanEngine/cleanengine-be i…
109an94 May 19, 2025
2a6a21a
add: bot 외 로그 주석 처리
109an94 May 19, 2025
bed7372
feat: vwap 종목별 동적 증가
109an94 May 20, 2025
c41af3d
fix: Stomp테스트 template 재설정
bongj9 May 22, 2025
57e3bf1
fix: 데이터가 없어도 현재가격은 뜨게 표시
bongj9 May 22, 2025
35e05e4
todo:설정
bongj9 May 22, 2025
f01c385
fix:코드 재정리
bongj9 May 22, 2025
f78384a
feat: virtualVWAP 변수 캡슐화
109an94 May 22, 2025
de72ec0
feat: ApiVWAP 변수 캡슐화
109an94 May 22, 2025
8b827eb
refactor: 코드 삭제
109an94 May 22, 2025
d499429
fix:현재 데이터가 없다면 이전 거래 데이터 반환
bongj9 May 22, 2025
6108b53
Merge branch 'dev' into feat/order-queue
Junh-b May 22, 2025
956b143
fix: 주문, 호가 큐가 동적으로 개수를 조절할 수 있도록 변경
Junh-b May 22, 2025
fa47670
fix:package명 변경
bongj9 May 23, 2025
4ec0e15
Merge branch 'dev' of https://github.com/CleanEngine/cleanengine-be i…
bongj9 May 23, 2025
75f0a36
fix:import 추가
bongj9 May 23, 2025
8387e6d
config: LOG_LEVEL 환경변수를 통해 로그 레벨을 동적으로 변경할 수 있도록 변경
caniro May 23, 2025
2815162
feat: icon 데이터 초기화 기능, AssetController icon 제공기능 추가
Junh-b May 23, 2025
1a1227f
Merge pull request #67 from CleanEngine/config/log
caniro May 23, 2025
f74ccc8
refactor: IconInitializer 접근자, 메서드 이름 수정
Junh-b May 23, 2025
061fb82
config: root 기본 레벨을 INFO로 추가 (org.springframework, org.hibernate 등의 로…
caniro May 23, 2025
0b61529
Merge pull request #70 from CleanEngine/config/log
caniro May 23, 2025
02b3218
Merge pull request #69 from CleanEngine/feat/order-queue
Junh-b May 23, 2025
8f142bc
Merge pull request #66 from CleanEngine/feat/chartdata
bongj9 May 23, 2025
b2d63c6
fix: ChartDataController 일시 허용
Junh-b May 23, 2025
567dd75
Merge pull request #71 from CleanEngine/config/common
Junh-b May 23, 2025
25a9785
config: 다른 Runner들의 실행 순서 정의
Junh-b May 23, 2025
7770c79
feat: 주문 복원 기능 추가
Junh-b May 23, 2025
a43227e
refactor: vwap 누적 문제 처리중
109an94 May 23, 2025
e77a1c3
Merge pull request #72 from CleanEngine/feat/order-queue
Junh-b May 24, 2025
922d9f4
refactor: vwap 누적 문제 처리
109an94 May 25, 2025
0eaf3e5
local mariadb 설정파일 추가 (#75)
Junh-b May 26, 2025
c2e8414
예외 처리 로직, 핸들러의 로그 작성 방식 수정 (#77)
Junh-b May 26, 2025
453137c
fix: 하락 추세 반영 시 power에 의해 volume이 음수가 되는 현상 개선
caniro May 26, 2025
6132ed0
add: 주석 및 코드 정리
109an94 May 26, 2025
4f4db5e
Merge pull request #79 from CleanEngine/feat/realitybot-fix
caniro May 26, 2025
d947e23
feat: 체결 시 transaction 적용, 체결 완료 시 이벤트 발행
caniro May 26, 2025
816e5c4
refactor: Volume 0 이슈 해결
109an94 May 26, 2025
2a681d1
refactor: 초기 vwap 생성 이슈
109an94 May 26, 2025
2894397
Merge pull request #84 from CleanEngine/feat/trade-core
caniro May 26, 2025
aa63fa5
Controller, MariaDBRepository, Websocket용 Base class 추가 (#82)
Junh-b May 26, 2025
21a6b52
config: main 브랜치의 README 수정 시 재배포되는 현상 개선
caniro May 27, 2025
d6cfe86
Merge branch 'dev' of https://github.com/CleanEngine/cleanengine-be i…
109an94 May 27, 2025
7cb2749
refactor: 추종 수준 1%대 상향 조정
109an94 May 27, 2025
2a2be97
Merge pull request #86 from CleanEngine/config/github
caniro May 27, 2025
97b0dfb
add: 주석처리
109an94 May 27, 2025
383fc4b
refactor: 상수 수정
109an94 May 27, 2025
0ec1a98
Merge branch 'dev' into feat/realitybot
109an94 May 27, 2025
30dbe04
Delete README.md
109an94 May 28, 2025
f8c5d8f
Merge pull request #90 from CleanEngine/feat/realitybot
109an94 May 28, 2025
023b5a4
주문 패키지 코드 리팩토링(Strategy, 클린 아키텍처 적용, 주문큐 세부사항 격리) (#94)
Junh-b May 28, 2025
ba3d29c
feat:코인 종목에 따라 구독 목록에 추가,삭제,구독여부 구현
bongj9 May 28, 2025
e7cd294
refactor:구독 요청이 들어오면 ChartSubscriptionService의 구독목록에 코인 추가
bongj9 May 28, 2025
afe77f9
feat:체결시 이벤트를 받아 처리하는 이벤트 로직
bongj9 May 28, 2025
27875d0
feat:웹소켓에 보내지는 Stomp 프로토콜의 메세지 생성
bongj9 May 28, 2025
c7d1458
Delete:이벤트처리로 인해 스케쥴러 삭제
bongj9 May 28, 2025
6fe7e2d
refactor:이벤트로 trade정보를 불러와 거래차트에 보낼 DTO반환
bongj9 May 28, 2025
fbb5d4b
TradeEvent의 null issue 해결, 호가측 EventHandler 방식으로 변경 (#99)
Junh-b May 29, 2025
57b17d6
refactor:전날 종가 메세지 양식 추가
bongj9 May 29, 2025
381ae0c
refactor:메세지 형식을 기존에 있던 양식을 따로 클래스로 빼서 결합도 완화 작업
bongj9 May 29, 2025
8c7d102
feat:이벤트 핸들러에 전날 종가도 이벤트 처리
bongj9 May 29, 2025
d83e066
refactor:null값일때 처리를 유연하게 변경
bongj9 May 29, 2025
3984977
feat:메세지 구독 요청 목록을 추가하여 종목 추가 되어도 유연하게 작동하도록 변경
bongj9 May 29, 2025
b606890
delete:이벤트 처리로 변경되었으므로 스케쥴 삭제
bongj9 May 29, 2025
9961919
Merge branch 'dev' of https://github.com/CleanEngine/cleanengine-be i…
bongj9 May 29, 2025
d1c3663
Merge pull request #97 from CleanEngine/feat/chartdata
bongj9 May 29, 2025
2d6716f
refactor:Object data 삭제
bongj9 May 29, 2025
b078f60
add: jacoco plugin 추가
caniro May 29, 2025
422730a
test: Account 관련 단위테스트 코드 작성 및 리팩토링
caniro May 29, 2025
0f41c83
refactor:필요없는 import문 정리
bongj9 May 29, 2025
2af1fae
Merge pull request #103 from CleanEngine/config/test
caniro May 29, 2025
3c069af
Merge pull request #104 from CleanEngine/test/account
caniro May 29, 2025
87ab209
Merge pull request #100 from CleanEngine/feat/chartdata
bongj9 May 29, 2025
e1526da
MariaDBAdapterTest Transaction 충돌 issue 해결, 전역 테스트 대상에서 제외 (#105)
Junh-b May 29, 2025
4811455
config: 패키지의 로그가 root 로그에도 포함되어 2번씩 출력되던 현상 개선
caniro May 29, 2025
3cae557
Merge pull request #106 from CleanEngine/config/log
caniro May 30, 2025
3b2507b
config: sonarqube 설정 추가
BHyeonKim May 30, 2025
167660b
Merge branch 'dev' into config/sonarqube
BHyeonKim May 30, 2025
da70d65
fix: host url 환경변수 수정 및 스크립트 수정
BHyeonKim May 30, 2025
68634fc
Merge pull request #108 from CleanEngine/config/sonarqube
BHyeonKim May 30, 2025
dc59122
test containers 전역테스트 대상 제외, jacoco 개발환경용 설정 수정 (#112)
Junh-b May 31, 2025
dbc7ff3
config: github actions workflows 관련 중복 제거, 가독성 개선, 대상 경로 추가, workflow 통합
caniro May 31, 2025
d969b94
refactor:테스트 하기 좋게 코드 리펙토링(SRP에 맞게 리펙토링)
bongj9 Jun 1, 2025
c81e2d5
refactor:시간 데이터를 파라미터로 받도록 수정(테스트할때마다 시간이 달라지는점때문에 수정)
bongj9 Jun 1, 2025
6888f2f
refactor:결합도가 높은 메서드들을 테스트 하기 좋게 메서드 분리,SRP 원칙에 따라 리펙토링
bongj9 Jun 1, 2025
9c1ae72
refactor:결합도가 높은 메서드들을 테스트 하기 좋게 메서드 분리,SRP 원칙에 따라 리펙토링
bongj9 Jun 1, 2025
c8c7ad7
refactor:결합도가 높은 메서드들을 테스트 하기 좋게 메서드 분리,SRP 원칙에 따라 리펙토링
bongj9 Jun 1, 2025
126229c
refactor:결합도가 높은 메서드들을 테스트 하기 좋게 메서드 분리,SRP 원칙에 따라 리펙토링
bongj9 Jun 1, 2025
dc2eecb
refactor:테스트시 CCMap에서 null을 허용하는 예외를 발견
bongj9 Jun 1, 2025
23f3053
test:ChartSubscription unitTest
bongj9 Jun 1, 2025
57ca2d7
test: MinuteOhlcDataService unitTest
bongj9 Jun 1, 2025
61b9d1e
test: RealTimeDataPrevRate unitTest
bongj9 Jun 1, 2025
ca22a83
test: RealTimeOhlcService unitTest
bongj9 Jun 1, 2025
1d3b2d9
test: RealTimeTradeService unitTest
bongj9 Jun 1, 2025
60407ee
test: WebsocketSendService unitTest
bongj9 Jun 1, 2025
b199067
refactor:필드 생성방식을 리플렉션에서 기본 생성자로 변경
bongj9 Jun 2, 2025
88a8149
Test:updateTradeCache, generateRealTimeData, calculateChangeRate 메서드 …
bongj9 Jun 2, 2025
d2ad2cf
Refactor:테스트에서 발견된 ohlcv로직 변경(List를 reverse를 하여 시작가 종가를 찾았으나 불필요한 방법인…
bongj9 Jun 2, 2025
a9e077c
Refactor:역순을 확인한 test 삭제(본 서비스에서 해당 기능을 삭제했기 때문)
bongj9 Jun 2, 2025
7281a0f
config: 도커 이미지 저장소 ECR -> docker hub 롤백, 실행 명령 간소화
caniro Jun 3, 2025
f57e687
config: AWS MariaDB 컨테이너 분리에 따른 설정 변경
caniro Jun 3, 2025
7a0b957
Merge pull request #116 from CleanEngine/config/ci-cd
caniro Jun 3, 2025
fcbb726
Merge pull request #114 from CleanEngine/feat/chartdata
Junh-b Jun 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/code-analyze-sonarqube.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Code Analyze With SonarQube

run-name: Run code analyze triggered by ${{github.actor}}

on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- main
- dev
paths:
- 'src/**'
push:
branches:
- dev
paths:
- 'src/**'

jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'

- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Build with tests
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
continue-on-error: true
run: ./gradlew build --info

- name: SonarQube Analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
run: ./gradlew sonar --info
48 changes: 31 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: CI/CD Deploy
name: CI/CD Deploy and Start services

run-name: Deploy springboot as backend image to ECR by ${{github.actor}}
run-name: Deploy to ECR and Start services by ${{github.actor}}

on:
push:
branches: [ "main" ]
branches:
- main
paths:
- 'src/**'

jobs:
build:
Expand All @@ -29,20 +32,31 @@ jobs:
- name: Build with Gradle Wrapper
run: ./gradlew build -x test

- name: Build image
run: |
docker build -t ${{ secrets.AWS_ORGANIZATION }}/backend .
docker tag ${{ secrets.AWS_ORGANIZATION }}/backend:latest ${{ secrets.AWS_ECR_BACKEND_REPO }}:latest

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
- name: Login to DockerHub
uses: docker/login-action@v3
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_TOKEN}}

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{secrets.DOCKER_USERNAME}}/if-be:latest

- name: Push image to ECR
run: |
docker push ${{ secrets.AWS_ECR_BACKEND_REPO }}:latest
start-services:
needs: build
runs-on: ubuntu-latest
steps:
- name: Connect to cloud server and run Docker commands
uses: appleboy/ssh-action@v1.2.2
with:
host: ${{secrets.BACKEND_HOST}}
username: ${{secrets.CLOUD_USERNAME}}
key: ${{secrets.CLOUD_SECRET_KEY}}
port: ${{secrets.CLOUD_PORT}}
script: |
cd ~
/bin/bash run_springboot.sh
27 changes: 0 additions & 27 deletions .github/workflows/start-service.yml

This file was deleted.

94 changes: 0 additions & 94 deletions README.md

This file was deleted.

46 changes: 45 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.4.5'
id 'io.spring.dependency-management' version '1.1.7'
id "org.sonarqube" version "6.0.1.5171"
id 'jacoco'
}

group = 'com.cleanengine'
Expand All @@ -23,6 +25,26 @@ repositories {
mavenCentral()
}

jacoco { //추가함
toolVersion = "0.8.13"
}

jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
}

// afterEvaluate {
// getClassDirectories().setFrom(files(classDirectories.files.collect{
// fileTree(dir : it, includes: [
// "com/cleanengine/coin/realitybot/**"
// ])
// }))
// }
}

dependencies {

implementation 'org.springframework.boot:spring-boot-starter-websocket' // WS + STOMP
Expand All @@ -45,8 +67,13 @@ dependencies {
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.springframework.boot:spring-boot-testcontainers:3.4.5'
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:mariadb'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

testImplementation 'org.junit.platform:junit-platform-suite:1.10.0'
// Spring Security + OAuth2
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
Expand All @@ -58,5 +85,22 @@ dependencies {
}

tasks.named('test') {
useJUnitPlatform()
useJUnitPlatform{
excludeTags 'testcontainers'
}
finalizedBy jacocoTestReport
}

sonar {
properties {
property "sonar.projectKey", "CleanEngine_cleanengine-be_2b6f2f63-fa39-426c-b9c7-8aa127fd14d8"
property "sonar.projectName", "cleanengine-be"
property "sonar.host.url", System.getenv('SONAR_HOST_URL') ?: 'http://localhost:9000'
property "sonar.token", System.getenv('SONAR_TOKEN') ?: ''
property "sonar.java.source", '21'
property "sonar.java.target", '21'
property "sonar.sourceEncoding", "UTF-8"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}
51 changes: 51 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: '3.8'

services:
app:
image: eclipse-temurin:21-jre-alpine
container_name: my-spring-app
volumes:
- ../build/libs/coin-0.0.1-SNAPSHOT.jar:/app/coin-0.0.1-SNAPSHOT.jar
- /etc/localtime:/etc/localtime:ro
- /home/ubuntu/logs/springboot:/app/logs
working_dir: /app
command: ["java", "-jar", "coin-0.0.1-SNAPSHOT.jar", "--spring.profiles.active=dev,mariadb-local"]
ports:
- "8080:8080"
env_file:
- ./local.properties
environment:
- TZ=Asia/Seoul
depends_on:
mariadb:
condition: service_healthy
networks:
- app-network

mariadb:
image: mariadb:latest
container_name: mariadb
ports:
- "3306:3306"
env_file:
- ./local.properties
environment:
- TZ=Asia/Seoul
volumes:
- mariadb_data:/var/lib/mysql
- ./mariadb/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: [ "CMD", "healthcheck.sh", "--connect", "--innodb_initialized" ]
interval: 10s
timeout: 5s
retries: 10
networks:
- app-network

networks:
app-network:
driver: bridge

volumes:
mariadb_data:
driver: local
Loading