File tree 7 files changed +105
-22
lines changed
7 files changed +105
-22
lines changed Original file line number Diff line number Diff line change
1
+ name : Deploy to AWS CodeDeploy
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+
8
+ jobs :
9
+ deploy :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - name : Checkout code
14
+ uses : actions/checkout@v3
15
+
16
+ - name : Set up JDK 17
17
+ uses : actions/setup-java@v3
18
+ with :
19
+ distribution : ' zulu'
20
+ java-version : ' 17'
21
+
22
+ - name : Grant execute permission for gradlew
23
+ run : chmod +x gradlew
24
+
25
+ - name : Build Spring Boot application
26
+ run : ./gradlew clean build -x test
27
+
28
+ - name : Configure AWS credentials
29
+ uses : aws-actions/configure-aws-credentials@v1
30
+ with :
31
+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
32
+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
33
+ aws-region : ap-northeast-2
34
+
35
+ - name : Upload S3
36
+ run : aws deploy push
37
+ --application-name LikeKNU-Job
38
+ --ignore-hidden-files
39
+ --s3-location s3://like-knu-job-bucket/job-archive/$GITHUB_SHA.zip
40
+ --source .
41
+
42
+ - name : Deploy EC2
43
+ run : aws deploy create-deployment
44
+ --application-name LikeKNU-Job
45
+ --deployment-config-name CodeDeployDefault.AllAtOnce
46
+ --deployment-group-name LikeKNU-Job-Deployment-group
47
+ --s3-location bucket=like-knu-job-bucket,key=job-archive/$GITHUB_SHA.zip,bundleType=zip
Original file line number Diff line number Diff line change 37
37
.vscode /
38
38
39
39
/src /main /resources /application-dev.properties
40
+ /src /main /resources /application-prod.properties
40
41
41
42
/src /main /resources /static /firebase /likeknu-2023-firebase-adminsdk-ehw5i-31d25209d8.json
42
43
Original file line number Diff line number Diff line change
1
+ version : 0.0
2
+ os : linux
3
+
4
+ files :
5
+ - source : /
6
+ destination : /home/ubuntu/job-deploy
7
+ overwrite : yes
8
+
9
+ permissions :
10
+ - object : /
11
+ owner : ubuntu
12
+ group : ubuntu
13
+
14
+ hooks :
15
+ AfterInstall :
16
+ - location : scripts/stop.sh
17
+ timeout : 60
18
+ ApplicationStart :
19
+ - location : scripts/start.sh
20
+ timeout : 60
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ plugins {
5
5
}
6
6
7
7
group = ' ac.knu'
8
- version = ' 0 .0.1-SNAPSHOT '
8
+ version = ' 1 .0.0 '
9
9
10
10
java {
11
11
sourceCompatibility = ' 17'
@@ -21,6 +21,10 @@ repositories {
21
21
mavenCentral()
22
22
}
23
23
24
+ jar {
25
+ enabled = false
26
+ }
27
+
24
28
dependencies {
25
29
implementation ' org.springframework.boot:spring-boot-starter-amqp'
26
30
implementation ' org.springframework.boot:spring-boot-starter-data-jpa'
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ ROOT_PATH=" /home/ubuntu/job-deploy"
4
+ JAR=" $ROOT_PATH /job-application.jar"
5
+
6
+ APP_LOG=" $ROOT_PATH /job-application.log"
7
+ ERROR_LOG=" $ROOT_PATH /error.log"
8
+ START_LOG=" $ROOT_PATH /start.log"
9
+
10
+ NOW=$( date +%c)
11
+
12
+ echo " [$NOW ] $JAR 복사" >> $START_LOG
13
+ cp $ROOT_PATH /build/libs/LikeKNU-JobServer-1.0.0.jar $JAR
14
+
15
+ echo " [$NOW ] > $JAR 실행" >> $START_LOG
16
+ nohup java -jar $JAR > $APP_LOG 2> $ERROR_LOG &
17
+
18
+ SERVICE_PID=$( pgrep -f $JAR )
19
+ echo " [$NOW ] > 서비스 PID: $SERVICE_PID " >> $START_LOG
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ ROOT_PATH=" /home/ubuntu/job-deploy"
4
+ JAR=" $ROOT_PATH /job-application.jar"
5
+ STOP_LOG=" $ROOT_PATH /stop.log"
6
+ SERVICE_PID=$( pgrep -f $JAR )
7
+
8
+ if [ -z " $SERVICE_PID " ]; then
9
+ echo " 서비스 NotFound" >> $STOP_LOG
10
+ else
11
+ echo " 서비스 종료 " >> $STOP_LOG
12
+ kill -9 " $SERVICE_PID "
13
+ fi
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments