-
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.
๐ท github action ๋ฐฐํฌ ์ฝ๋ ์ถ๊ฐ (#9)
* ๐ท Create main.yml * ๐ท aws s3 codedeploy ์ถ๊ฐ * ๐ท create appspec.yml * ๐ท Create deploy-before.sh * ๐ท ๋ฒํท๋ช ๋ณ๊ฒฝ * ๐ท codedeploy ๋ณ๊ฒฝ * ๐ท deploy-before ์ฌ์ฉ์๋ช ์์ * ๐ท deploy ์คํฌ๋ฆฝํธ ์ถ๊ฐ * ๐ท codedeploy script ์์ * ๐ท Update deploy.sh * ๐ท ๋ฐฐํฌ jar ํ์ผ ์ด๋ฆ ๋ช ์ * ๐ท port ๋ณ๊ฒฝ * ๐ท appspec ํ์์๋ ์ฝ๋ ์ญ์ * ๐ท log ํด๋ ์์ฑ * ๐ท file_exists_behavior ์ค์ * ๐ท log ํด๋ ์์น ์์ * ๐ท log ํด๋ mkdir * ๐ท add test code * ๐ท deploy jar log ์์ * ๐ท ์ด์ง ์์ * ๐ท test2 * Update MemberController.java * ๐ท project_name ๋ณ๊ฒฝ * ๐ท destination ๊ฒฝ๋ก ๋ณ๊ฒฝ * ๐ท ํ์ผ destination ๋ณ๊ฒฝ * ํ ์คํธ
- Loading branch information
Showing
5 changed files
with
89 additions
and
11 deletions.
There are no files selected for viewing
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
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,16 @@ | ||
version: 0.0 | ||
os: linux | ||
files: | ||
- source: / | ||
destination: /home/ubuntu/aloha-spring-backend2/ | ||
file_exists_behavior: OVERWRITE | ||
permissions: | ||
- object: / | ||
owner: ubuntu | ||
group: ubuntu | ||
mode: 755 | ||
|
||
hooks: | ||
ApplicationStart: | ||
- location: scripts/deploy.sh | ||
runas: ubuntu |
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,4 @@ | ||
if [ -d /home/ubuntu/build ]; then | ||
sudo rm -rf /home/ubuntu/build/ | ||
fi | ||
sudo mkdir -vp /home/ubuntu/build/ |
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,44 @@ | ||
#!/bin/bash | ||
PROJECT_NAME="aloha-spring-backend2" | ||
JAR_PATH="/home/ubuntu/$PROJECT_NAME/build/libs/aloha-spring-backend-0.0.1-SNAPSHOT.jar" | ||
DEPLOY_PATH=/home/ubuntu/$PROJECT_NAME/ | ||
DEPLOY_LOG_DIR_PATH="/home/ubuntu/$PROJECT_NAME/log" | ||
DEPLOY_LOG_PATH="/home/ubuntu/$PROJECT_NAME/log/deploy.log" | ||
DEPLOY_ERR_LOG_PATH="/home/ubuntu/$PROJECT_NAME/log/deploy_err.log" | ||
APPLICATION_LOG_PATH="/home/ubuntu/$PROJECT_NAME/log/application.log" | ||
BUILD_JAR=$(ls $JAR_PATH) | ||
JAR_NAME=$(basename $BUILD_JAR) | ||
|
||
|
||
echo "===== ๋ฐฐํฌ ์์ : $(date +%c) =====" >> $DEPLOY_LOG_PATH | ||
|
||
echo "> build ํ์ผ๋ช : $JAR_NAME" >> $DEPLOY_LOG_PATH | ||
echo "> build ํ์ผ ๋ณต์ฌ" >> $DEPLOY_LOG_PATH | ||
cp $BUILD_JAR $DEPLOY_PATH | ||
|
||
echo "> ํ์ฌ ๋์์ค์ธ ์ดํ๋ฆฌ์ผ์ด์ pid ์ฒดํฌ" >> $DEPLOY_LOG_PATH | ||
CURRENT_PID=$(pgrep -f $JAR_NAME) | ||
|
||
if [ -z $CURRENT_PID ] | ||
then | ||
echo "> ํ์ฌ ๋์์ค์ธ ์ดํ๋ฆฌ์ผ์ด์ ์กด์ฌ X" >> $DEPLOY_LOG_PATH | ||
else | ||
echo "> ํ์ฌ ๋์์ค์ธ ์ดํ๋ฆฌ์ผ์ด์ ์กด์ฌ O" >> $DEPLOY_LOG_PATH | ||
echo "> ํ์ฌ ๋์์ค์ธ ์ดํ๋ฆฌ์ผ์ด์ ๊ฐ์ ์ข ๋ฃ ์งํ" >> $DEPLOY_LOG_PATH | ||
echo "> kill -9 $CURRENT_PID" >> $DEPLOY_LOG_PATH | ||
kill -9 $CURRENT_PID | ||
fi | ||
|
||
cd $DEPLOY_PATH | ||
|
||
./gradlew build | ||
|
||
DEPLOY_JAR=$DEPLOY_PATH$JAR_NAME | ||
# echo "> DEPLOY_JAR ๋ฐฐํฌ" >> $DEPLOY_JAR | ||
mkdir $DEPLOY_LOG_DIR_PATH | ||
|
||
nohup java -jar -Dspring.profiles.active=local $JAR_PATH --server.port=8080 >> $APPLICATION_LOG_PATH 2> $DEPLOY_ERR_LOG_PATH & | ||
|
||
sleep 3 | ||
|
||
# echo "> ๋ฐฐํฌ ์ข ๋ฃ : $(date +%c)" >> $DEPLOY_LOG_PATH |
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