From 846451dfde878c7343afdd123a7a272adff6e889 Mon Sep 17 00:00:00 2001 From: Jaewon Lee <58386334+jaewonLeeKOR@users.noreply.github.com> Date: Fri, 29 Aug 2025 16:15:22 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[LB-394]=20feat=20:=20ghcr=20=EA=B8=B0?= =?UTF-8?q?=EB=B0=98=20=EC=8A=A4=ED=8A=B8=EB=A6=AC=EB=B0=8D=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/pull_request_template.md | 8 ++ .github/workflows/githubCD.yaml | 99 +++++++++++++++++++ .github/workflows/githubCI.yaml | 65 ++++++++++++ build.gradle | 16 +++ docker/Dockerfile | 9 ++ src/main/resources/application-test.yml | 2 +- .../streaming/StreamingApplicationTests.java | 2 + 7 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/githubCD.yaml create mode 100644 .github/workflows/githubCI.yaml create mode 100644 docker/Dockerfile diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..a998124 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,8 @@ +## 작업 내용 +- 로그인 기능 API 구현 +- 로그인 UI 구현 +## 리뷰 받고 싶은 부분 (옵션) +- 토큰 인증 필터 로직이 괜찮은지 피드백 부탁드려요 +- UI 디자인 괜찮은지 봐주세요 +## 회고, 느낀점 (옵션) +- 성능 테스트가 어려웠어요 \ No newline at end of file diff --git a/.github/workflows/githubCD.yaml b/.github/workflows/githubCD.yaml new file mode 100644 index 0000000..e30aa67 --- /dev/null +++ b/.github/workflows/githubCD.yaml @@ -0,0 +1,99 @@ +name: Build & Delivery + +on: + push: + branches: + - 'main' + +env: + REGISTRY: ghcr.io + ORGANIZATION: lgcns-final-lgcms + REPOSITORY: ${{ github.repository }} + REGISTRY_USERNAME: ${{ github.actor }} + +jobs: + build: + runs-on: ubuntu-latest + services: + pgvector: + image: pgvector/pgvector:pg17 + env: + POSTGRES_USER: lgcms + POSTGRES_PASSWORD: 1234 + POSTGRES_DB: testdb + ports: + - 5432:5432 + valkey: + image: valkey/valkey:alpine3.22 + ports: + - 6379:6379 + kafka: + image: bitnamilegacy/kafka:4.0.0-debian-12-r10 + env: + KAFKA_CFG_NODE_ID: 0 + KAFKA_CFG_PROCESS_ROLES: controller,broker + KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094 + KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,EXTERNAL://127.0.0.1:9094 + KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT + KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka:9093 + KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER + KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: true + ports: + - 9092:9092 + - 9094:9094 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ secrets.TOKEN_GITHUB }} + + - name: Setup Java JDK + uses: actions/setup-java@v4 + with: + distribution: 'corretto' + java-version: 21 + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + shell: bash + + - name: Create application-dev.yaml + run: | + mkdir -p src/main/resources + echo "${{ vars.APPLICATION_DEV }}" > src/main/resources/application-dev.yaml + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Build with Gradle + id: buildWithGradle + run: ./gradlew clean build + shell: bash + + - name: Extract App Name & Version + run: | + echo "APP_NAME=$(./gradlew -q getAppName | perl -pe 's/([A-Z])/-\L$1/g')" >> ${GITHUB_ENV}; + echo "APP_VERSION=$(./gradlew -q getAppVersion)" >> ${GITHUB_ENV}; + + - name: Set Docker Image version + run: | + echo "DOCKER_IMAGE=${{ env.REGISTRY }}/${{ env.ORGANIZATION }}/${{ env.APP_NAME }}:${{ env.APP_VERSION }}" >> ${GITHUB_ENV} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ env.REGISTRY_USERNAME }} + password: ${{ secrets.TOKEN_GITHUB }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build & Push Docker Image (multi-platform) + uses: docker/build-push-action@v5 + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ env.DOCKER_IMAGE }} diff --git a/.github/workflows/githubCI.yaml b/.github/workflows/githubCI.yaml new file mode 100644 index 0000000..41f4f49 --- /dev/null +++ b/.github/workflows/githubCI.yaml @@ -0,0 +1,65 @@ +name: Build & Test + +on: + push + +env: + REGISTRY: ghcr.io + ORGANIZATION: lgcns-final-lgcms + REPOSITORY: ${{ github.repository }} + REGISTRY_USERNAME: ${{ github.actor }} + +jobs: + build: + runs-on: ubuntu-latest + services: + pgvector: + image: pgvector/pgvector:pg17 + env: + POSTGRES_USER: lgcms + POSTGRES_PASSWORD: 1234 + POSTGRES_DB: testdb + ports: + - 5432:5432 + valkey: + image: valkey/valkey:alpine3.22 + ports: + - 6379:6379 + kafka: + image: bitnamilegacy/kafka:4.0.0-debian-12-r10 + env: + KAFKA_CFG_NODE_ID: 0 + KAFKA_CFG_PROCESS_ROLES: controller,broker + KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094 + KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,EXTERNAL://127.0.0.1:9094 + KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT + KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka:9093 + KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER + KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: true + ports: + - 9092:9092 + - 9094:9094 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ secrets.TOKEN_GITHUB }} + + - name: Setup Java JDK + uses: actions/setup-java@v4 + with: + distribution: 'corretto' + java-version: 21 + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + shell: bash + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Build with Gradle + id: buildWithGradle + run: ./gradlew clean build + shell: bash + diff --git a/build.gradle b/build.gradle index 8f3c831..3eb5576 100644 --- a/build.gradle +++ b/build.gradle @@ -48,3 +48,19 @@ dependencyManagement { tasks.named('test') { useJUnitPlatform() } + +jar { + enabled = false +} + +tasks.register("getAppName") { + doLast { + println("${rootProject.name}") + } +} + +tasks.register("getAppVersion") { + doLast { + println("${rootProject.version}") + } +} diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..f412252 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,9 @@ +FROM eclipse-temurin:21-jre-jammy +RUN apt-get update && apt-get install -y ffmpeg \ + && rm -rf /var/lib/apt/lists/* +WORKDIR /app +EXPOSE 8080 +COPY build/libs/*.jar /app/app.jar +ENTRYPOINT ["java", "-jar", "/app/app.jar"] + + diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 16bb96e..11b84cc 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -5,7 +5,7 @@ spring: application: name: backend-streaming kafka: - bootstrap-servers: localhost:9092 + bootstrap-servers: localhost:9094 listener: ack-mode: manual_immediate diff --git a/src/test/java/com/lgcms/streaming/StreamingApplicationTests.java b/src/test/java/com/lgcms/streaming/StreamingApplicationTests.java index 3f111b2..d76fb89 100644 --- a/src/test/java/com/lgcms/streaming/StreamingApplicationTests.java +++ b/src/test/java/com/lgcms/streaming/StreamingApplicationTests.java @@ -2,7 +2,9 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +@ActiveProfiles("test") @SpringBootTest class StreamingApplicationTests { From 43a08a090840147b8ff737c15cb63dd53d72adf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=98=EB=A6=AC=EB=B3=B4=EB=83=A0?= Date: Fri, 29 Aug 2025 16:30:05 +0900 Subject: [PATCH 2/6] =?UTF-8?q?hotfix=20:=20aws,=20ffmpeg=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=A3=BC=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 3eb5576..2f7f4fb 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,8 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j' implementation 'org.springframework.cloud:spring-cloud-starter-openfeign' + implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE' + implementation 'net.bramp.ffmpeg:ffmpeg:0.8.0' implementation 'org.springframework.kafka:spring-kafka' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' From 66a85a1be63b18261e1989a8e7579cc3026108ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=98=EB=A6=AC=EB=B3=B4=EB=83=A0?= Date: Fri, 29 Aug 2025 16:38:36 +0900 Subject: [PATCH 3/6] =?UTF-8?q?hotfihotfixx=EA=B2=BD=EB=B3=80=EC=88=98=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-local.yml | 7 +++++++ src/main/resources/application-test.yml | 20 +++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index ee6f42c..3dc6e37 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -46,3 +46,10 @@ cloud: auto: false stack: auto: false + +ffmpeg: + path: ${FFMPEG_PATH} +ffprobe: + path: ${FFPROBE_PATH} + + diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 11b84cc..3a7b7d1 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -25,4 +25,22 @@ spring: key-serializer: org.apache.kafka.common.serialization.StringSerializer value-serializer: org.springframework.kafka.support.serializer.JsonSerializer properties: - spring.json.add.type.headers: false \ No newline at end of file + spring.json.add.type.headers: false + + cloud: + aws: + s3: + bucket: hello + credentials: + access-key: akey + secret-key: skey + region: + static: ap-northeast-2 + auto: false + stack: + auto: false + +ffmpeg: + path: asdv +ffprobe: + path: zxcas \ No newline at end of file From 61787d659d6102613dba4246a6ac973bb78ff2a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=98=EB=A6=AC=EB=B3=B4=EB=83=A0?= Date: Fri, 29 Aug 2025 17:06:34 +0900 Subject: [PATCH 4/6] =?UTF-8?q?hotfix=20:=20=ED=99=98=EA=B2=BD=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-local.yml | 3 +++ src/main/resources/application-test.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index 3dc6e37..e960f1a 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -46,6 +46,9 @@ cloud: auto: false stack: auto: false + cdn: + url: ${CND_URL} + ffmpeg: path: ${FFMPEG_PATH} diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 3a7b7d1..a718718 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -39,6 +39,9 @@ spring: auto: false stack: auto: false + cdn: + url: asdasd + ffmpeg: path: asdv From d8239e13d2eb43630ec783234c82d813315e53dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=98=EB=A6=AC=EB=B3=B4=EB=83=A0?= Date: Fri, 29 Aug 2025 17:13:29 +0900 Subject: [PATCH 5/6] =?UTF-8?q?hotfix=20:=20=ED=99=98=EA=B2=BD=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-test.yml | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index a718718..01749db 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -27,20 +27,20 @@ spring: properties: spring.json.add.type.headers: false - cloud: - aws: - s3: - bucket: hello - credentials: - access-key: akey - secret-key: skey - region: - static: ap-northeast-2 - auto: false - stack: - auto: false - cdn: - url: asdasd +cloud: + aws: + s3: + bucket: hello + credentials: + access-key: akey + secret-key: skey + region: + static: ap-northeast-2 + auto: false + stack: + auto: false + cdn: + url: asdasd ffmpeg: From ae51dba6a53c49d4911451222475d3bea30b5e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=98=EB=A6=AC=EB=B3=B4=EB=83=A0?= Date: Fri, 29 Aug 2025 17:16:48 +0900 Subject: [PATCH 6/6] =?UTF-8?q?hotfix=20:=20=ED=99=98=EA=B2=BD=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 01749db..9015839 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -39,8 +39,8 @@ cloud: auto: false stack: auto: false - cdn: - url: asdasd + cdn: + url: asdasd ffmpeg: