Skip to content

chore: automaic CD Pipeline #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 6, 2025
Merged

chore: automaic CD Pipeline #13

merged 9 commits into from
Jun 6, 2025

Conversation

toychip
Copy link
Member

@toychip toychip commented Jun 6, 2025

요약(개요)

api.jar auto CD

작업 내용

  • oauth google 작업할 때 module을 많이 수정했어서 oauth-google 브랜치에서부터 작업을 시작했습니다.

집중해서 리뷰해야 하는 부분

기타 전달 사항 및 참고 자료(선택)

Summary by CodeRabbit

  • 신규 기능

    • 개발 브랜치에 대한 자동 빌드 및 배포 워크플로우가 추가되었습니다.
    • core-api, mcp-host, mcp-server 서비스용 Dockerfile이 새로 도입되었습니다.
    • core-api, mysql, redis 서비스를 위한 Docker Compose 설정 파일이 추가되었습니다.
  • 설정 및 환경 개선

    • core-api, db-core의 환경변수 및 데이터베이스 연결 정보가 명확하게 지정되었습니다.
    • Jasypt 암호화 비밀번호 환경변수 설정이 추가되었습니다.
  • 의존성 변경

    • JWT 라이브러리 의존성이 단일 아티팩트로 정리되고 버전이 변경되었습니다.
  • 코드 스타일

    • 일부 코드에서 람다 표현식이 Supplier로 명시적으로 변경되었습니다.

@toychip toychip requested a review from mkSpace as a code owner June 6, 2025 12:56
Copy link

coderabbitai bot commented Jun 6, 2025

Walkthrough

이 변경사항은 CI/CD 자동화, 도커 배포, 데이터베이스 및 환경설정 개선에 중점을 두고 있습니다. 새로운 GitHub Actions 워크플로우, 여러 Dockerfile 및 Docker Compose 파일이 추가되었으며, 환경 변수 및 데이터베이스 설정이 수정되었습니다. 일부 라이브러리 버전 및 코드 스타일도 변경되었습니다.

Changes

파일/경로 변경 요약
.github/workflows/cd-app-develop.yml develop 브랜치에 대한 자동 빌드 및 배포 GitHub Actions 워크플로우 추가
docker-compose.app.yml, docker-compose.db.yml core-api, mysql, redis 서비스 및 외부 네트워크 mashupnet을 포함하는 Docker Compose 파일 신규 추가
noweekend-core/core-api/Dockerfile, noweekend-mcp/mcp-host/Dockerfile, noweekend-mcp/mcp-server/Dockerfile 각 서비스별 Java 21 기반 Dockerfile 신규 추가
noweekend-core/core-api/src/main/resources/application.yml Jasypt 암호화 비밀번호 환경 변수 매핑 설정 추가
noweekend-core/core-domain/build.gradle.kts JWT 라이브러리 의존성 0.12.6 → 0.11.5로 변경, 모듈 단일화
noweekend-mcp/mcp-host/src/main/kotlin/noweekend/mcphost/config/MyAgentState.kt Kotlin 람다 → Java Supplier로 기본값 공급자 코드 스타일 변경
noweekend-storage/db-core/src/main/resources/db-core.yml local/staging 프로필의 DB 접속 정보 하드코딩 및 비밀번호 변경

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub
    participant GitHub Actions
    participant RemoteServer

    Developer->>GitHub: develop 브랜치에 푸시
    GitHub->>GitHub Actions: 워크플로우 트리거
    GitHub Actions->>GitHub Actions: 소스코드 체크아웃, JDK 21 세팅, Gradle 빌드
    GitHub Actions->>GitHub Actions: Docker 이미지 빌드 및 tar로 저장
    GitHub Actions->>GitHub Actions: 아티팩트 zip 압축
    GitHub Actions->>RemoteServer: SCP로 zip 파일 전송
    GitHub Actions->>RemoteServer: SSH로 배포 명령 실행 (압축 해제, 이미지 로드, docker-compose up)
    RemoteServer->>RemoteServer: 서비스 배포 및 실행
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (11)
noweekend-mcp/mcp-host/src/main/kotlin/noweekend/mcphost/config/MyAgentState.kt (2)

