Skip to content

Conversation

@JangYeongHu
Copy link
Contributor

Summary

#306

기존에 개인 서버로 운영되었던 개발 서버를 클라우드로 이전합니다.

Tasks

  • workflow 재작성
  • AWS EC2 인스턴스 생성

To Reviewer

Github Action과 Workflow 파일을 덮어쓰는 것이 아니라 파일을 신규 작성하여 충분한 테스트 후 기존 Action을 삭제하는 방식으로 리팩토링 할 계획입니다.

@JangYeongHu JangYeongHu self-assigned this Dec 29, 2025
@JangYeongHu JangYeongHu added the 🔨refactor refactoring code label Dec 29, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 29, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

개요

새로운 GitHub Actions 워크플로우를 도입하여 세 개의 Docker 이미지(aics-admin, aics-api, aics-auth)를 빌드한 후 docker-compose를 통해 개발 서버에 배포하는 CI/CD 파이프라인을 구성합니다.

변경 사항

응집도 / 파일 변경 요약
GitHub Actions 워크플로우
.github/workflows/cloud-dev-build-deploy.yml
새로운 워크플로우 추가: build-docker-image 작업에서 JDK 17 설정, Gradle 프로젝트 빌드(aics-admin, aics-api, aics-auth), Docker Hub 로그인 및 이미지 빌드/푸시(commit SHA 및 latest 태그 포함); deploy-to-dev 작업에서 SCP로 docker-compose.yml 전송 후 SSH를 통해 서버에서 docker-compose pull/up 실행

예상 코드 리뷰 노력

🎯 2 (Simple) | ⏱️ ~12 분

관련 가능성 있는 PR

제안 검토자

  • LeeHanEum
  • LeeShinHaeng

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed 설명이 변경 사항과 관련이 있습니다. PR이 개발 서버를 클라우드로 이전하고 워크플로우를 재작성하는 내용을 설명하고 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed PR 제목이 변경 사항의 주요 내용과 일치합니다. AWS 개발 서버 CD를 위한 워크플로우 추가라는 제목이 새로운 GitHub Actions 워크플로우 도입이라는 핵심 변경을 정확히 요약합니다.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

Test Coverage Report

Overall Project 80.41% 🍏

There is no coverage information present for the Files changed

@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop     #307   +/-   ##
==========================================
  Coverage      86.51%   86.51%           
  Complexity        67       67           
==========================================
  Files             24       24           
  Lines            267      267           
  Branches          14       14           
==========================================
  Hits             231      231           
  Misses            24       24           
  Partials          12       12           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 315cfaf...3b3defb. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JangYeongHu JangYeongHu marked this pull request as draft December 29, 2025 16:38
Copy link
Contributor

@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 (2)
.github/workflows/cloud-dev-build-deploy.yml (2)

29-33: Gradle 빌드 로직이 올바릅니다.

세 개의 프로젝트를 개별적으로 빌드하는 로직이 명확하고 정확합니다.

선택적 개선: 매트릭스 전략 사용

향후 프로젝트가 추가될 경우 매트릭스 전략을 고려할 수 있습니다:

strategy:
  matrix:
    module: [aics-admin, aics-api, aics-auth]
steps:
  - name: Build with Gradle Wrapper
    run: ./gradlew clean build -p ${{ matrix.module }} -x test

하지만 현재 구현도 충분히 명확합니다.


43-72: Docker 이미지 빌드 및 푸시 로직이 올바릅니다.

각 서비스에 대해 SHA와 latest 태그를 모두 생성하는 접근 방식이 적절합니다. SHA 태그는 추적성을, latest 태그는 편의성을 제공합니다.

선택적 개선: 반복 코드 감소

향후 유지보수성을 위해 매트릭스 전략을 사용하거나, 세 개의 이미지를 한 번에 처리하는 스크립트를 고려할 수 있습니다. 하지만 현재 구현도 명확하고 이해하기 쉽습니다.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 315cfaf and ed4b33a.

📒 Files selected for processing (1)
  • .github/workflows/cloud-dev-build-deploy.yml
🧰 Additional context used
🪛 actionlint (1.7.9)
.github/workflows/cloud-dev-build-deploy.yml

