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

Develop #7

Merged
merged 7 commits into from
Apr 26, 2024
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
7 changes: 7 additions & 0 deletions .github/workflows/testBeforePR.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@







name: Test Before PR

on:
Expand Down
18 changes: 18 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/action
overwrite: yes

permissions:
- object: /
pattern: "**"
owner: ec2-user
group: ec2-user

hooks:
ApplicationStart:
- location: scripts/deploy.sh
timeout: 60
runas: ec2-user
25 changes: 25 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

BUILD_JAR=$(ls /home/ec2-user/action/build/libs/*SNAPSHOT.jar)
JAR_NAME=$(basename $BUILD_JAR)
echo "## build file name : $JAR_NAME" >> /home/ec2-user/action/spring-deploy.log

echo "## copy build file" >> /home/ec2-user/action/spring-deploy.log
DEPLOY_PATH=/home/ec2-user/action/
cp $BUILD_JAR $DEPLOY_PATH

echo "## current pid" >> /home/ec2-user/action/spring-deploy.log
CURRENT_PID=$(ps -ef | grep "java" | awk 'NR==1 {print $2}')

if [ -z $CURRENT_PID ]
then
echo "## 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다." >> /home/ec2-user/action/spring-deploy.log
else
echo "## kill -15 $CURRENT_PID"
kill -15 $CURRENT_PID
sleep 5
fi

DEPLOY_JAR=$DEPLOY_PATH$JAR_NAME
echo "## deploy JAR file" >> /home/ec2-user/action/spring-deploy.log
nohup java -jar $DEPLOY_JAR >> /home/ec2-user/action/spring-deploy.log 2> /home/ec2-user/action/spring-deploy_err.log &
6 changes: 6 additions & 0 deletions src/main/java/Number.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public class Number {
private int num1;
public Number(){
num1=10;
}
}
Loading