Skip to content

Conversation

@LeeCh0129
Copy link
Contributor

@LeeCh0129 LeeCh0129 commented Jul 19, 2025

📌 변경 사항 개요

배포 워크플로우(deploy.yml)의 안정성을 개선하고, 서버에 설정했던 임시 조치들을 제거하여 파이프라인을 최종적으로 완성했습니다.

📝 상세 내용

1. docker-compose 명령어 호환성 해결

  • 문제점: 기존 워크플로우는 구버전 명령어인 docker-compose를 사용하고 있어, 최신 docker compose (공백)가 설치된 서버와 호환되지 않았습니다. 이는 서버에 직접 심볼릭 링크를 생성하는 임시 조치로 해결한 상태였습니다.

  • 개선사항: deploy.yml 파일 내 모든 관련 명령어를 docker compose로 수정하고, 더 이상 서버의 임시 조치에 의존하지 않도록 변경했습니다.

2. 불필요한 pm2 정리 코드 제거

  • 배포 스크립트에 이전에 사용했던 PM2 프로세스를 정리하는 코드가 남아있었고, 현재는 배포 환경이 Docker로 완전히 전환되었으므로, 더 이상 필요없는 pm2 관련 명령어들을 스크립트에서 모두 제거하였습니다.

🔗 관련 이슈

🖼️ 스크린샷(선택사항)

image image

💡 참고 사항

Summary by CodeRabbit

  • Chores
    • 배포 워크플로우에서 더 이상 지원되지 않는 docker-compose 명령어를 docker compose로 교체하였습니다.
    • PM2 프로세스 중지 및 삭제 관련 단계를 제거하였습니다.

@LeeCh0129 LeeCh0129 self-assigned this Jul 19, 2025
@LeeCh0129 LeeCh0129 added 🌏 Deploy 배포 💻 chore 사소한 수정(빌드,패키지매니저등) labels Jul 19, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 19, 2025

Walkthrough

배포 워크플로우 스크립트에서 모든 docker-compose 명령어를 최신 docker compose 명령어로 교체하고, PM2 프로세스 종료 및 삭제 관련 명령어 세 줄을 제거했습니다. 그 외 배포 로직은 변경하지 않았습니다.

Changes

파일/경로 변경 요약
.github/workflows/deploy.yml docker-composedocker compose로 명령어 교체, PM2 관련 코드 제거

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Server

    GitHub Actions->>Server: docker compose ps
    GitHub Actions->>Server: docker compose stop
    GitHub Actions->>Server: docker compose up -d
    GitHub Actions->>Server: docker compose logs
    Note over GitHub Actions,Server: PM2 관련 명령어 제거됨
Loading

Possibly related PRs

Poem

🐰
도커 하이픈이여, 안녕—
compose에 공백을 더하니
배포는 더욱 깔끔해졌네.
PM2는 이제 추억 속으로,
워크플로우는 가볍고 산뜻하게!
오늘도 서버는 춤을 춘다,
토끼도 기분이 좋아진다.


🪧 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: 0

🧹 Nitpick comments (4)
.github/workflows/deploy.yml (4)

126-130: YAML Lint 오류: 130 행의 후행 공백 제거 필요

yamllint가 지적한 트레일링 스페이스가 그대로 남아 있으면 파이프라인이 실패할 수 있습니다. 불필요한 공백을 제거해 주세요.

-            echo "Current: $CURRENT_IMAGE" > ~/deployments/previous-version.txt  
+            echo "Current: $CURRENT_IMAGE" > ~/deployments/previous-version.txt

132-134: docker compose down 시 orphan 컨테이너 정리 옵션 추가 권장

현재 중지 명령은 잔여 컨테이너를 남길 수 있습니다. --remove-orphans를 함께 사용하면 예기치 못한 충돌을 예방할 수 있습니다.

-            docker compose down || true
+            docker compose down --remove-orphans || true

140-144: 최신 이미지를 확실히 사용하려면 --pull always 옵션 추가

태그가 같은 이미지를 캐시에서 가져오는 상황을 방지하려면 docker compose up--pull always를 붙여 최신 이미지를 강제하는 것이 안전합니다.

-            docker compose up -d
+            docker compose up -d --pull always

157-160: 로그 조회 가독성 개선 및 프리픽스 제거 고려

서비스명을 앞에 두고 --no-log-prefix 옵션을 추가하면 출력이 한눈에 들어옵니다.

