Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8ce0faf
[chore] AWS 관련 의존성 추가
KiSeungMin Jul 19, 2025
45aa645
[feat] 웨이블존 상세 정보 조회 시 방문 기록 저장 기능 구현
KiSeungMin Jul 19, 2025
3a6af0d
[feat] 웨이블존 추천 기능 JWT 인증 추가
KiSeungMin Jul 19, 2025
469de36
[feat] soft delete된 필드를 되살리는 로직 추가
KiSeungMin Jul 19, 2025
5d74fb2
[fix] user 데이터 중복으로 인한 테스트 코드 오류 해결
KiSeungMin Jul 21, 2025
5243f3f
[chore] 웨이블존 추천 service 로직의 일부 메서드를 private로 수정
KiSeungMin Jul 21, 2025
00f1bb1
[chore] 테스트 코드에서 불필요한 출력 코드 제거
KiSeungMin Jul 21, 2025
841ccac
[feat] Elastic Search 웨이블존 객체 장애 시설 정보 엔티티 추가
KiSeungMin Jul 21, 2025
9467274
[feat] Elastic Search dto에 장애 시설 정보 엔티티 추가
KiSeungMin Jul 21, 2025
9a17da3
[feat] Wayble Zone mapping.json 파일에 장애 시설 정보 인덱스 추가
KiSeungMin Jul 21, 2025
47b220e
[feat] 검색, 추천 쿼리 로직에서 장애 시설 정보 추가
KiSeungMin Jul 21, 2025
350df6c
[feat] 장애 시설 정보 api 응답 테스트 완료
KiSeungMin Jul 21, 2025
f33972f
[feat] 장애 시설 정보 api 응답 테스트 완료
KiSeungMin Jul 21, 2025
49aac1a
[feat] 지도 검색 기반 검색 api의 엔드포인트에 /maps 추가
KiSeungMin Jul 21, 2025
7faeda1
Merge branch 'develop' into feature/seungmin
KiSeungMin Jul 21, 2025
8b70d24
[feat] WaybleZoneDocument의 썸네일 이미지를 웨이블존 엔티티로부터 전달받도록 구현
KiSeungMin Jul 21, 2025
6d9e14c
[feat] 웨이블존 XX동 조회 로직 임시 구현 완료
KiSeungMin Jul 21, 2025
f40f4fb
[test] Elastic Search 배포 자동화 테스트 파일 작성
KiSeungMin Jul 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 43 additions & 5 deletions .github/workflows/cd-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,56 @@ jobs:
- name: Pull latest image from Docker Hub
run: sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/github-actions-demo:latest

- name: Stop existing container if any
- name: Stop existing containers if any
run: |
CONTAINER_ID=$(sudo docker ps -q --filter "name=github-actions-demo")
if [ ! -z "$CONTAINER_ID" ]; then
sudo docker stop $CONTAINER_ID
# Stop Spring Boot app container
APP_CONTAINER_ID=$(sudo docker ps -q --filter "name=github-actions-demo")
if [ ! -z "$APP_CONTAINER_ID" ]; then
sudo docker stop $APP_CONTAINER_ID
fi

# Stop Elasticsearch container
ES_CONTAINER_ID=$(sudo docker ps -q --filter "name=elasticsearch")
if [ ! -z "$ES_CONTAINER_ID" ]; then
sudo docker stop $ES_CONTAINER_ID
fi

Comment on lines +52 to +65

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

컨테이너 stoprm 누락 – 동일한 이름으로 새 컨테이너 실행 시 충돌
docker stop만 호출하면 컨테이너 이름이 여전히 예약돼 있어 이후 docker run --name … 단계에서 Conflict. The container name … is already in use 오류가 발생합니다. docker rm까지 수행해 이름을 해제해 주세요.

-          if [ ! -z "$APP_CONTAINER_ID" ]; then
-            sudo docker stop $APP_CONTAINER_ID
+          if [ ! -z "$APP_CONTAINER_ID" ]; then
+            sudo docker stop $APP_CONTAINER_ID
+            sudo docker rm  $APP_CONTAINER_ID
           fi
…
-          if [ ! -z "$ES_CONTAINER_ID" ]; then
-            sudo docker stop $ES_CONTAINER_ID
+          if [ ! -z "$ES_CONTAINER_ID" ]; then
+            sudo docker stop $ES_CONTAINER_ID
+            sudo docker rm  $ES_CONTAINER_ID
           fi
📝 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
- name: Stop existing containers if any
run: |
CONTAINER_ID=$(sudo docker ps -q --filter "name=github-actions-demo")
if [ ! -z "$CONTAINER_ID" ]; then
sudo docker stop $CONTAINER_ID
# Stop Spring Boot app container
APP_CONTAINER_ID=$(sudo docker ps -q --filter "name=github-actions-demo")
if [ ! -z "$APP_CONTAINER_ID" ]; then
sudo docker stop $APP_CONTAINER_ID
fi
# Stop Elasticsearch container
ES_CONTAINER_ID=$(sudo docker ps -q --filter "name=elasticsearch")
if [ ! -z "$ES_CONTAINER_ID" ]; then
sudo docker stop $ES_CONTAINER_ID
fi
- name: Stop existing containers if any
run: |
# Stop Spring Boot app container
APP_CONTAINER_ID=$(sudo docker ps -q --filter "name=github-actions-demo")
if [ ! -z "$APP_CONTAINER_ID" ]; then
sudo docker stop $APP_CONTAINER_ID
sudo docker rm $APP_CONTAINER_ID
fi
# Stop Elasticsearch container
ES_CONTAINER_ID=$(sudo docker ps -q --filter "name=elasticsearch")
if [ ! -z "$ES_CONTAINER_ID" ]; then
sudo docker stop $ES_CONTAINER_ID
sudo docker rm $ES_CONTAINER_ID
fi
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 59-59: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/cd-develop.yml around lines 52 to 65, after stopping the
containers with `docker stop`, the containers are not removed, causing name
conflicts when creating new containers with the same name. To fix this, add
`docker rm` commands after each `docker stop` to remove the stopped containers
and free up their names for reuse.

- name: Create Docker network if not exists
run: |
sudo docker network create wayble-network || true

- name: Run new container
- name: Run Elasticsearch container
run: |
sudo docker run -d \
--name elasticsearch \
--network wayble-network \
-p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e "xpack.security.enabled=false" \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
--restart unless-stopped \
docker.elastic.co/elasticsearch/elasticsearch:9.0.2

- name: Wait for Elasticsearch to be ready
run: |
echo "Waiting for Elasticsearch to start..."
for i in {1..30}; do
if curl -s http://localhost:9200/_health > /dev/null 2>&1; then
echo "Elasticsearch is ready!"
break
Comment on lines +85 to +88

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Elasticsearch 헬스 체크 엔드포인트 오류
/_health 엔드포인트는 존재하지 않습니다. 일반적으로 /_cluster/health 또는 _cluster/health?wait_for_status=yellow&timeout=... 를 사용합니다. 현 상태로는 5 분 타임아웃 후 앱 컨테이너가 실행돼도 ES 미기동 상태일 가능성이 큽니다.

-            if curl -s http://localhost:9200/_health > /dev/null 2>&1; then
+            if curl -s http://localhost:9200/_cluster/health > /dev/null 2>&1; then
📝 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
for i in {1..30}; do
if curl -s http://localhost:9200/_health > /dev/null 2>&1; then
echo "Elasticsearch is ready!"
break
for i in {1..30}; do
if curl -s http://localhost:9200/_cluster/health > /dev/null 2>&1; then
echo "Elasticsearch is ready!"
break
🤖 Prompt for AI Agents
In .github/workflows/cd-develop.yml around lines 85 to 88, the curl command
checks Elasticsearch health using a non-existent endpoint /_health. Replace this
with the correct endpoint /_cluster/health or use
/_cluster/health?wait_for_status=yellow&timeout=... to properly verify
Elasticsearch readiness before proceeding.

fi
echo "Waiting... ($i/30)"
sleep 10
done

- name: Run new Spring Boot container
run: |
sudo docker run -d --rm \
--name github-actions-demo \
--network wayble-network \
-p 8080:8080 \
-e "ELASTICSEARCH_HOST=elasticsearch" \
-e "ELASTICSEARCH_PORT=9200" \
${{ secrets.DOCKERHUB_USERNAME }}/github-actions-demo:latest

- name: Prune unused docker resources
Expand Down
153 changes: 153 additions & 0 deletions .github/workflows/test-elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Test Elasticsearch CI/CD

on:
workflow_dispatch: # 수동 실행 전용
push:
branches: [ "feature/seungmin" ] # 본인 브랜치에서만 실행

permissions:
contents: read

jobs:
# 1. 도커 이미지 빌드 및 푸시
build-docker-image:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: clean bootJar

- name: Docker build with test tag
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/wayble-test:latest .

- name: Docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}

- name: Push Docker image
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/wayble-test:latest

# 2. EC2에서 테스트 컨테이너 실행
test-elasticsearch-on-ec2:
needs: build-docker-image
runs-on: self-hosted

steps:
- name: Pull latest test image from Docker Hub
run: sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/wayble-test:latest

- name: Stop existing test containers if any
run: |
# Stop test app container
TEST_APP_CONTAINER_ID=$(sudo docker ps -q --filter "name=wayble-test-app")
if [ ! -z "$TEST_APP_CONTAINER_ID" ]; then
sudo docker stop $TEST_APP_CONTAINER_ID
sudo docker rm $TEST_APP_CONTAINER_ID
fi

# Stop test Elasticsearch container
TEST_ES_CONTAINER_ID=$(sudo docker ps -q --filter "name=elasticsearch-test")
if [ ! -z "$TEST_ES_CONTAINER_ID" ]; then
sudo docker stop $TEST_ES_CONTAINER_ID
sudo docker rm $TEST_ES_CONTAINER_ID
fi

- name: Create test Docker network if not exists
run: |
sudo docker network create wayble-test-network || true

- name: Run test Elasticsearch container
run: |
sudo docker run -d \
--name elasticsearch-test \
--network wayble-test-network \
-p 9201:9200 -p 9301:9300 \
-e "discovery.type=single-node" \
-e "xpack.security.enabled=false" \
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
docker.elastic.co/elasticsearch/elasticsearch:9.0.2

- name: Wait for test Elasticsearch to be ready
run: |
echo "Waiting for test Elasticsearch to start..."
for i in {1..30}; do
if curl -s http://localhost:9201/_cluster/health > /dev/null 2>&1; then
echo "Test Elasticsearch is ready!"
break
fi
echo "Waiting... ($i/30)"
sleep 10
done

- name: Run test Spring Boot container
run: |
sudo docker run -d \
--name wayble-test-app \
--network wayble-test-network \
-p 8081:8080 \
-e "ELASTICSEARCH_HOST=elasticsearch-test" \
-e "ELASTICSEARCH_PORT=9200" \
-e "SPRING_PROFILES_ACTIVE=develop" \
${{ secrets.DOCKERHUB_USERNAME }}/wayble-test:latest

- name: Test application health
run: |
echo "Waiting for application to start..."
sleep 30

# 애플리케이션 헬스체크
if curl -f http://localhost:8081/actuator/health > /dev/null 2>&1; then
echo "✅ Application is healthy!"
else
echo "❌ Application health check failed"
exit 1
fi

# Elasticsearch 연결 테스트
if curl -f http://localhost:9201/_cluster/health > /dev/null 2>&1; then
echo "✅ Elasticsearch is accessible!"
else
echo "❌ Elasticsearch connection failed"
exit 1
fi

- name: Cleanup test containers
if: always() # 성공/실패 관계없이 항상 실행
run: |
# 테스트 컨테이너들 정리
sudo docker stop wayble-test-app elasticsearch-test || true
sudo docker rm wayble-test-app elasticsearch-test || true
sudo docker network rm wayble-test-network || true

- name: Prune unused docker resources
run: sudo docker system prune -f

# ✅ 테스트 성공 알림
- name: Send test success notification
if: success()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"✅ Elasticsearch CI/CD 테스트 성공! 이제 develop에 머지해도 안전합니다.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}

# ❌ 테스트 실패 알림
- name: Send test failure notification
if: failure()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"❌ Elasticsearch CI/CD 테스트 실패! develop 머지 전에 수정이 필요합니다.\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
implementation 'jakarta.servlet:jakarta.servlet-api:6.0.0'
implementation 'com.amazonaws:aws-java-sdk-core:1.12.698'
implementation 'com.amazonaws:aws-java-sdk-s3:1.12.698'
Comment on lines +38 to +39

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

중복된 AWS SDK 의존성을 제거해주세요.

AWS SDK 의존성이 두 번 선언되어 있습니다:

  • 38-39번째 줄: 첫 번째 선언
  • 48-49번째 줄: 두 번째 선언 (주석과 함께)

이런 중복 선언은 빌드 설정의 혼란을 야기할 수 있습니다.

다음과 같이 중복을 제거해주세요:

 	implementation 'jakarta.servlet:jakarta.servlet-api:6.0.0'
-	implementation 'com.amazonaws:aws-java-sdk-core:1.12.698'
-	implementation 'com.amazonaws:aws-java-sdk-s3:1.12.698'
 	runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
 	runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
 
 	runtimeOnly 'com.mysql:mysql-connector-j'
 	compileOnly 'org.projectlombok:lombok'
 	annotationProcessor 'org.projectlombok:lombok'
 
     //AWS S3
 	implementation 'com.amazonaws:aws-java-sdk-core:1.12.698'
 	implementation 'com.amazonaws:aws-java-sdk-s3:1.12.698'

Also applies to: 48-49

🤖 Prompt for AI Agents
In build.gradle around lines 38-39 and 48-49, there are duplicate AWS SDK
dependencies declared for 'aws-java-sdk-core' and 'aws-java-sdk-s3'. Remove the
duplicate declarations on lines 48-49, keeping only one set of these
dependencies to avoid confusion in the build configuration.

runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'

Expand Down
45 changes: 45 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: '3.8'

services:
# Spring Boot 애플리케이션 (테스트용)
app-test:
build:
context: .
dockerfile: Dockerfile
container_name: wayble-app-test
ports:
- "8081:8080" # 다른 포트 사용
environment:
- SPRING_PROFILES_ACTIVE=develop
- ELASTICSEARCH_HOST=elasticsearch-test
- ELASTICSEARCH_PORT=9200
depends_on:
- elasticsearch-test
networks:
- test-network

# Elasticsearch (테스트용)
elasticsearch-test:
build:
context: .
dockerfile: Dockerfile.elasticsearch
container_name: elasticsearch-test
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- ES_JAVA_OPTS=-Xms512m -Xmx512m
ports:
- "9201:9200" # 다른 포트 사용
- "9301:9300"
volumes:
- es-test-data:/usr/share/elasticsearch/data
networks:
- test-network

networks:
test-network:
driver: bridge

volumes:
es-test-data:
driver: local
48 changes: 48 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: '3.8'

services:
# Spring Boot 애플리케이션
app:
build:
context: .
dockerfile: Dockerfile
container_name: wayble-app
restart: unless-stopped
ports:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=develop
- ELASTICSEARCH_HOST=elasticsearch
- ELASTICSEARCH_PORT=9200
depends_on:
- elasticsearch
networks:
- app-network

# Elasticsearch
elasticsearch:
build:
context: .
dockerfile: Dockerfile.elasticsearch
container_name: elasticsearch
image: es-with-nori:9.0.2
restart: unless-stopped
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- ES_JAVA_OPTS=-Xms512m -Xmx512m
ports:
- "9200:9200"
- "9300:9300"
volumes:
- esdata:/usr/share/elasticsearch/data
networks:
- app-network

networks:
app-network:
driver: bridge