6-6: 불필요한 Java 임포트 추가

Java Supplier 인터페이스 임포트가 추가되었습니다. Kotlin에서는 람다 표현식이 더 관용적이고 간결합니다.


22-24: Kotlin 람다 표현식 사용을 권장합니다

Java Supplier 인스턴스 대신 Kotlin 람다 표현식을 사용하는 것이 더 간결하고 Kotlin 스타일에 적합합니다.

다음과 같이 원래 Kotlin 람다 표현식을 유지하는 것을 권장합니다:

-            "question" to Channels.base(Supplier { "" }),
-            "chat_response" to Channels.base(Supplier { "" }),
-            "weather_json" to Channels.base(Supplier { "" }),
+            "question" to Channels.base { "" },
+            "chat_response" to Channels.base { "" },
+            "weather_json" to Channels.base { "" },
noweekend-mcp/mcp-server/Dockerfile (1)

1-4: 표준적인 Dockerfile 구조 승인

mcp-server 컨테이너화를 위한 Dockerfile이 적절하게 구성되었습니다. Java 21 JRE 베이스 이미지 사용과 표준 패턴을 따르고 있습니다.

프로덕션 환경을 위한 추가 개선 사항을 고려해보세요:

 FROM eclipse-temurin:21-jre
+
+# 보안을 위한 non-root 사용자 생성
+RUN addgroup --system --gid 1001 appgroup && \
+    adduser --system --uid 1001 --gid 1001 appuser
+
 WORKDIR /app
 COPY build/libs/mcp-server-*.jar app.jar
+
+# 애플리케이션 파일 소유권 변경
+RUN chown appuser:appgroup app.jar
+
+# non-root 사용자로 전환
+USER appuser
+
 ENTRYPOINT ["java", "-jar", "app.jar"]
docker-compose.db.yml (2)

25-27: 외부 네트워크 선언 확인
mashupnetexternal로 선언했는데, 해당 네트워크가 사전에 생성되어 있지 않으면 배포가 실패합니다. 배포 스크립트나 가이드에 네트워크 생성 단계를 추가하거나 검증 로직을 포함하세요.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 27-27: no new line character at the end of file

(new-line-at-end-of-file)


27-27: 파일 끝에 개행 문자 추가 필요
YAMLLint 경고(new-line-at-end-of-file)를 해소하려면 마지막 줄에 빈 줄을 추가해주세요.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 27-27: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/cd-app-develop.yml (6)

1-7: 수동 실행 워크플로우 트리거 추가 고려
현재 on.push 이벤트만 정의되어 있어 특정 브랜치에 푸시될 때만 실행됩니다. 긴급 배포나 테스트용으로 GitHub UI에서 워크플로우를 수동으로 트리거하는 workflow_dispatch 이벤트를 추가하는 것을 권장합니다.


16-21: Gradle 캐시 활성화 권장
actions/setup-java에서 cache: 'gradle' 옵션을 추가해 빌드 속도를 개선할 수 있습니다.

🧰 Tools
🪛 actionlint (1.7.7)

17-17: the runner of "actions/setup-java@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


22-24: Gradle 데몬 옵션 고려
./gradlew 명령에 --no-daemon을 추가해 데몬 실행을 방지하거나, --quiet 플래그로 로그 출력을 줄여 워크플로우 로그를 간소화할 수 있습니다.


25-27: Docker 이미지 태그 전략 개선
latest 태그 대신 Git 커밋 SHA나 버전 번호를 포함한 태그를 사용하면 배포된 이미지 식별이 용이해집니다.


28-32: ‘sleep’ 사용 대신 파일 존재 확인
docker save 직후 sleep을 사용하는 대신 while 루프와 test -f core-api.tar 같은 방식으로 파일 생성 완료를 안전하게 확인하는 것이 더 견고합니다.


