fix: 로컬에서 사용하는 로거 설정 (#44) #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Develop Server | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
deploy: | |
runs-on: [ self-hosted ] | |
environment: develop | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: CheckOut | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Test with Gradle Wrapper | |
run: ./gradlew build | |
- name: Copy JAR to Local | |
run: | | |
mkdir -p /home/ubuntu/app | |
cp build/libs/*-SNAPSHOT.jar /home/ubuntu/app/server.jar | |
- name: Copy application-dev.yml to Local | |
run: | | |
echo "${{ secrets.APPLICATION_YML }}" > /home/ubuntu/app/application-dev.yml | |
- name: Stop Existing Application | |
run: | | |
set -x | |
PID=$(pgrep -f "server.jar" || true) | |
if [ -n "$PID" ]; then | |
echo "Stopping existing application..." | |
sudo kill -9 $PID | |
else | |
echo "No existing application found." | |
fi | |
- name: Run Application | |
run: | | |
echo "Creating logs directory..." | |
mkdir -p /home/ubuntu/app/logs | |
echo "Starting new application..." | |
sudo nohup java -Dspring.profiles.active=dev \ | |
-Dspring.config.location=/home/ubuntu/app/application-dev.yml \ | |
-Duser.timezone=Asia/Seoul \ | |
-Dlogging.file.path=/home/ubuntu/app/logs \ | |
-jar /home/ubuntu/app/server.jar & |