-              docker compose logs --tail 50 nextjs
+              docker compose logs nextjs --tail 50 --no-log-prefix
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fb0e1c1 and 680217d.

📒 Files selected for processing (1)
  • .github/workflows/deploy.yml (3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/deploy.yml

[error] 130-130: trailing spaces

(trailing-spaces)

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: 0

🔭 Outside diff range comments (1)
.github/workflows/deploy.yml (1)

108-114: IMAGE_URL‧GIT_SHA가 원격에 전달되지 않아 docker pull 단계에서 실패합니다
<< 'ENDSSH' 형태의 히어독은 로컬 변수 확장을 차단하므로, 원격 세션에는 IMAGE_URL/GIT_SHA가 정의되지 않습니다. 이후 ${IMAGE_URL} 참조(112·137·142행 등)가 빈 값이어서 배포가 즉시 실패합니다.

-          ssh -i ~/.ssh/id_rsa ${{ secrets.OCI_USERNAME }}@${{ secrets.OCI_HOST }} << 'ENDSSH'
+          ssh -i ~/.ssh/id_rsa ${{ secrets.OCI_USERNAME }}@${{ secrets.OCI_HOST }} << ENDSSH
+            # 로컬에서 받은 값을 원격 세션에 주입
+            export IMAGE_URL="${IMAGE_URL}"
+            export GIT_SHA="${GIT_SHA}"

ENDSSH 뒤쪽은 그대로 유지하면 됩니다.
이 방식이 어렵다면 ssh 옵션 -o SendEnv=를 쓰거나, 명령어 인라인 전달(ssh host "IMAGE_URL=$IMAGE_URL ...")도 가능합니다.

🧹 Nitpick comments (3)
.github/workflows/deploy.yml (3)

126-130: docker compose ps … | xargs … 구문이 깨질 수 있으며 YAMLLint 경고(공백)도 존재합니다

  1. 서비스명이 nextjs로 하드코딩되어 있어 docker compose 파일 변경 시 자동 롤백 기능이 깨집니다. --services 혹은 환경변수 기반으로 이름을 주입해 두는 편이 안전합니다.
  2. xargs 앞에서 파이프가 실패해도 set -e가 무력화됩니다. set -o pipefail을 함께 지정하거나 || true 대신 명시적 오류 처리를 권장합니다.
  3. 130행 끝에 불필요한 공백이 있어 YAMLLint가 오류(trailing-spaces)를 보고합니다.

예시:

-            CURRENT_IMAGE=$(docker compose ps -q nextjs | xargs docker inspect -f '{{.Config.Image}}' 2>/dev/null || echo "none")
+            set -o pipefail
+            SERVICE_NAME=${SERVICE_NAME:-nextjs}
+            CURRENT_IMAGE=$(docker compose ps -q "$SERVICE_NAME" | \
+              xargs -r docker inspect -f '{{.Config.Image}}' 2>/dev/null || echo "none")

133-134: docker compose down 시 고아 컨테이너 및 볼륨 정리 플래그를 함께 사용해 주세요
--remove-orphans와 상황에 따라 --volumes를 추가해 두면 이전 버전에서 남은 불필요한 컨테이너·볼륨이 깔끔히 정리됩니다.

-            docker compose down || true
+            docker compose down --remove-orphans --volumes || true

159-160: 장애 분석을 위해 로그 출력 뒤 바로 실패 코드를 전달하도록 순서를 단순화할 수 있습니다
docker compose logs … && exit 1 형태면 로그가 찍힌 뒤 정확한 실패 코드가 유지됩니다. 현 구조도 동작하나 명시적 연쇄가 가독성에 더 좋습니다.

-              docker compose logs --tail 50 nextjs
-              exit 1
+              docker compose logs --tail 50 nextjs && exit 1
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fb0e1c1 and 680217d.

📒 Files selected for processing (1)
  • .github/workflows/deploy.yml (3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/deploy.yml

[error] 130-130: trailing spaces

(trailing-spaces)

@LeeCh0129 LeeCh0129 changed the title Chore: CI/CD 파이프라인 안정성 개선 Chore/54 CI/CD 파이프라인 안정성 개선 Jul 20, 2025
@LeeCh0129 LeeCh0129 merged commit b01d043 into develop Jul 21, 2025
2 checks passed
@LeeCh0129 LeeCh0129 deleted the chore/54 branch July 21, 2025 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 chore 사소한 수정(빌드,패키지매니저등) 🌏 Deploy 배포

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[chore] CI/CD 파이프라인 안정성 개선

5 participants