16-16: 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)


37-37: the runner of "docker/login-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


81-81: 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)

🔇 Additional comments (2)
.github/workflows/cloud-dev-build-deploy.yml (2)

3-7: 워크플로우 트리거 설정이 적절합니다.

develop 브랜치로의 push와 수동 실행을 모두 지원하는 설정이 올바르게 구성되어 있습니다.


83-92: SCP 단계가 올바르게 구성되었습니다.

docker-compose.yml 파일을 서버로 전송하는 설정이 적절하며, strip_components: 2를 통해 경로 구조를 올바르게 처리하고 있습니다.


steps:
- name: get repo from github
uses: actions/checkout@v3
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

액션 버전을 업데이트하세요.

actions/checkout@v3는 구버전입니다. GitHub Actions에서 더 이상 지원하지 않는 Node.js 버전을 사용합니다.

🔎 제안된 수정사항
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4

정적 분석 도구에 따름.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: actions/checkout@v3
uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.9)

16-16: 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)

🤖 Prompt for AI Agents
.github/workflows/cloud-dev-build-deploy.yml around line 16: the workflow uses
actions/checkout@v3 which is an older major version that can pull in unsupported
Node runtimes; update the action reference to the current stable major (e.g.,
actions/checkout@v4) in the workflow file, run a quick CI pass to confirm
compatibility, and adjust any workflow inputs if the new major changed defaults.

Comment on lines 37 to 40
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Docker 로그인 액션 버전을 업데이트하세요.

docker/login-action@v2는 구버전입니다. GitHub Actions에서 더 이상 지원하지 않는 Node.js 버전을 사용합니다.

🔎 제안된 수정사항
-        uses: docker/login-action@v2
+        uses: docker/login-action@v3

정적 분석 도구에 따름.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
🧰 Tools
🪛 actionlint (1.7.9)

37-37: the runner of "docker/login-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
.github/workflows/cloud-dev-build-deploy.yml lines 37-40: the workflow uses the
legacy docker/login-action@v2 which relies on an unsupported Node.js runtime;
update the action reference to the current major release (e.g.,
docker/login-action@v3) by replacing the uses line, keep the username/password
secrets as-is, and run the workflow to verify login succeeds and no Node runtime
warnings/errors remain.


steps:
- name: checkout repository
uses: actions/checkout@v3
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

액션 버전을 업데이트하세요.

actions/checkout@v3는 구버전입니다. v4로 업데이트해야 합니다.

🔎 제안된 수정사항
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4

정적 분석 도구에 따름.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: actions/checkout@v3
uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.9)

81-81: 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)

🤖 Prompt for AI Agents
.github/workflows/cloud-dev-build-deploy.yml around line 81: the workflow uses
actions/checkout@v3 which is outdated; update the step to use
actions/checkout@v4 by changing the action reference to v4, verify there are no
deprecated inputs or breaking changes for v4 in this workflow, and run the
workflow locally or in a branch to confirm it still checks out repository and
passes CI.

Comment on lines 94 to 108
- name: ssh to server and deploy
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SERVER_PORT }}
script: |
echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-api
echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-admin
echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-auth
echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml --env-file ${{ secrets.ENVIRONMENT_PATH }} up -d aics-api
echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml --env-file ${{ secrets.ENVIRONMENT_PATH }} up -d aics-admin
echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml --env-file ${{ secrets.ENVIRONMENT_PATH }} up -d aics-auth No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

심각한 보안 취약점 및 로직 오류를 수정하세요.

Lines 102-108에서 echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S 명령은 여러 문제가 있습니다:

  1. 보안 취약점: SSH 개인 키가 로그에 노출될 수 있습니다
  2. 로직 오류: sudo -S는 비밀번호를 기대하지만, SSH 개인 키는 비밀번호가 아닙니다. 이 명령은 실패할 가능성이 높습니다
  3. 근본적인 오해: SSH 개인 키와 sudo 비밀번호는 완전히 다른 인증 방식입니다

