Skip to content

Commit

Permalink
스크립트에 권한 추가 + nginx 설정 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
yujung7768903 committed Oct 1, 2024
1 parent cd99df6 commit 283f095
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
6 changes: 4 additions & 2 deletions appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user
destination: /home/ec2-user/backend
file_exists_behavior: OVERWRITE

hooks:
BeforeInstall:
- script: "chmod +x /home/ec2-user/backend/scripts/*.sh"
ApplicationStart:
- location: scripts/run_new_was.sh
timeout: 60
runas: root
runas: ec2-user
# - location: scripts/health_check.sh
# timeout: 60
# runas: ec2-user
Expand Down
22 changes: 11 additions & 11 deletions scripts/run_new_was.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ PROJECT_ROOT="/home/ec2-user/backend"
JAR_FILE="$PROJECT_ROOT/build/libs/backend-0.0.1-SNAPSHOT.jar"

CURRENT_PORT=$(cat /home/ec2-user/service_url.inc | grep -Po '[0-9]+' | tail -1)
TARGET_PORT=0

echo "> Current port of running WAS is ${CURRENT_PORT}."

if [ ${CURRENT_PORT} -eq 8081 ]; then
TARGET_PORT=8082
elif [ ${CURRENT_PORT} -eq 8082 ]; then
TARGET_PORT=8081
else
echo "> No WAS is connected to nginx"
fi
TARGET_PORT=8080

#echo "> Current port of running WAS is ${CURRENT_PORT}."
#
#if [ ${CURRENT_PORT} -eq 8081 ]; then
# TARGET_PORT=8082
#elif [ ${CURRENT_PORT} -eq 8082 ]; then
# TARGET_PORT=8081
#else
# echo "> No WAS is connected to nginx"
#fi

TARGET_PID=$(lsof -Fp -i TCP:${TARGET_PORT} | grep -Po 'p[0-9]+' | grep -Po '[0-9]+')

Expand Down

0 comments on commit 283f095

Please sign in to comment.