Skip to content

Commit a6b0ef2

Browse files
authored
feat: Spring Actuator 보안 강화 및 Prometheus 메트릭 수집 기능 구현 (#107)
* [BOOK-277] chore: apis, infra - infra 관련 yml 생성 및 aop logging 설정 infra yml로 이동 * [BOOK-277] chore: infra - LoggingAopProperties 클래스 Config 패키지로 이동 * [BOOK-277] chore: actuator 의존성 gateway에만 할당 및 prometheus 의존성 추가 * [BOOK-277] chore: infra - LoggingAopProperties의 패키지 이동으로 인한 import문 변동사항 반영 * [BOOK-277] chore: yml 파일 구체화 및 테스트 환경 더미 환경변수 값 추가 * [BOOK-277] chore: CI/CD - test secret 파일 삭제 - 테스트 환경변수는 yml에서 더미 값으로 관리 * [BOOK-277] refactor: gateway - ConfigurationProperties 파일을 구현하여 기존 @value 기반 프로퍼티 주입 방식을 개선 * [BOOK-277] feat: gateway - actuator-path를 화이트리스트에 추가 * [BOOK-277] chore: gateway - favicon.ico를 화이트리스트에 추가 - 불필요한 warn 로깅 방지 * [BOOK-277] refactor: buildSrc, gateway - 코드레빗 리뷰 반영 * [BOOK-277] chore: CI/CD - prod 성공/실패 여부 discord 웹훅 연동 * [BOOK-277] chore: CI/CD - transition 값 문자열로 전달
1 parent 849172e commit a6b0ef2

File tree

25 files changed

+208
-68
lines changed

25 files changed

+208
-68
lines changed

.github/workflows/ci-pr.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
mkdir ./secret
3131
echo "${{ secrets.DEV_SECRET_PROPERTIES }}" > ./secret/application-dev-secret.properties
3232
echo "${{ secrets.PROD_SECRET_PROPERTIES }}" > ./secret/application-prod-secret.properties
33-
echo "${{ secrets.TEST_SECRET_PROPERTIES }}" > ./secret/application-test-secret.properties
3433
echo "${{ secrets.APPLE_AUTH_KEY }}" > ./secret/AuthKey.p8
3534
chmod 600 ./secret/*
3635

.github/workflows/close-jira-issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
uses: atlassian/gajira-transition@v3
3030
with:
3131
issue: ${{ env.JIRA_KEY }}
32-
transition: 31
32+
transition: "31"

.github/workflows/dev-ci-cd.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
run: |
2929
mkdir ./secret
3030
echo "${{ secrets.DEV_SECRET_PROPERTIES }}" > ./secret/application-dev-secret.properties
31-
echo "${{ secrets.TEST_SECRET_PROPERTIES }}" > ./secret/application-test-secret.properties
3231
echo "${{ secrets.APPLE_AUTH_KEY }}" > ./secret/AuthKey.p8
3332
chmod 600 ./secret/*
3433

.github/workflows/prod-ci-cd.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
run: |
2929
mkdir ./secret
3030
echo "${{ secrets.PROD_SECRET_PROPERTIES }}" > ./secret/application-prod-secret.properties
31-
echo "${{ secrets.TEST_SECRET_PROPERTIES }}" > ./secret/application-test-secret.properties
3231
echo "${{ secrets.APPLE_AUTH_KEY }}" > ./secret/AuthKey.p8
3332
chmod 600 ./secret/*
3433
@@ -80,3 +79,29 @@ jobs:
8079
cd ~/deploy
8180
chmod +x ./deploy.sh
8281
./deploy.sh
82+
83+
- name: Send Discord notification on success
84+
if: success()
85+
uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645
86+
with:
87+
webhook-url: ${{ secrets.PROD_DEPLOY_DISCORD_WEBHOOK_URL }}
88+
content: "🚀 **Production Deploy Succeeded!**"
89+
embed-title: "✅ [${{ github.repository }}] Release **${{ github.event.release.tag_name }}**"
90+
embed-description: |
91+
**Released by**: `${{ github.actor }}`
92+
The new version has been successfully deployed to production.
93+
[View Release Notes](https://github.com/${{ github.repository }}/releases/tag/${{ github.event.release.tag_name }})
94+
embed-color: 65280 # Green
95+
96+
- name: Send Discord notification on failure
97+
if: failure()
98+
uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645
99+
with:
100+
webhook-url: ${{ secrets.PROD_DEPLOY_DISCORD_WEBHOOK_URL }}
101+
content: "🚨 **Production Deploy Failed!**"
102+
embed-title: "❌ [${{ github.repository }}] Release **${{ github.event.release.tag_name }}**"
103+
embed-description: |
104+
**Released by**: `${{ github.actor }}`
105+
An error occurred during the production deployment workflow.
106+
[View Failed Workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
107+
embed-color: 16711680 # Red

admin/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ dependencies {
88
implementation(Dependencies.Spring.BOOT_STARTER_WEB)
99
implementation(Dependencies.Spring.BOOT_STARTER_SECURITY)
1010
implementation(Dependencies.Spring.BOOT_STARTER_VALIDATION)
11-
implementation(Dependencies.Spring.BOOT_STARTER_ACTUATOR)
1211
testImplementation(Dependencies.Spring.BOOT_STARTER_TEST)
1312

1413
implementation(Dependencies.Database.MYSQL_CONNECTOR)

apis/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ dependencies {
1010
implementation(Dependencies.Spring.BOOT_STARTER_DATA_JPA)
1111
implementation(Dependencies.Spring.BOOT_STARTER_SECURITY)
1212
implementation(Dependencies.Spring.BOOT_STARTER_VALIDATION)
13-
implementation(Dependencies.Spring.BOOT_STARTER_ACTUATOR)
1413
implementation(Dependencies.Spring.BOOT_STARTER_OAUTH2_CLIENT)
1514

1615
implementation(Dependencies.Database.MYSQL_CONNECTOR)

apis/src/main/resources/application.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,25 @@ spring:
99
group:
1010
dev:
1111
- persistence
12+
- crosscutting
1213
- jwt
14+
- web
1315
- redis
1416
- external
1517
prod:
1618
- persistence
19+
- crosscutting
1720
- jwt
21+
- web
1822
- redis
1923
- external
2024
test:
2125
- persistence
26+
- crosscutting
2227
- jwt
28+
- web
29+
- redis
30+
- external
2331
servlet:
2432
multipart:
2533
max-file-size: 10MB
@@ -66,7 +74,6 @@ springdoc:
6674
---
6775
spring:
6876
config:
69-
import: optional:file:../secret/application-test-secret.properties
7077
activate:
7178
on-profile: test
7279

@@ -75,18 +82,3 @@ springdoc:
7582
enabled: false
7683
api-docs:
7784
enabled: false
78-
79-
aladin:
80-
api:
81-
ttb-key: dummy-aladin-key
82-
83-
oauth:
84-
kakao:
85-
admin-key: DUMMYADMINKEY
86-
apple:
87-
client-id: dummy.client.id
88-
key-id: DUMMYKEYID
89-
team-id: DUMMYTEAMID
90-
key-path: "path-ignored-by-mock"
91-
audience: https://appleid.apple.com
92-

batch/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ dependencies {
88
implementation(Dependencies.Spring.BOOT_STARTER_WEB)
99
implementation(Dependencies.Spring.BOOT_STARTER_SECURITY)
1010
implementation(Dependencies.Spring.BOOT_STARTER_VALIDATION)
11-
implementation(Dependencies.Spring.BOOT_STARTER_ACTUATOR)
1211
testImplementation(Dependencies.Spring.BOOT_STARTER_TEST)
1312

1413
implementation(Dependencies.Database.MYSQL_CONNECTOR)

buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,8 @@ object Dependencies {
6666
const val BC_PROV = "org.bouncycastle:bcprov-jdk18on:1.78.1"
6767
const val BC_PKIX = "org.bouncycastle:bcpkix-jdk18on:1.78.1"
6868
}
69+
70+
object Prometheus {
71+
const val MICROMETER_PROMETHEUS_REGISTRY = "io.micrometer:micrometer-registry-prometheus"
72+
}
6973
}

gateway/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ dependencies {
55
implementation(Dependencies.Spring.BOOT_STARTER_WEB)
66
implementation(Dependencies.Spring.BOOT_STARTER_SECURITY)
77
implementation(Dependencies.Spring.BOOT_STARTER_OAUTH2_RESOURCE_SERVER)
8+
implementation(Dependencies.Spring.BOOT_STARTER_ACTUATOR)
9+
10+
implementation(Dependencies.Prometheus.MICROMETER_PROMETHEUS_REGISTRY)
11+
812
testImplementation(Dependencies.Spring.BOOT_STARTER_TEST)
913
}
1014

0 commit comments

Comments
 (0)