권장 해결 방법:

  1. 최선책: 배포 사용자에 대해 서버에서 passwordless sudo를 설정:

    # 서버의 /etc/sudoers.d/deploy-user 파일에 추가
    deploy-user ALL=(ALL) NOPASSWD: /usr/bin/docker-compose
  2. 대안: sudo 비밀번호가 필요한 경우, 별도의 SUDO_PASSWORD secret을 생성하고 사용:

    script: |
      echo "${{ secrets.SUDO_PASSWORD }}" | sudo -S docker-compose ...
🔎 passwordless sudo를 사용하는 제안된 수정사항
           script: |
-            echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-api
-            echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-admin
-            echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-auth
+            sudo docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-api
+            sudo docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-admin
+            sudo docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-auth
 
-            echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml --env-file ${{ secrets.ENVIRONMENT_PATH }} up -d aics-api
-            echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml --env-file ${{ secrets.ENVIRONMENT_PATH }} up -d aics-admin
-            echo "${{ secrets.SSH_PRIVATE_KEY }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml --env-file ${{ secrets.ENVIRONMENT_PATH }} up -d aics-auth
+            sudo docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml --env-file ${{ secrets.ENVIRONMENT_PATH }} up -d aics-api
+            sudo docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml --env-file ${{ secrets.ENVIRONMENT_PATH }} up -d aics-admin
+            sudo docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml --env-file ${{ secrets.ENVIRONMENT_PATH }} up -d aics-auth

중요: 이 수정을 적용하기 전에 EC2 서버에서 배포 사용자에 대한 passwordless sudo를 설정해야 합니다.

🤖 Prompt for AI Agents
.github/workflows/cloud-dev-build-deploy.yml lines 94-108: the workflow is
incorrectly echoing the SSH private key into sudo -S (which both leaks the
secret and misuses sudo), so remove any echo of the SSH key, stop passing
secrets into sudo -S, and update the deploy steps to use one of two safe
approaches: (A) configure the remote deploy user for passwordless sudo for
docker-compose (add an appropriate /etc/sudoers.d entry on the server) and call
sudo docker-compose ... without -S and without echoing secrets, or (B) if
passworded sudo is required, create a separate GitHub secret SUDO_PASSWORD and
echo that secret into sudo -S (not the SSH key) while keeping the
SSH_PRIVATE_KEY only for SSH authentication via the action; also ensure the
ssh-action uses the SSH_PRIVATE_KEY input only for connection and that no
private key is printed or stored in logs.

@JangYeongHu JangYeongHu marked this pull request as ready for review December 31, 2025 09:34
@JangYeongHu JangYeongHu changed the title chore: AWS 개발 서버 CD를 위한 workflow 추가 chore/KD-58: AWS 개발 서버 CD를 위한 workflow 추가 Dec 31, 2025
Copy link
Member

@LeeHanEum LeeHanEum left a comment

Choose a reason for hiding this comment

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

LGTM 👍

echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-api
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-admin
echo "${{ secrets.SERVER_PASSWORD }}" | sudo -S docker-compose -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/docker-compose.yml pull aics-auth
set -euo pipefail
Copy link
Member

Choose a reason for hiding this comment

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

요거는 처음 알았네요 👍


private static final Map<String, String> PROFILE_SERVER_URL_MAP = Map.of(
"dev", "https://aics-admin.ummdev.com",
"dev", "http://52.79.164.36:8081",
Copy link
Member

Choose a reason for hiding this comment

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

음 public ip가 외부로 드러나는게 좋은 상황은 아닌거 같아요.
환경변수 처리하거나 dns로 대체하는게 어떨까요?

Comment on lines 101 to 103
"http://52.79.164.36:8080",
"http://52.79.164.36:8081",
"http://52.79.164.36:8082",
Copy link
Member

Choose a reason for hiding this comment

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

cors address도 사실 외부에서 주입 받으면 좋을듯요

  1. 보안 이슈
  2. 하드 코딩 의존성

보통 이 두가지 때문에 yaml로 빼거나 환경변수로 분리하는 것 같아요

JangYeongHu added 2 commits January 1, 2026 02:00
@JangYeongHu JangYeongHu merged commit 42bedfb into develop Dec 31, 2025
5 checks passed
@JangYeongHu JangYeongHu deleted the chore/KD-58 branch December 31, 2025 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨refactor refactoring code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants