-
Notifications
You must be signed in to change notification settings - Fork 1
fix: 오픈 API 비동기 호출로 인한 Too Many Requests Error 발생 #73
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
Changes from all commits
1872cd6
3cadd15
0541ad4
dd89326
6ef83f7
e7bf181
42f4299
754a3a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # ============================================================================= | ||
| # Local Development Environment Configuration | ||
| # ============================================================================= | ||
| # 로컬 개발 환경용 설정 파일 | ||
| # | ||
| # 사용법: | ||
| # 1. 이 파일을 .env.local로 복사하세요 | ||
| # 2. 필요한 값들을 채워넣으세요 | ||
| # 3. docker-compose -f docker-compose.local.yml up --build 로 실행하세요 | ||
| # ============================================================================= | ||
|
|
||
| # ============================================================================= | ||
| # Application Configuration | ||
| # ============================================================================= | ||
| SERVER_PORT=8080 | ||
| SPRING_PROFILES_ACTIVE=local | ||
|
|
||
| # ============================================================================= | ||
| # Database Configuration | ||
| # ============================================================================= | ||
| # 로컬 MySQL 사용 시 (Docker로 MySQL 실행하는 경우) | ||
| DB_IP=host.docker.internal # Docker 컨테이너에서 호스트 머신 접근 | ||
| # DB_IP=localhost # 호스트 머신에서 직접 실행 시 | ||
| DB_PORT=3306 | ||
| DB_SCHEMA=devnogi | ||
| DB_USER=root | ||
| DB_PASSWORD=your_local_password | ||
|
|
||
| # ============================================================================= | ||
| # Security Configuration (로컬 개발용 - 운영 환경과 다른 값 사용) | ||
| # ============================================================================= | ||
| JWT_SECRET_KEY=local-development-secret-key-do-not-use-in-production-change-this | ||
| JWT_ACCESS_TOKEN_VALIDITY=3600000 # 1시간 (밀리초) | ||
| JWT_REFRESH_TOKEN_VALIDITY=86400000 # 24시간 (밀리초) | ||
|
|
||
| # ============================================================================= | ||
| # External API Configuration | ||
| # ============================================================================= | ||
| # Nexon Open API 키 (https://openapi.nexon.com/에서 발급) | ||
| NEXON_OPEN_API_KEY=your_nexon_api_key_here | ||
|
|
||
| # 경매 데이터 수집 설정 | ||
| AUCTION_HISTORY_DELAY_MS=1000 # API 호출 간 딜레이 (1초) | ||
| AUCTION_HISTORY_CRON=0 0 * * * * # 매시간 정각에 실행 (초 분 시 일 월 요일) | ||
| AUCTION_HISTORY_MIN_PRICE_CRON=0 30 * * * * # 매시간 30분에 실행 | ||
|
|
||
| # ============================================================================= | ||
| # Docker Configuration (로컬 개발에서는 불필요) | ||
| # ============================================================================= | ||
| # DOCKER_USERNAME=your_dockerhub_username | ||
| # DOCKER_PASSWORD=your_dockerhub_password | ||
| # DOCKER_REPO=open-api-batch-server | ||
| # DOCKER_IMAGE_TAG=local | ||
|
|
||
| # ============================================================================= | ||
| # JVM Memory Configuration (로컬 개발용 - 메모리 사용량 감소) | ||
| # ============================================================================= | ||
| # Heap Memory - 로컬에서는 적은 메모리로 실행 | ||
| JAVA_OPTS_XMS=256m # 초기 힙 메모리 | ||
| JAVA_OPTS_XMX=512m # 최대 힙 메모리 | ||
|
|
||
| # Non-Heap Memory | ||
| JAVA_OPTS_MAX_METASPACE_SIZE=128m # Metaspace 최대 크기 | ||
| JAVA_OPTS_RESERVED_CODE_CACHE_SIZE=64m # JIT 컴파일된 코드 캐시 | ||
| JAVA_OPTS_MAX_DIRECT_MEMORY_SIZE=64m # Direct Buffer 최대 크기 | ||
| JAVA_OPTS_XSS=512k # 스레드 스택 크기 | ||
|
|
||
| # ============================================================================= | ||
| # JVM GC Configuration (G1GC) | ||
| # ============================================================================= | ||
| JAVA_OPTS_MAX_GC_PAUSE_MILLIS=200 # GC 일시정지 목표 시간 | ||
| JAVA_OPTS_G1_HEAP_REGION_SIZE=1m # G1 힙 영역 크기 | ||
| JAVA_OPTS_INITIATING_HEAP_OCCUPANCY_PERCENT=45 # GC 시작 힙 점유율 | ||
|
|
||
| # ============================================================================= | ||
| # JVM Compiler Configuration | ||
| # ============================================================================= | ||
| # 로컬 개발에서는 빠른 시작을 위해 TieredStopAtLevel=1 (C1 컴파일러만 사용) | ||
| JAVA_OPTS_TIERED_STOP_AT_LEVEL=1 # 1: 빠른 시작, 4: 최적 성능 | ||
| JAVA_OPTS_CI_COMPILER_COUNT=2 # 컴파일러 스레드 수 | ||
|
|
||
| # ============================================================================= | ||
| # Docker Container Resource Limits (로컬 개발용) | ||
| # ============================================================================= | ||
| DOCKER_MEMORY_LIMIT=1g # 컨테이너 최대 메모리 | ||
| DOCKER_MEMORY_RESERVATION=512m # 예약 메모리 | ||
|
|
||
| # ============================================================================= | ||
| # Container Restart Policy | ||
| # ============================================================================= | ||
| RESTART_POLICY_MAX_RETRIES=3 # 실패 시 최대 재시작 횟수 | ||
|
|
||
| # ============================================================================= | ||
| # Health Check Configuration (로컬 개발용 - 더 짧은 간격) | ||
| # ============================================================================= | ||
| HEALTHCHECK_INTERVAL=30s # 헬스 체크 주기 | ||
| HEALTHCHECK_TIMEOUT=10s # 헬스 체크 타임아웃 | ||
| HEALTHCHECK_RETRIES=3 # 연속 실패 횟수 | ||
| HEALTHCHECK_START_PERIOD=60s # 시작 유예 기간 | ||
|
|
||
| # ============================================================================= | ||
| # Autoheal Configuration | ||
| # ============================================================================= | ||
| AUTOHEAL_INTERVAL=30 # unhealthy 체크 주기 (초) | ||
| AUTOHEAL_START_PERIOD=0 # 체크 시작 유예 시간 | ||
| AUTOHEAL_DEFAULT_STOP_TIMEOUT=10 # 재시작 시 강제 종료 대기 시간 | ||
| AUTOHEAL_MEMORY_LIMIT=50M # autoheal 최대 메모리 | ||
| AUTOHEAL_MEMORY_RESERVATION=20M # autoheal 예약 메모리 | ||
|
|
||
| # ============================================================================= | ||
| # Logging Configuration | ||
| # ============================================================================= | ||
| LOGGING_MAX_SIZE=10m # 로그 파일 최대 크기 | ||
| LOGGING_MAX_FILE=3 # 로그 파일 보관 개수 | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -91,7 +91,7 @@ jobs: | |||||
| run: | | ||||||
| ssh -i ~/.ssh/my-key.pem ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} "mkdir -p /home/${{ secrets.SERVER_USER }}/app/logs" | ||||||
|
|
||||||
| - name: Copy docker-compose.yaml to server | ||||||
| - name: Copy docker-compose-dev.yaml to server | ||||||
| run: | | ||||||
| scp -i ~/.ssh/my-key.pem docker-compose.yaml ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:/home/${{ secrets.SERVER_USER }}/app/ | ||||||
|
||||||
| scp -i ~/.ssh/my-key.pem docker-compose.yaml ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:/home/${{ secrets.SERVER_USER }}/app/ | |
| scp -i ~/.ssh/my-key.pem docker-compose-dev.yaml ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}:/home/${{ secrets.SERVER_USER }}/app/ |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -92,7 +92,7 @@ jobs: | |||||
| run: | | ||||||
| ssh -i ~/.ssh/my-key.pem ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_HOST }} "mkdir -p /home/${{ secrets.PROD_SERVER_USER }}/app/logs" | ||||||
|
|
||||||
| - name: Copy docker-compose.yaml to server | ||||||
| - name: Copy docker-compose-dev.yaml to server | ||||||
|
||||||
| - name: Copy docker-compose-dev.yaml to server | |
| - name: Copy docker-compose.yaml to server |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The step name says 'Copy docker-compose-dev.yaml' but the actual command copies 'docker-compose.yaml'. This mismatch will cause the deployment to fail as the file being copied doesn't exist in the repository. Change the filename in the scp command to 'docker-compose-dev.yaml'.
| scp -i ~/.ssh/my-key.pem docker-compose.yaml ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_HOST }}:/home/${{ secrets.PROD_SERVER_USER }}/app/ | |
| scp -i ~/.ssh/my-key.pem docker-compose-dev.yaml ${{ secrets.PROD_SERVER_USER }}@${{ secrets.PROD_SERVER_HOST }}:/home/${{ secrets.PROD_SERVER_USER }}/app/ |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -42,3 +42,62 @@ | |||||
| - **Git branch 전략**: Git-flow [관련 블로그](https://velog.io/@kw2577/Git-branch-%EC%A0%84%EB%9E%B5) | ||||||
|
|
||||||
| <br> | ||||||
|
|
||||||
| ### 🐳 로컬 개발 환경 (Docker) | ||||||
|
|
||||||
| 로컬에서 코드를 수정하면서 개발할 때는 Docker Hub에 푸시하지 않고 로컬 빌드로 실행할 수 있습니다. | ||||||
|
|
||||||
| #### 1. 환경 설정 | ||||||
|
|
||||||
| ```bash | ||||||
| # .env.local.sample을 복사하여 .env.local 생성 | ||||||
| cp .env.local.sample .env.local | ||||||
|
|
||||||
| # .env.local 파일을 열어서 필요한 값들을 수정 | ||||||
| # - NEXON_OPEN_API_KEY: Nexon Open API 키 입력 | ||||||
| # - DB_PASSWORD: 로컬 MySQL 비밀번호 입력 | ||||||
| # - 기타 필요한 설정 수정 | ||||||
| ``` | ||||||
|
|
||||||
| #### 2. 로컬에서 Docker로 실행 | ||||||
|
|
||||||
| ```bash | ||||||
| # 로컬 코드를 빌드하고 Docker 컨테이너로 실행 | ||||||
| docker-compose -f docker-compose-local.yml up --build | ||||||
|
|
||||||
| # 백그라운드 실행 | ||||||
| docker-compose -f docker-compose-local.yml up -d --build | ||||||
|
|
||||||
| # 로그 확인 | ||||||
| docker-compose -f docker-compose-local.yml logs -f spring-app | ||||||
|
|
||||||
| # 중지 | ||||||
| docker-compose -f docker-compose-local.yml down | ||||||
| ``` | ||||||
|
|
||||||
| #### 3. 코드 수정 후 재실행 | ||||||
|
|
||||||
| ```bash | ||||||
| # 코드 수정 후 다시 빌드하여 실행 | ||||||
| docker-compose -f docker-compose-local.yml up --build | ||||||
|
|
||||||
| # 또는 기존 컨테이너 정리 후 재실행 | ||||||
| docker-compose -f docker-compose-local.yml down | ||||||
| docker-compose -f docker-compose-local.yml up --build | ||||||
| ``` | ||||||
|
|
||||||
| #### 4. 환경별 실행 방법 | ||||||
|
|
||||||
| | 환경 | Docker Compose 파일 | 설명 | | ||||||
| |------|---------------------|------| | ||||||
| | **로컬 개발** | `docker-compose.local.yml` | 로컬 코드 빌드, 낮은 리소스 사용 | | ||||||
|
||||||
| | **로컬 개발** | `docker-compose.local.yml` | 로컬 코드 빌드, 낮은 리소스 사용 | | |
| | **로컬 개발** | `docker-compose-local.yml` | 로컬 코드 빌드, 낮은 리소스 사용 | |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation states that DB_IP=host.docker.internal is used to access MySQL on the host machine, but according to the docker-compose-local.yml (line 31), it's set to mysql which refers to the MySQL container service name, not the host. This documentation is inconsistent with the actual implementation. Update to reflect that the local setup uses a containerized MySQL service.
| - **데이터베이스**: `DB_IP=host.docker.internal`로 호스트 머신의 MySQL에 접근 | |
| - **데이터베이스**: `DB_IP=mysql`로 Docker Compose의 MySQL 컨테이너에 접근 (`mysql`은 서비스 이름) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
.env.local.samplesuggests usingDB_IP=host.docker.internalfor accessing a MySQL on the host machine, butdocker-compose-local.ymlline 30 overrides this withDB_IP: mysql(the Docker service name) in the environment section. This configuration in the sample file will be ignored and may confuse users. Update the comment to clarify that the MySQL service is included in the compose file and the DB_IP is overridden.