Skip to content
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

[Refactoring] Improve CI/CD performance with github-hosted runner #533

Closed
ChoHadam opened this issue Dec 4, 2023 · 0 comments · Fixed by #534 or #535
Closed

[Refactoring] Improve CI/CD performance with github-hosted runner #533

ChoHadam opened this issue Dec 4, 2023 · 0 comments · Fixed by #534 or #535
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@ChoHadam
Copy link
Member

ChoHadam commented Dec 4, 2023

리팩토링 배경

github action으로 CI/CD 진행시 서버 인스턴스 CPU가 급증하다가 100 가까이 치닫고 죽는 경우가 종종 발생합니다. 따라서 CI/CD에 사용되는 서버 리소스를 줄이고, 에러 발생시 추적이 가능하도록 에러 핸들링을 추가하고자합니다.

리팩토링 방법

⚠️ 리팩토링 과정에서 운영중인 서버에 영향을 주지 않도록, 테스트용 EC2 환경 및 Workflow 파일을 추가 구현해서 진행하였습니다.

Github Actions Workflow 파일 수정

  • 기존 Self-hosted runner를 사용한 배포에서, GitHub-hosted runner 사용 및 SSH 접속으로 배포하는 방식으로 변경합니다.

prebuild.sh 수정

  • Error handler와 조건문, 종료문을 추가했습니다.
  • ec2 서버 내 누락된 symbolic link를 추가함으로써 불필요한 npm install 명령어를 제거했습니다.
  • reload.sh에 있던 build 과정을 prebuild 과정에 추가했습니다.
    (추후 역할이 더욱 명확해지게끔 prebuild.sh 파일명을 변경하거나, build용 스크립트를 따로 분리합니다.)

reload.sh 수정

  • Error handler와 조건문, 종료문을 추가했습니다.
  • build 과정을 prebuild.sh로 옮겨 역할을 분명히 했습니다.

리팩토링 개선된 점

  • EC2 서버에 배포시 CPU 사용량100% 임박 > 10% 내외로 단축했습니다.
  • 빌드 및 배포 시간을 최대 30분 > 1분 이내로 단축했습니다.
  • Error handler 및 && 추가로 인해 오류를 즉시 감지하여 스크립트를 중단시킴으로써 안정성을 향상시켰습니다.
    이 과정에서 symbolic link 누락 문제를 발견하고 해결하였습니다.
  • 빌드 및 배포를 담당하는 스크립트들의 역할이 보다 명확해졌습니다.

관련 링크 / 참조

@ChoHadam ChoHadam self-assigned this Dec 4, 2023
@ChoHadam ChoHadam added bug Something isn't working enhancement New feature or request labels Dec 4, 2023
@ChoHadam ChoHadam changed the title [Refactoring] CI/CD 성능 개선 및 에러 핸들링 추가 [Refactoring] Improve CI/CD performance & Add Error handling Dec 4, 2023
@ChoHadam ChoHadam changed the title [Refactoring] Improve CI/CD performance & Add Error handling [Refactoring] Improve CI/CD performance with github-hosted runner Dec 4, 2023
@ChoHadam ChoHadam linked a pull request Dec 28, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
1 participant