Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
51a7ff4
feat: User Entity 생성 및 UserPrincipal 세팅
Darren4641 Dec 11, 2025
2d12b11
feat: ExceptionHandler 및 BaseResponse 세팅
Dec 12, 2025
44486c9
feat: Swagger 403/500 이슈 해결 및 auth 패키지 분리
Dec 17, 2025
9ba35f5
fix: spotlessApply
Dec 17, 2025
f6b4721
fix: @Repository 제거
Dec 18, 2025
2deb263
fix: security 관련 설정 user 패키지로 이동
Dec 18, 2025
d4c38eb
fix: User Entity 및 repository 관련 파일 user 패키지로 이동
Dec 18, 2025
ce812e4
fix: spotless 적용
Dec 18, 2025
41ae93d
feat: Jasypt 설정 추가
Darren4641 Dec 23, 2025
3667def
feat: kakao oauth idToken 발급 로직 추가 (테스트용)
Darren4641 Dec 23, 2025
f17b055
Merge branch 'staging' into feat/#7
Dec 26, 2025
aac77eb
fix: UseCase 어노테이션 추가 및 디렉토리 구조 변경
Dec 26, 2025
c427ed1
feat: kakao oauth oidc 추출
Darren4641 Dec 28, 2025
a426592
feat: k3s 배포를 위한 Dockerfile 생성
Dec 29, 2025
e683508
feat: 카카오 OIDC 회원가입 기능 구현
Dec 29, 2025
7670b92
Merge branch 'staging' into feat/#7
Dec 29, 2025
febdc20
feat: 예외 addMessage 메서드 제거
Dec 29, 2025
44ac306
refactor: signup -> register 네이밍 변경
Dec 29, 2025
b5f663d
fix: transactionRunner 추가
Dec 29, 2025
08211f7
fix: spotless 적용
Dec 29, 2025
1d101ad
fix: login 기능 구현 1차
Dec 30, 2025
7cb12fe
fix: refreshToken 발행 추가
Dec 31, 2025
5cc5655
fix: refreshToken을 통해 accessToken 갱신 API 추가
Jan 2, 2026
a732f84
fix: JasyptConfig profile 지정
Jan 2, 2026
85caa33
feat: CustomerUserDetailService 제거 (불필요)
Darren4641 Jan 3, 2026
74b7f72
Merge branch 'staging' into feat/#7
Darren4641 Jan 3, 2026
5c47ead
feat: spotless 적용
Darren4641 Jan 3, 2026
a0a498f
feat: converter 적용
Darren4641 Jan 4, 2026
36f57ad
feat: E2E TEST 코드 추가
Darren4641 Jan 4, 2026
4229c2a
feat: E2E TEST 코드 추가
Darren4641 Jan 4, 2026
50dfc34
fix: JasyptTest 테스트코드 yml 의존성 제거
Darren4641 Jan 4, 2026
2d7e099
feat: ci discord 알림 추가
Darren4641 Jan 4, 2026
b385dbb
ci: 빌드 최적화
Darren4641 Jan 4, 2026
c98470b
ci: k3s 강제 재시작 적용
Darren4641 Jan 4, 2026
41c0886
fix: kakao oauth nativeID로 변경
Darren4641 Jan 4, 2026
76224ac
ci: 배포후 downtime 0로 변경 (health check 추가)
Darren4641 Jan 5, 2026
552cf64
fix: app.version 공통 application.yaml로 이동
Darren4641 Jan 5, 2026
3547cb7
fix: JasyptUtil 파일 제거
Jan 6, 2026
5203d51
fix: RestClientConfig 파일 infra 디렉토리로 이동
Jan 6, 2026
3bf18d0
fix: OIDCPublicKeysResponse 변수 var -> val 변경
Jan 6, 2026
2fc6be2
fix: KakaoClientResponse 주석 제거
Jan 6, 2026
02d31cc
fix: Valid 어노테이션 @field로 변경
Jan 9, 2026
feb2d32
fix: contract 디렉토리 생성 후 response 이동
Jan 9, 2026
f077349
fix: ci yaml staging 브랜치로 변경
Jan 9, 2026
20935dd
Merge branch 'staging' into feat/#7
Jan 9, 2026
a6fbf29
fix: spotlessApply 적용
Jan 9, 2026
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
51 changes: 51 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Git
.git
.gitignore
.gitattributes
.github

# Gradle
.gradle
build/
!build/libs/*.jar
!gradle/wrapper/gradle-wrapper.jar
!gradle/wrapper/gradle-wrapper.properties

# IDE
.idea
*.iml
*.iws
*.ipr
.vscode
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db

# Logs
*.log

# Local data
postgres_data/
localstack_data/

# Docker
Dockerfile
.dockerignore
docker-compose.yaml

# Documentation
README.md
*.md

# Kotlin
.kotlin

# Test
src/test/

# Misc
Makefile
222 changes: 222 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
name: Deploy to Staging (K3s)

on:
push:
branches:
- staging
workflow_dispatch: # 수동 실행 가능

jobs:
build-and-deploy:
name: Build, Test and Deploy to K3s
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run tests
run: ./gradlew test --no-daemon

- name: Build with Gradle
run: ./gradlew bootJar --no-daemon -x test

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract version
id: version
run: |
VERSION=$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{print $2}')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "short_sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/yapp-dev:${{ steps.version.outputs.version }}-${{ steps.version.outputs.short_sha }}
${{ secrets.DOCKER_USERNAME }}/yapp-dev:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Discord notification - Deployment started
if: success()
run: |
curl -H "Content-Type: application/json" \
-d '{
"embeds": [{
"title": "🚀 Staging 배포 시작",
"description": "K3s 배포를 시작합니다",
"color": 3447003,
"fields": [
{
"name": "브랜치",
"value": "'"${{ github.ref_name }}"'",
"inline": true
},
{
"name": "커밋",
"value": "'"${{ steps.version.outputs.short_sha }}"'",
"inline": true
},
{
"name": "작성자",
"value": "'"${{ github.actor }}"'",
"inline": true
},
{
"name": "버전",
"value": "'"${{ steps.version.outputs.version }}-${{ steps.version.outputs.short_sha }}"'",
"inline": false
},
{
"name": "커밋 메시지",
"value": "'"$(git log -1 --pretty=%B | head -n 1)"'",
"inline": false
}
],
"timestamp": "'"$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK_URL }}

- name: Deploy to K3s (On-premise) with Zero-Downtime
id: deploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
echo "🚀 Starting Zero-Downtime deployment to K3s..."

# K3s deployment 디렉토리로 이동
cd /home/yapp/k3s/staging

# 현재 실행 중인 이미지 확인
CURRENT_IMAGE=$(kubectl get deployment yapp-app-staging -n staging -o jsonpath='{.spec.template.spec.containers[0].image}' 2>/dev/null || echo "none")
echo "📌 Current image: $CURRENT_IMAGE"

# 이미지 태그 업데이트
NEW_IMAGE="${{ secrets.DOCKER_USERNAME }}/yapp-dev:${{ steps.version.outputs.version }}-${{ steps.version.outputs.short_sha }}"
echo "📦 New image: $NEW_IMAGE"
sed -i "s|image: .*yapp-dev:.*|image: $NEW_IMAGE|g" deployment.yaml

# K3s에 배포 적용 (Rolling Update 자동 실행)
echo "🔄 Applying deployment... Rolling update will start automatically"
kubectl apply -f deployment.yaml

# 배포 상태 확인 (새 파드가 완전히 준비될 때까지 대기)
echo "⏳ Waiting for new pods to be ready..."
if kubectl rollout status deployment/yapp-app-staging -n staging --timeout=10m; then
echo "✅ Rollout completed successfully!"

# 배포된 파드 정보 확인
echo "📊 Pod status:"
kubectl get pods -n staging -l app=yapp-app-staging

# 최종 이미지 확인
DEPLOYED_IMAGE=$(kubectl get deployment yapp-app-staging -n staging -o jsonpath='{.spec.template.spec.containers[0].image}')
echo "✅ Deployment completed! Deployed image: $DEPLOYED_IMAGE"
else
echo "❌ Rollout failed or timed out!"
kubectl get pods -n staging -l app=yapp-app-staging
exit 1
fi

- name: Discord notification - Deployment success
if: success()
run: |
curl -H "Content-Type: application/json" \
-d '{
"embeds": [{
"title": "✅ Staging 배포 성공",
"description": "K3s 배포가 성공적으로 완료되었습니다",
"color": 5763719,
"fields": [
{
"name": "브랜치",
"value": "'"${{ github.ref_name }}"'",
"inline": true
},
{
"name": "커밋",
"value": "'"${{ steps.version.outputs.short_sha }}"'",
"inline": true
},
{
"name": "작성자",
"value": "'"${{ github.actor }}"'",
"inline": true
},
{
"name": "배포 버전",
"value": "'"${{ steps.version.outputs.version }}-${{ steps.version.outputs.short_sha }}"'",
"inline": false
},
{
"name": "배포 링크",
"value": "[GitHub Actions](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})",
"inline": false
}
],
"timestamp": "'"$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK_URL }}

- name: Discord notification - Deployment failed
if: failure()
run: |
curl -H "Content-Type: application/json" \
-d '{
"embeds": [{
"title": "❌ Staging 배포 실패",
"description": "K3s 배포 중 오류가 발생했습니다",
"color": 15158332,
"fields": [
{
"name": "브랜치",
"value": "'"${{ github.ref_name }}"'",
"inline": true
},
{
"name": "커밋",
"value": "'"${{ steps.version.outputs.short_sha }}"'",
"inline": true
},
{
"name": "작성자",
"value": "'"${{ github.actor }}"'",
"inline": true
},
{
"name": "실패 로그",
"value": "[GitHub Actions 확인](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})",
"inline": false
}
],
"timestamp": "'"$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK_URL }}
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Layer extraction stage
FROM eclipse-temurin:21-jre-alpine AS builder

WORKDIR /app

# GitHub Actions에서 빌드된 JAR 파일 복사
COPY build/libs/*.jar app.jar

# Spring Boot Layered JAR에서 레이어 추출
RUN java -Djarmode=layertools -jar app.jar extract

# Runtime stage
FROM eclipse-temurin:21-jre-alpine

WORKDIR /app

# 보안을 위해 non-root 사용자 생성
RUN addgroup -S spring && adduser -S spring -G spring

# 레이어별로 복사 (변경 빈도가 낮은 순서대로)
# 1. dependencies: 외부 라이브러리 (거의 변경 안 됨)
COPY --from=builder --chown=spring:spring /app/dependencies/ ./

# 2. spring-boot-loader: Spring Boot 로더
COPY --from=builder --chown=spring:spring /app/spring-boot-loader/ ./

# 3. snapshot-dependencies: SNAPSHOT 의존성
COPY --from=builder --chown=spring:spring /app/snapshot-dependencies/ ./

# 4. application: 애플리케이션 코드 (자주 변경됨)
COPY --from=builder --chown=spring:spring /app/application/ ./

# non-root 사용자로 전환
USER spring:spring

# 환경변수 설정 (기본값, 런타임에 오버라이드 가능)
ENV SPRING_PROFILES_ACTIVE=staging
ENV JASYPT_PASSWORD=""

# 애플리케이션 실행
# Layered JAR는 org.springframework.boot.loader.launch.JarLauncher를 사용
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies {
// Spring Boot
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-actuator")

// Kotlin
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
Expand Down Expand Up @@ -137,3 +138,10 @@ tasks.withType<Test> {
tasks.jar {
enabled = false
}

tasks.bootJar {
// Spring Boot Layered JAR 활성화 (Docker 캐싱 최적화)
layered {
enabled = true
}
}
Loading