Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 프로덕션 환경 분리 위한 설정파일 및 스크립트 분리 #215

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions backend/deploy-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
PROJECT_NAME=zipgo-backend

echo '> development 서버를 실행합니다'
echo '> 현재 구동중인 애플리케이션 PID 확인'
CURRENT_PID=$(sudo netstat -lntp | grep 8081 | awk '{print $7}' | cut -d'/' -f1)

echo "현재 구동중인 애플리케이션 PID: $CURRENT_PID"

if [ -z "$CURRENT_PID" ]; then
echo "> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다."
else
echo "> kill -15 $CURRENT_PID"
sudo kill -15 $CURRENT_PID
sleep 5
if ps -p $CURRENT_PID > /dev/null; then
echo "> 애플리케이션을 다시 종료합니다."
sudo kill -9 $CURRENT_PID
else
echo "> 프로세스 아이디 $CURRENT_PID 가 성공적으로 종료되었습니다."
fi
fi

sudo chmod +x zipgo-backend-0.0.1-SNAPSHOT.jar
sudo nohup java -jar \
-Dspring.profiles.active=dev \
-Dspring.config.import=env.properties \
zipgo-backend-0.0.1-SNAPSHOT.jar > ~/application.log 2>&1 &
3 changes: 2 additions & 1 deletion backend/deploy.sh → backend/deploy-prod.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh
PROJECT_NAME=zipgo-backend

echo '> production 서버를 실행합니다'
echo '> 현재 구동중인 애플리케이션 PID 확인'
CURRENT_PID=$(sudo netstat -lntp | grep 8080 | awk '{print $7}' | cut -d'/' -f1)

Expand All @@ -22,6 +23,6 @@ fi

sudo chmod +x zipgo-backend-0.0.1-SNAPSHOT.jar
sudo nohup java -jar \
-Dspring.profiles.active=dev \
-Dspring.profiles.active=prod \
-Dspring.config.import=env.properties \
zipgo-backend-0.0.1-SNAPSHOT.jar > ~/application.log 2>&1 &
5 changes: 5 additions & 0 deletions backend/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
# port
server:
port: 8081

---
# database
spring:
Expand Down
5 changes: 5 additions & 0 deletions backend/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
# port
server:
port: 8080

---
# database
spring:
Expand Down