Skip to content

Commit

Permalink
Merge pull request #206 from softeerbootcamp-2nd/dev
Browse files Browse the repository at this point in the history
dev를 main으로 merge
  • Loading branch information
tank3a committed Aug 13, 2023
2 parents 7f24613 + 3f1d84f commit 69959f1
Show file tree
Hide file tree
Showing 269 changed files with 15,763 additions and 14 deletions.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/✏️-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: "✏️ ISSUE"
about: 이슈 작업 사항을 입력해주세요.
title: "[FE] main task 작업 내용 {- sub task 번호}"
labels: ''
assignees: ''

---

## Description

<!-- 설명을 추가해 주세요. -->

## Todo

<!-- 작업할 내용을 추가해 주세요. -->

- [ ] 작업1

## etc
25 changes: 25 additions & 0 deletions .github/backend/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
BUILD_JAR=$(ls /home/ubuntu/cicdproject/build/libs/*.jar)
JAR_NAME=$(basename $BUILD_JAR)
echo "> build 파일명: $JAR_NAME" >> /home/ubuntu/cicdproject/deploy.log

echo "> build 파일 복사" >> /home/ubuntu/cicdproject/deploy.log
DEPLOY_PATH=/home/ubuntu/cicdproject/
cp $BUILD_JAR $DEPLOY_PATH

echo "> 현재 실행중인 애플리케이션 pid 확인" >> /home/ubuntu/cicdproject/deploy.log
CURRENT_PID=$(pgrep -f $JAR_NAME)

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

DEPLOY_JAR=$DEPLOY_PATH$JAR_NAME
echo "> DEPLOY_JAR 배포" >> /home/ubuntu/cicdproject/deploy.log
chmod +x $DEPLOY_JAR
nohup java -jar $DEPLOY_JAR >> /home/ubuntu/deploy.log 2>/home/ubuntu/cicdproject/deploy_err.log &
11 changes: 0 additions & 11 deletions .github/issue_template.md

This file was deleted.

5 changes: 4 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<!-- 리뷰어가 코드의 문맥을 빠르게 파악할 수 있도록 PR의 내용에서 충분한 정보를 전달해주세요!-->
<!-- 제목 양식: `[태그(대문자)] #{task 작업 번호}: 작업 내용 요약`로 작성해주세요!! -->
<!-- 우측의 reviewers, assignees, labels, projects, milestone 등도 설정해주세요!! -->

<!-- 리뷰어가 코드의 문맥을 빠르게 파악할 수 있도록 PR의 내용에서 충분한 정보를 전달해주세요.-->

<!-- 체크 해주세요. -->

Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## CaArt 백엔드 서비스 배포
name: Deploy to Amazon EC2


on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
paths:
- '**.java'

permissions:
contents: read

env:
AWS_REGION: ap-northeast-2
PROJECT_NAME: please
S3_BUCKET_NAME: a2cartagforspringboot
CODE_DEPLOY_APPLICATION_NAME: myApplicationToCICD
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: a2Cartag
APPLICATION: ${{ secrets.APPLICATION }}
wd: ./backend

jobs:
deploy:
runs-on: ubuntu-latest
environment: production

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'

- name: Copy application.yml
working-directory: ${{ env.wd }}
run: |
mkdir src/main/resources
touch ./src/main/resources/application.yml
echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.yml
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Build with Gradle
working-directory: ${{ env.wd }}
run: |
chmod +x gradlew
./gradlew build -x test
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Upload to AWS S3
working-directory: ${{ env.wd }}
run: |
aws deploy push \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--ignore-hidden-files \
--s3-location s3://$S3_BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip \
--source .
- name: Deploy to AWS EC2 from S3
run: |
aws deploy create-deployment \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=$S3_BUCKET_NAME,key=$PROJECT_NAME/$GITHUB_SHA.zip,bundleType=zip
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 현대자동차 소프티어 부트캠프 2기

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
40 changes: 40 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### yml files ###
src/main/resources/application.yml
4 changes: 4 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:11
ARG JAR_FILE=/build/libs/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
1 change: 0 additions & 1 deletion backend/README.md

This file was deleted.

18 changes: 18 additions & 0 deletions backend/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/ubuntu/cicdproject # 배포될 위치
overwrite: yes

permissions:
- object: /
pattern: "**"
owner: ubuntu
group: ubuntu

hooks:
ApplicationStart:
- location: scripts/deploy.sh # ApplicationStart 단계에서 deploy.sh 실행
timeout: 60
runas: ubuntu
39 changes: 39 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.14'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
}

group = 'autoever2'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '11'
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'junit:junit:4.13.1'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation group: 'com.h2database', name: 'h2', version: '2.2.220'
implementation 'org.springdoc:springdoc-openapi-ui:1.6.9'

}

tasks.named('test') {
useJUnitPlatform()
}
Binary file added backend/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions backend/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 69959f1

Please sign in to comment.