61-61: 파일 끝 newline 추가
YAML 파일의 마지막 줄에 개행 문자를 추가해 new-line-at-end-of-file lint 오류를 해결하세요.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 61-61: no new line character at the end of file

(new-line-at-end-of-file)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60304c2 and 58bd9c4.

📒 Files selected for processing (10)
  • .github/workflows/cd-app-develop.yml (1 hunks)
  • docker-compose.app.yml (1 hunks)
  • docker-compose.db.yml (1 hunks)
  • noweekend-core/core-api/Dockerfile (1 hunks)
  • noweekend-core/core-api/src/main/resources/application.yml (1 hunks)
  • noweekend-core/core-domain/build.gradle.kts (1 hunks)
  • noweekend-mcp/mcp-host/Dockerfile (1 hunks)
  • noweekend-mcp/mcp-host/src/main/kotlin/noweekend/mcphost/config/MyAgentState.kt (2 hunks)
  • noweekend-mcp/mcp-server/Dockerfile (1 hunks)
  • noweekend-storage/db-core/src/main/resources/db-core.yml (2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
docker-compose.db.yml

[error] 27-27: no new line character at the end of file

(new-line-at-end-of-file)

.github/workflows/cd-app-develop.yml

[error] 61-61: no new line character at the end of file

(new-line-at-end-of-file)

🪛 actionlint (1.7.7)
.github/workflows/cd-app-develop.yml

14-14: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


17-17: the runner of "actions/setup-java@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (10)
noweekend-core/core-api/src/main/resources/application.yml (1)

15-17: 보안 강화를 위한 Jasypt 설정 추가 승인

환경 변수를 통한 Jasypt 암호화 설정 추가는 컨테이너화된 환경에서 민감한 정보를 안전하게 관리하는 좋은 방법입니다.

noweekend-mcp/mcp-host/Dockerfile (1)

1-4: 베이스 이미지 및 JAR 복사/실행 방식 적절함
eclipse-temurin:21-jre를 사용해 런타임만 포함하고, 빌드 결과물을 app.jar로 복사 후 실행하도록 구성한 점이 깔끔합니다.

noweekend-core/core-api/Dockerfile (1)

1-4: Core-API Dockerfile 구성 적합
mcp-host와 동일한 패턴으로 Java 21 런타임 기반 컨테이너를 구성했고, 작업 디렉터리 및 entrypoint가 명확합니다.

docker-compose.app.yml (1)

8-12: 환경 변수 주입 방식 검증 필요
JASYPT_ENCRYPTOR_PASSWORD를 호스트에서 받아오도록 설정했는데, CI/CD 워크플로우나 배포 문서에서 이 변수의 설정 여부를 반드시 확인하도록 안내가 필요합니다.

.github/workflows/cd-app-develop.yml (6)

9-11: 런너 환경 설정 확인 완료
runs-on: ubuntu-latest은 최신 Ubuntu 이미지로 문제 없습니다.


13-15: 소스 코드 체크아웃 단계 OK
actions/checkout@v3를 사용해 최신 코드를 정상적으로 가져옵니다.

🧰 Tools
🪛 actionlint (1.7.7)

14-14: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


33-35: 아티팩트 권한 설정 단계 OK
chmod 644를 사용해 파일 권한을 적절히 설정합니다.


36-38: 아티팩트 압축 단계 OK
zip을 이용해 배포 자료를 압축합니다.


39-48: SCP 액션 설정 OK
appleboy/[email protected]를 사용해 배포 파일을 원격 서버에 전송합니다.


49-61: 원격 배포 스크립트 확인
docker compose 명령으로 컨테이너를 실행합니다. 대상 서버에 Docker Compose 플러그인이 설치되어 있는지 확인이 필요합니다.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 61-61: no new line character at the end of file

(new-line-at-end-of-file)

@toychip toychip merged commit dfca98a into develop Jun 6, 2025
2 of 3 checks passed
@toychip toychip deleted the chore/automatic-cd branch June 6, 2025 13:03
@toychip toychip added 준형 chore Just add labels Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant