Skip to content

Commit 80b0ff2

Browse files
committed
[test] 에러 로그 저장 테스트
1 parent 9d051e3 commit 80b0ff2

File tree

3 files changed

+43
-22
lines changed

3 files changed

+43
-22
lines changed

.github/workflows/cd-develop.yml

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: CI/CD
22

33
on:
4-
# push:
5-
# branches: [ "feature/seungmin" ]
4+
push:
5+
branches: [ "feature/seungmin" ]
66

77
#push:
88
# branches: [ "feature/seungin" ]
@@ -69,16 +69,19 @@ jobs:
6969
run: |
7070
echo "🧹 Cleaning up all existing containers"
7171
72-
# Stop and remove specific containers
72+
# Stop and remove specific containers (로그는 볼륨에 보존됨)
7373
sudo docker stop github-actions-demo || true
7474
sudo docker rm github-actions-demo || true
7575
7676
sudo docker stop elasticsearch || true
7777
sudo docker rm elasticsearch || true
7878
79+
echo "📋 Ensuring log directory exists on host"
80+
sudo mkdir -p /var/log/wayble
81+
sudo chmod 755 /var/log/wayble
7982
80-
echo "🧯 Cleaning up unused Docker networks"
81-
sudo docker system prune -f || true
83+
echo "🧯 Cleaning up unused Docker networks (excluding volumes)"
84+
sudo docker system prune -f --volumes=false || true
8285
8386
- name: Create Docker network if not exists
8487
run: |
@@ -184,23 +187,35 @@ jobs:
184187
exit 1
185188
fi
186189
190+
# 로그 파일 상태 확인
191+
echo "=== Log Directory Status ==="
192+
ls -la /var/log/wayble/ || echo "Log directory not found"
193+
194+
if [ -f "/var/log/wayble/wayble-error.log" ]; then
195+
echo "✅ Error log file exists"
196+
echo "📊 Error log file size: $(du -h /var/log/wayble/wayble-error.log | cut -f1)"
197+
echo "📅 Last modified: $(stat -c %y /var/log/wayble/wayble-error.log)"
198+
else
199+
echo "ℹ️ No error log file yet (normal for new deployment)"
200+
fi
201+
187202
# ✅ 배포 성공 알림 (Discord)
188-
- name: Send success webhook to Discord
189-
if: success()
190-
run: |
191-
curl -H "Content-Type: application/json" \
192-
-X POST \
193-
-d "{\"content\": \"✅ EC2 배포 성공!\"}" \
194-
${{ secrets.DISCORD_WEBHOOK_URL }}
195-
196-
# ❌ 배포 실패 알림 (Discord)
197-
- name: Send failure webhook to Discord
198-
if: failure()
199-
run: |
200-
curl -H "Content-Type: application/json" \
201-
-X POST \
202-
-d "{\"content\": \"❌ EC2 배포 실패! 확인이 필요합니다.\"}" \
203-
${{ secrets.DISCORD_WEBHOOK_URL }}
203+
# - name: Send success webhook to Discord
204+
# if: success()
205+
# run: |
206+
# curl -H "Content-Type: application/json" \
207+
# -X POST \
208+
# -d "{\"content\": \"✅ EC2 배포 성공!\"}" \
209+
# ${{ secrets.DISCORD_WEBHOOK_URL }}
210+
#
211+
# # ❌ 배포 실패 알림 (Discord)
212+
# - name: Send failure webhook to Discord
213+
# if: failure()
214+
# run: |
215+
# curl -H "Content-Type: application/json" \
216+
# -X POST \
217+
# -d "{\"content\": \"❌ EC2 배포 실패! 확인이 필요합니다.\"}" \
218+
# ${{ secrets.DISCORD_WEBHOOK_URL }}
204219

205220

206221

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ FROM openjdk:17
66
# 인자 설정 - JAR_File
77
ARG JAR_FILE=build/libs/*.jar
88

9+
# 로그 디렉토리 생성 및 권한 설정
10+
RUN mkdir -p /app/logs && chmod 755 /app/logs
11+
12+
# 작업 디렉토리 설정
13+
WORKDIR /app
14+
915
# jar 파일 복제
1016
COPY ${JAR_FILE} app.jar
1117

src/main/resources/logback-spring.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<maxFileSize>50MB</maxFileSize>
3535
<maxHistory>90</maxHistory>
3636
<totalSizeCap>1GB</totalSizeCap>
37-
<cleanHistoryOnStart>true</cleanHistoryOnStart>
37+
<cleanHistoryOnStart>false</cleanHistoryOnStart>
3838
</rollingPolicy>
3939
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
4040
<pattern>[%d{yyyy-MM-dd HH:mm:ss}] [%thread] %-5level %logger{36} - %msg%n%ex{2}</pattern>

0 commit comments

Comments
 (0)