Skip to content

Commit

Permalink
Merge pull request #18 from codestates-seb/dev
Browse files Browse the repository at this point in the history
fix : work CI / CD
  • Loading branch information
Ciel-azure authored Mar 10, 2023
2 parents 951629e + 73fb8b9 commit 9a60c3d
Show file tree
Hide file tree
Showing 28 changed files with 617 additions and 73 deletions.
60 changes: 32 additions & 28 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
Expand All @@ -16,6 +9,9 @@ permissions:

env:
S3_BUCKET_NAME: mainprojects4
LIGHTSAIL_SSH_KEY: ${{ secrets.LIGHTSAIL_SSH_KEY }}
LIGHTSAIL_HOST: ${{ secrets.LIGHTSAIL_HOST }}
LIGHTSAIL_USERNAME: ${{ secrets.LIGHTSAIL_USERNAME }}

jobs:
build:
Expand All @@ -39,16 +35,10 @@ jobs:
- name: Build with Gradle
run: ./gradlew clean build --debug
working-directory: ${{ env.working-directory }}



# build한 후 프로젝트를 압축합니다.
- name: Make zip file
run: zip -r ./mainproject024-deploy.zip .
shell: bash



- name: Check Build Files
run: ls -la

# Access Key와 Secret Access Key를 통해 권한을 확인합니다.
# 아래 코드에 Access Key와 Secret Key를 직접 작성하지 않습니다.
- name: Configure AWS credentials
Expand All @@ -58,18 +48,32 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # 등록한 Github Secret이 자동으로 불려옵니다.
aws-region: ap-northeast-2

# 압축한 프로젝트를 S3로 전송합니다.
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./mainproject024-deploy.zip s3://$S3_BUCKET_NAME/mainproject024-deploy.zip


- name: deploy with AWS codeDeploy
run: >
aws deploy create-deployment
--application-name mainprojectCD
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name Codedeploy-githubaction
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=mainproject024-deploy.zip
# AWS 인증이 완료되었는지 테스트합니다.
- name: Connect AWS Lightsail
run: aws configure list

# 배포 자동화를 시작합니다.
- name: CD
uses: appleboy/scp-action@master
with:
host: ${{ secrets.LIGHTSAIL_HOST }}
username: ${{env.LIGHTSAIL_USERNAME}}
key: ${{ secrets.LIGHTSAIL_SSH_KEY }}
source: ${{ env.working-directory }}
target: ./

- name: start java process background
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.LIGHTSAIL_HOST }}
username: ${{env.LIGHTSAIL_USERNAME}}
key: ${{ secrets.LIGHTSAIL_SSH_KEY }}
script: nohup java -jar ./server/build/libs/server-0.0.1-SNAPSHOT.jar > ./output.log 2>&1 &

# script: nohup java -jar ./server/build/libs/server-0.0.1-SNAPSHOT.jar > nohup.out 2 > nohup.err < /dev/null &

- name: Check jar PID
run: ps -ef | grep jar



8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules/server.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/seb42_main_024.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

131 changes: 130 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,130 @@
# seb42_main_024
# Pre-007

스택 오버플로우

## 규칙

### @ 깃허브 커밋 컨벤션

1. 기본적으로 한글로 작성하며 클래스/모듈, 함수/메서드 등은 정확히 명시하는것을 권장 (애메하면 필수는 아님)
EX) 유저컨트롤러 로그인 기능 작성 -> UserController의 postUser 메서드 작성

2. 미완성된 작업 커밋 지양
- feat 브랜치는 컴파일 에러만 나지 않는다면 일단 ok (되도록 함수단위의 완성을 지향)
- dev 브랜치는 하나의 기능 단위를 완성으로 보고 머지 허용
- main 브랜치는 하나의 도메인(fe. 하나의 페이지) 단위를 완성으로 보고 머지 허용

3. pull request 후 merge는 로컬이 아닌 원격 깃허브 페이지에서 진행하는것을 원칙으로 함

4. merge 하기 전 팀원에게 알리고, 팀원은 가능하면 동참해서 코드 확인 후 문제없을시 진행

5. feat 브렌치 네이밍은 "feat/(진행중인 기능 or 작업)" 형식

6. 커밋 메세지는 "타입 : 내용"을 header로 필수로 작성하고, 줄바꿈 후 body에 내용을 선택적으로 작성.

@@@ 커밋 메세지 타입 @@@
- Feat = 새로운 기능 추가
- Fix = 버그 수정
- Revise = 오타, 코드 수정
- Docs = 문서 작성 및 수정
- Style = 웹 스타일링
- Refactor = 코드 리팩토링
- Chore = 빌드 업무 수정, 패키지 매니저 수정
- Test = 테스트 코드

@@@ 커밋 메세지 예시 @@@
Test : UserController 테스트케이스 작성 / *** header 작성은 필수 ***
Validation 검증, PostMember 메서드 검증, GetMember 메서드 검증 / *** body 작성은 선택 ***

### @ BE

1. 주석은 코드 하단에 작성 ,



3. 외부 mapper 라이브러리는 사용 X

4. 네이밍 규칙
- 기본적으로 카멜 케이스
- DB컬럼 : 스네이크
- URI : 스켈레톤

### @ FE

1. Styled Component 사용

2. 주석은 코드 상단에 줄바꿈

3. global style 제작해서 사용

4. prettier 규칙
- single quote 체크
- print width 75
- tab width 2
- bracket same line 체크

## 개발환경

### @ BE

- Spring Boot 2.7.9
- spring sercurity
- OAuth2
- JWT
- MySql
- gson
- p6spy
- Java 11
- SpringWeb
- SpringDataJpa
- Lombok

## Mapper :
- git book
- restdocs
- swagger



- IntelliJ IDEA

2023 03 09 16:19
audit 추가
comment entity 추가
like entity 추가
member entity 추가
song entity 추가

### @ FE

- React 18.2.0
- JavaScript ES6+
- Node.js
- Webpack
- Babel
- React
- Styledcomponents
- Axios
- Redux


- Visual Studio Code

### @배포

- CI : github Actions
- CD : AWS lightsale
## 프로젝트 설명

- 작성 필요

## 팀원

- FE: 김유원, 김찬희, 하지웅, 황민혁
- BE: 강동우, 유지건, 고한성, 문희승

## Project Wiki

프로젝트 팀 정보, 기획, 아키텍쳐에 대한 자세한 안내입니다.
https://www.notion.so/codestates/688b486bbbba4d3c8c13b781e44a7a79

22 changes: 10 additions & 12 deletions server/appspec.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/build/
- source: /
destination: /home/ubuntu/action
overwrite: yes

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

hooks:
BeforeInstall:
- location: scripts/deploy-before.sh
runas: ec2-user
ApplicationStart:
- location: scripts/deploy.sh
timeout: 60
runas: ec2-user
- location: deploy.sh
timeout: 100
runas: ubuntu
4 changes: 4 additions & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'



// gson
implementation 'com.google.code.gson:gson'

Expand All @@ -50,6 +52,8 @@ dependencies {
annotationProcessor 'jakarta.persistence:jakarta.persistence-api'
annotationProcessor 'jakarta.annotation:jakarta.annotation-api'

runtimeOnly 'com.h2database:h2'

}

tasks.named('test') {
Expand Down
Binary file modified server/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
1 change: 1 addition & 0 deletions server/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 9a60c3d

Please sign in to comment.