volumes:
esdata:
driver: local
4 changes: 4 additions & 0 deletions src/main/java/com/wayble/server/common/entity/BaseEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ public class BaseEntity {

@Column(name = "deleted_at")
private LocalDateTime deletedAt;

public void restore() {
this.deletedAt = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class WaybleZoneSearchController {

private final WaybleZoneSearchService waybleZoneSearchService;

@GetMapping("")
@GetMapping("/maps")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

엔드포인트 경로 변경이 적절하게 구현되었습니다.

검색 API의 경로를 /maps로 변경하여 향후 추가될 TOP3 매장 조회 기능과 분리한 것은 좋은 설계 결정입니다. REST API의 리소스 구조가 더 명확해졌습니다.

기존 클라이언트나 테스트 코드에서 이 엔드포인트를 호출하는 부분이 있는지 확인해주세요:


🏁 Script executed:

#!/bin/bash
# 기존 엔드포인트 경로 사용 확인
echo "=== 테스트 코드에서 기존 경로 사용 확인 ==="
rg -A 3 -B 3 "/api/v1/wayble-zones/search\"" src/test/

echo "=== 전체 프로젝트에서 웨이블존 검색 API 호출 확인 ==="
rg -A 3 -B 3 "wayble-zones/search" --type java

echo "=== 새로운 /maps 경로 사용 확인 ==="
rg -A 3 -B 3 "search/maps" --type java

Length of output: 2563


REST 엔드포인트 경로 변경으로 인한 테스트 수정 필요

컨트롤러에서 엔드포인트를
GET /api/v1/wayble-zones/searchGET /api/v1/wayble-zones/search/maps
로 변경했으므로, 테스트 코드가 여전히 옛 경로를 참조해 실패합니다. 아래 파일을 수정해주세요:

  • src/test/java/com/wayble/server/explore/WaybleZoneSearchApiIntegrationTest.java
    - private static final String baseUrl = "/api/v1/wayble-zones/search";
    + private static final String baseUrl = "/api/v1/wayble-zones/search/maps";

위 수정 외에도 실제 클라이언트 호출이나 다른 테스트에서 구 경로를 참조하는 부분이 없는지 한번 더 검토 부탁드립니다.

🤖 Prompt for AI Agents
In
src/main/java/com/wayble/server/explore/controller/WaybleZoneSearchController.java
at line 24, the REST endpoint path was changed from GET
/api/v1/wayble-zones/search to GET /api/v1/wayble-zones/search/maps. Update all
test cases in
src/test/java/com/wayble/server/explore/WaybleZoneSearchApiIntegrationTest.java
to use the new endpoint path /api/v1/wayble-zones/search/maps. Additionally,
review other client calls and tests to ensure no references remain to the old
endpoint path and update them accordingly.

public CommonResponse<SearchSliceDto<WaybleZoneSearchResponseDto>> findByCondition(
@Valid @ModelAttribute WaybleZoneSearchConditionDto conditionDto,
@RequestParam(name = "page", defaultValue = "0") int page,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.wayble.server.explore.dto;

import com.wayble.server.explore.entity.EsWaybleZoneFacility;
import lombok.Builder;

@Builder
public record FacilityResponseDto(
Boolean hasSlope,
Boolean hasNoDoorStep,
Boolean hasElevator,
Boolean hasTableSeat,
Boolean hasDisabledToilet,
String floorInfo
) {
public static FacilityResponseDto from(EsWaybleZoneFacility facility) {
if (facility == null) {
return null;
}

return FacilityResponseDto.builder()
.hasSlope(facility.isHasSlope())
.hasNoDoorStep(facility.isHasNoDoorStep())
.hasElevator(facility.isHasElevator())
.hasTableSeat(facility.isHasTableSeat())
.hasDisabledToilet(facility.isHasDisabledToilet())
.floorInfo(facility.getFloorInfo())
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.wayble.server.explore.dto.recommend;

import com.wayble.server.explore.dto.FacilityResponseDto;
import com.wayble.server.explore.entity.WaybleZoneDocument;
import com.wayble.server.wayblezone.entity.WaybleZoneType;
import lombok.Builder;
Expand All @@ -23,6 +24,8 @@ public record WaybleZoneRecommendResponseDto(

Long reviewCount,

FacilityResponseDto facility,

Double distanceScore,

Double similarityScore,
Expand All @@ -42,6 +45,7 @@ public static WaybleZoneRecommendResponseDto from(WaybleZoneDocument waybleZoneD
.reviewCount(waybleZoneDocument.getReviewCount())
.latitude(waybleZoneDocument.getAddress().getLocation().getLat())
.longitude(waybleZoneDocument.getAddress().getLocation().getLon())
.facility(FacilityResponseDto.from(waybleZoneDocument.getFacility()))
.distanceScore(0.0)
.similarityScore(0.0)
.recencyScore(0.0)
Expand Down
Loading
Loading