Skip to content

Commit

Permalink
[INTERNAL] 로거 설정, 배포 설정 추가.
Browse files Browse the repository at this point in the history
  • Loading branch information
dongseoki committed Nov 14, 2023
1 parent c69ff8c commit 8566e3a
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,7 @@ tasks.named('test') {
//}
//compileQuerydsl {
// options.annotationProcessorPath = configurations.querydsl
//}
//}
jar {
enabled = false
}
2 changes: 2 additions & 0 deletions server/releasenote.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Release 0.1.0
- 릴리즈 노트 최초 생성.
51 changes: 51 additions & 0 deletions server/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

REPOSITORY=/home/ec2-user/apps
PROJECT_NAME=trackdayb

cd $REPOSITORY/$PROJECT_NAME/

echo "> Git reset --hard"
git reset --hard

echo "> Git Pull"

git pull

echo "Release Version Updated"
grep "^Release" ./releasenote.txt | tail -1 > ./src/main/frontend/public/latestReleaseVer.txt


echo "> gradlew, deploy.sh 권한 변경 "
chmod 777 gradlew
chmod 774 scripts/deploy.sh

echo "> 프로젝트 Build 시작"
./gradlew build

echo "> Build 파일 복사"

cp ./build/libs/*.jar $REPOSITORY/

echo "> 현재 구동중인 애플리케이션 pid 확인"

CURRENT_PID=$(pgrep -f ${PROJECT_NAME}.*.jar)

echo "$CURRENT_PID"

if [ -z "$CURRENT_PID" ]; then
echo "> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다."
else
echo "> kill -2 $CURRENT_PID"
sudo kill -9 "$CURRENT_PID"
sleep 5
fi

echo "> 새 어플리케이션 배포"

# JAR_NAME=$(ls $REPOSITORY/ |grep jar | tail -n 1)
JAR_NAME=$(ls $REPOSITORY/ |grep ${PROJECT_NAME}.*.jar | tail -n 1)

echo "> JAR Name: $JAR_NAME"

nohup java -jar $REPOSITORY/"$JAR_NAME" &
46 changes: 46 additions & 0 deletions server/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<!--로그 파일 저장 위치-->
<property name="LOGS_PATH" value="./logs"/>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm} %highlight(%-5level) %cyan(%logger{36}) - %msg%n</Pattern>
</layout>
</appender>
<appender name="DAILY_ROLLING_FILE_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOGS_PATH}/logback.log</file>
<encoder>
<pattern>[%d{yyyy-MM-dd HH:mm:ss}:%-3relative][%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- <fileNamePattern>${LOGS_PATH}/logback.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> -->
<fileNamePattern>${LOGS_PATH}/logback.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>5MB</maxFileSize>
<!-- kb, mb, gb -->
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>

<logger name="com.bside.bside_311" level="DEBUG">
<appender-ref ref="DAILY_ROLLING_FILE_APPENDER"/>
<appender-ref ref="STDOUT"/>
</logger>
<root level="INFO">
<appender-ref ref="DAILY_ROLLING_FILE_APPENDER"/>
<appender-ref ref="STDOUT"/>
</root>

<logger name="jdbc" level="OFF"/>
<logger name="jdbc.sqlonly" level="OFF"/>
<logger name="jdbc.sqltiming" level="DEBUG"/>
<logger name="jdbc.audit" level="OFF"/>
<logger name="jdbc.resultset" level="OFF"/>
<logger name="jdbc.resultsettable" level="DEBUG"/>
<logger name="jdbc.connection" level="OFF"/>

</configuration>

0 comments on commit 8566e3a

Please sign in to comment.