Skip to content

feat: 부하 테스트 자동화 구성#30

Closed
lsy1307 wants to merge 3 commits intomainfrom
feat/loadtest-automation
Closed

feat: 부하 테스트 자동화 구성#30
lsy1307 wants to merge 3 commits intomainfrom
feat/loadtest-automation

Conversation

@lsy1307
Copy link
Copy Markdown
Contributor

@lsy1307 lsy1307 commented May 5, 2026

관련 이슈

작업 내용

  • 부하 테스트 시작 시 Terraform으로 loadtest 전용 RDS를 생성하도록 구성했습니다.
  • prod/stage EC2 보안 그룹에서 loadtest RDS 3306 포트로 접근할 수 있도록 RDS 보안 그룹 규칙을 구성했습니다.
  • loadtest RDS endpoint/username/password를 Parameter Store의 /solid-connection/loadtest/ 경로에 반영하도록 구성했습니다.
  • scripts/load_test/start.sh로 RDS 생성, stage 서버 loadtest 프로필 전환, prod RDS 데이터 복사를 자동화했습니다.
  • scripts/load_test/stop.sh로 stage 서버 dev 환경 원복과 loadtest RDS destroy를 자동화했습니다.
  • secret submodule의 loadtest tfvars 변경 커밋을 상위 repo submodule pointer에 반영했습니다.

실행 프로세스

Windows 기준

  1. Windows에서 WSL Ubuntu 또는 Git Bash를 실행합니다.
  2. 인프라 저장소로 이동합니다.
cd <solid-connection-infra 경로>
  1. AWS CLI 인증 상태와 필수 도구를 확인합니다.
aws sts get-caller-identity
terraform version
jq --version
ssh -V
  1. SSH key 경로를 본인 로컬 환경에 맞게 지정해서 부하 테스트를 시작합니다.
./scripts/load_test/start.sh \
  --switch-stage-to-loadtest \
  --stage-ssh-key <로컬 SSH key 경로>/solid-connection-server-2.pem

예시:

# WSL
--stage-ssh-key /mnt/c/Users/<사용자명>/Downloads/solid-connection-server-2.pem

# Git Bash
--stage-ssh-key /c/Users/<사용자명>/Downloads/solid-connection-server-2.pem
  1. 스크립트가 수행하는 작업은 다음과 같습니다.
  • Terraform init/apply로 loadtest RDS와 관련 보안 그룹/Parameter Store 값을 생성합니다.
  • stage EC2에 SSH로 접속해 solid-connection-dev 컨테이너를 dev,loadtest 프로필로 재기동합니다.
  • SSM RunCommand로 prod EC2에서 prod RDS dump를 생성하고 loadtest RDS에 restore합니다.
  1. 부하 테스트 종료 후 SSH key 경로를 본인 로컬 환경에 맞게 지정해서 원복합니다.
./scripts/load_test/stop.sh \
  --restore-stage-dev \
  --stage-ssh-key <로컬 SSH key 경로>/solid-connection-server-2.pem
  1. 종료 스크립트가 stage 서버를 기존 dev compose 구성으로 되돌리고 Terraform destroy로 loadtest RDS를 제거합니다.

macOS zsh 기준

  1. zsh 터미널에서 인프라 저장소로 이동합니다.
cd <solid-connection-infra 경로>
  1. AWS CLI 인증 상태와 필수 도구를 확인합니다.
aws sts get-caller-identity
terraform version
jq --version
ssh -V
  1. 부하 테스트 시작 시 start.sh를 실행합니다.
./scripts/load_test/start.sh \
  --switch-stage-to-loadtest \
  --stage-ssh-key <로컬 SSH key 경로>/solid-connection-server-2.pem

예시:

./scripts/load_test/start.sh \
  --switch-stage-to-loadtest \
  --stage-ssh-key <로컬 SSH key 경로>/solid-connection-server-2.pem
  1. 부하 테스트 종료 후 stop.sh를 실행합니다.
./scripts/load_test/stop.sh \
  --restore-stage-dev \
  --stage-ssh-key <로컬 SSH key 경로>/solid-connection-server-2.pem

특이 사항

  • terraform applyterraform destroy는 각각 start.sh, stop.sh 내부에서 실행됩니다.
  • stage 서버는 부하 테스트 중 loadtest RDS를 바라보도록 재기동되므로, 해당 시간에는 일반 stage 검증과 겹치지 않게 조율이 필요합니다.
  • loadtest RDS는 public 접근을 허용하지 않고 prod/stage EC2 보안 그룹에서만 MySQL 접근을 허용합니다.
  • prod RDS 데이터 복사는 prod EC2에서 SSM RunCommand로 실행됩니다.
  • 실제 secret 값은 secret submodule에서 관리하며 PR 본문에는 포함하지 않았습니다.

리뷰 요구사항 (선택)

  • loadtest RDS 생성/삭제 범위가 비용과 운영 요구사항에 맞는지 확인해 주세요.
  • prod 데이터 dump/restore를 prod EC2에서 수행하는 방식이 운영 정책에 맞는지 확인해 주세요.
  • stage 서버를 dev,loadtest 프로필로 전환하는 방식이 서버 설정 우선순위와 맞는지 확인해 주세요.

lsy1307 added 3 commits May 6, 2026 01:07
- 상세내용: 부하 테스트 실행에 필요한 secret submodule 변경 커밋을 상위 인프라 저장소에 반영
- 상세내용: 부하 테스트용 RDS, 보안 그룹, SSM datasource 파라미터를 Terraform으로 정의

- 상세내용: prod/stage EC2 보안 그룹에서 loadtest RDS 3306 접근을 허용하도록 구성
- 상세내용: start.sh에서 RDS 생성, stage 전환, prod 데이터 복사를 자동화

- 상세내용: stop.sh에서 stage 원복과 loadtest RDS destroy 흐름을 제공

- 상세내용: Windows와 macOS/Linux 실행 환경에서 사용할 bash 기반 절차를 문서화
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Important

Review skipped

Auto 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.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ef1c5be8-d8ee-446d-80c3-4d96a6baf143

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/loadtest-automation

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.

@lsy1307 lsy1307 closed this May 5, 2026
@lsy1307 lsy1307 deleted the feat/loadtest-automation branch May 5, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 부하테스트용 terrafrom 환경 생성

1 participant