-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEAT : add scripts for deploy and appspec file
- Loading branch information
1 parent
2923d43
commit 0ea1507
Showing
5 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 0.0 | ||
os: linux | ||
|
||
files: | ||
- source: / | ||
destination: /home/ubuntu/app | ||
hooks: | ||
ApplicationStop: | ||
- location: script/stop.sh | ||
timeout: 60 | ||
runas: root | ||
AfterInstall: | ||
- location: script/start.sh | ||
timeout: 60 | ||
runas: root |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 인스턴스에 클론 받은 디렉토리 이름을 `app`으로 바꿔야합니다. | ||
APPLICATION_PATH=/home/ubuntu/app | ||
# shellcheck disable=SC2164 | ||
cd $APPLICATION_PATH | ||
|
||
# shellcheck disable=SC2010 | ||
JAR_NAME=$(ls $APPLICATION_PATH/build/libs/ | grep '.jar' | tail -n 1) | ||
|
||
# shellcheck disable=SC2034 | ||
JAR_PATH=build/libs/$JAR_NAME | ||
JAR_PID=$(pgrep -f $JAR_NAME) | ||
|
||
if [ -z $JAR_PID ] | ||
then | ||
echo "> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다." | ||
else | ||
echo "> sudo kill -15 $JAR_PID" | ||
sudo kill -15 $JAR_PID | ||
sleep 10 | ||
fi | ||
|
||
echo "> $JAR_PATH 배포" #3 | ||
# shellcheck disable=SC2153 | ||
# shellcheck disable=SC2024 | ||
sudo nohup java -jar -Dspring.profiles.active=prod "$JAR_PATH" >nohup.out 2>&1 </dev/null & |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# shellcheck disable=SC2046 | ||
# shellcheck disable=SC2009 | ||
kill $(ps aux | grep java | grep -v grep | awk '{print $2}') | ||
echo "java stopped" |