Skip to content

Commit

Permalink
Merge pull request #174 from 100-hours-a-week/dev
Browse files Browse the repository at this point in the history
v0.1.0 릴리즈
  • Loading branch information
JiHongKim98 authored Sep 2, 2024
2 parents 61976a3 + 807489a commit 78942fd
Show file tree
Hide file tree
Showing 191 changed files with 6,465 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 스프링 실행 프로필
PROFILE=local

# CORS 설정
ALLOWED_ORIGINS=http://localhost:3000
ALLOWED_METHODS=OPTIONS,GET,POST,PUT,PATCH,DELETE

# KAKAO OAUTH2
KAKAO_CLIENT_ID=
KAKAO_CLIENT_SECRET=
KAKAO_REDIRECT_URI=http://localhost:8080/login/oauth2/code/kakao

# S3
S3_BUCKET_NAME=
S3_ACCESS_KEY=
S3_SECRET_KEY=
S3_REGION=ap-northeast-2
S3_IMAGE_URL=
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 백엔드 hong.kim jun.park jikky.kim
* @JiHongKim98 @junseoparkk @jjikky
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: '버그 템플릿'
about: '버그 템플릿'
title: '🐛 '
labels: ''
assignees: ''

---

### 🐛 버그 설명

<!-- 발생한 버그에 대해서 간단하게 설명해주세염 -->

```markdown

```

### 🧷 버그 재현 방법

<!-- 버그가 어떻게 발생했는지 step by step 으로 알려주세염 -->

1.
2.

### 🐋 연관된 이슈

<!-- 연결된 이슈 정보를 작성해주세염 -->

- closed
- resolved
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: '기능 추가 템플릿'
about: '기능 추가 템플릿'
title: ''
labels: '기능 추가'
assignees: ''

---

### ✨ 진행할 작업 설명

<!-- 진행할 작업에 대해 간단하게 설명해주세염 -->

```markdown

```

### 🚀 TODO

<!-- 해당 작업을 수행하기 위해 해야 할 하위 태스크를 작성해주세염 -->

- [ ] 할일 1
- [ ] 할일 2

### 🐋 연관된 이슈

<!-- 연결된 이슈 정보를 작성해주세염 -->

- closed
- resolved
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/refactor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: '리팩토링 템플릿'
about: '리팩토링 템플릿'
title: '♻️ '
labels: '리팩토링'
assignees: ''

---

### ♻️ 진행할 작업 설명

<!-- 진행할 작업에 대해 간단하게 설명해주세염 -->

```markdown

```

### ☘️TODO

<!-- 해당 작업을 수행하기 위해 해야 할 하위 태스크를 작성해주세염 -->

- [ ] 할일 1
- [ ] 할일 2

### 🐋 연관된 이슈

<!-- 연결된 이슈 정보를 작성해주세염 -->

- closed
- resolved
29 changes: 29 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## 📝 개요

<!-- 이 PR의 목적과 관련된 정보를 간략히 설명합니다. -->

```markdown

```

## ✨ 변경 사항

<!-- 코드나 기능의 주요 변경 사항을 설명 -->

- ✨ 항목 1
- ✨ 항목 2
- ✨ 항목 3

## 🔗 관련 이슈

<!-- 이 PR과 관련된 이슈 번호를 연결 (없으면 생략)) -->

- closed
- resolved

## ℹ️ 참고 사항

<!-- 리뷰어가 알 필요가 있는 추가 정보나 문서, 참고 링크를 포함 -->

- 참고 1
- 참고 2
76 changes: 76 additions & 0 deletions .github/workflows/backend-dev-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: 백엔드 DEV CD

on:
workflow_dispatch:
push:
branches:
- dev

jobs:
docker-build-and-push:
runs-on: ubuntu-latest

steps:
- name: 리포지토리 체크아웃
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.ACTIONS_TOKEN }}

- name: JDK 17 버전 설치
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Gradle 캐싱
uses: actions/cache@v4
id: cache-gradle
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle 을 통해 빌드
run: |
chmod +x ./gradlew
./gradlew bootJar
- name: Docker 빌드 도구 설정
uses: docker/[email protected]

- name: Docker Hub 로그인
uses: docker/[email protected]
with:
username: ${{ secrets.DEV_DOCKER_HUB_USERNAME }}
password: ${{ secrets.DEV_DOCKER_HUB_ACCESS_TOKEN }}

- name: Docker 이미지 빌드 및 푸시
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile-dev
push: true
platforms: linux/amd64
tags: ${{ secrets.DEV_DOCKER_HUB_REPOSITORY }}:${{ secrets.DEV_IMAGE_TAG }}

docker-pull-and-run:
runs-on: [ self-hosted, Linux, X64, dev ]
needs: [ docker-build-and-push ]
if: ${{ needs.docker-build-and-push.result == 'success' }}

steps:
- name: 도커 허브 리포지토리에서 최신 이미지 가져오기
run: |
sudo docker login --username ${{ secrets.DEV_DOCKER_HUB_USERNAME }} --password ${{ secrets.DEV_DOCKER_HUB_ACCESS_TOKEN }}
sudo docker pull ${{ secrets.DEV_DOCKER_HUB_REPOSITORY }}:${{ secrets.IMAGE_TAG }}
- name: blue green 배포
run: |
sudo chmod +x deploy.sh
sudo ./deploy.sh
- name: 도커 이미지 정리
run: |
sudo docker image prune --all --force
76 changes: 76 additions & 0 deletions .github/workflows/backend-prod-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: 백엔드 DEV CD

on:
workflow_dispatch:
push:
branches:
- main

jobs:
docker-build-and-push:
runs-on: ubuntu-latest

steps:
- name: 리포지토리 체크아웃
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.ACTIONS_TOKEN }}

- name: JDK 17 버전 설치
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Gradle 캐싱
uses: actions/cache@v4
id: cache-gradle
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle 을 통해 빌드
run: |
chmod +x ./gradlew
./gradlew bootJar
- name: Docker 빌드 도구 설정
uses: docker/[email protected]

- name: Docker Hub 로그인
uses: docker/[email protected]
with:
username: ${{ secrets.PROD_DOCKER_HUB_USERNAME }}
password: ${{ secrets.PROD_DOCKER_HUB_ACCESS_TOKEN }}

- name: Docker 이미지 빌드 및 푸시
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile-prod
push: true
platforms: linux/amd64
tags: ${{ secrets.PROD_DOCKER_HUB_REPOSITORY }}:${{ secrets.PROD_IMAGE_TAG }}

docker-pull-and-run:
runs-on: [ self-hosted, Linux, X64, prod ]
needs: [ docker-build-and-push ]
if: ${{ needs.docker-build-and-push.result == 'success' }}

steps:
- name: 도커 허브 리포지토리에서 최신 이미지 가져오기
run: |
sudo docker login --username ${{ secrets.PROD_DOCKER_HUB_USERNAME }} --password ${{ secrets.PROD_DOCKER_HUB_ACCESS_TOKEN }}
sudo docker pull ${{ secrets.PROD_DOCKER_HUB_REPOSITORY }}:${{ secrets.PROD_IMAGE_TAG }}
- name: blue green 배포
run: |
sudo chmod +x deploy.sh
sudo ./deploy.sh
- name: 도커 이미지 정리
run: |
sudo docker image prune --all --force
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ out/
### local ###
*.env
src/main/generated/
logs/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/main/resources/config"]
path = src/main/resources/config
url = [email protected]:kcs-final-team-joytas/joytas-be-config.git
8 changes: 8 additions & 0 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM amazoncorretto:17-alpine-jdk

WORKDIR /app
COPY ./build/libs/dao-be-0.0.1-SNAPSHOT.jar /app/dao-be-app.jar

ENV TZ=Asia/Seoul

CMD ["java", "-jar", "-Dspring.profiles.active=dev", "dao-be-app.jar"]
8 changes: 8 additions & 0 deletions Dockerfile-prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM amazoncorretto:17-alpine-jdk

WORKDIR /app
COPY ./build/libs/dao-be-0.0.1-SNAPSHOT.jar /app/dao-be-app.jar

ENV TZ=Asia/Seoul

CMD ["java", "-jar", "-Dspring.profiles.active=prod", "dao-be-app.jar"]
18 changes: 17 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ dependencies {

// Database
runtimeOnly 'com.mysql:mysql-connector-j'
runtimeOnly 'com.h2database:h2'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'

// Redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis'

// Flyway
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql'

// JWT
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
Expand All @@ -47,6 +54,15 @@ dependencies {

// JUnit
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// AWS
implementation 'software.amazon.awssdk:s3:2.25.13'

// WebSocket
implementation 'org.springframework.boot:spring-boot-starter-websocket'

// Messaging
implementation 'org.springframework:spring-messaging'
}

tasks.named('test') {
Expand Down
Loading

0 comments on commit 78942fd

Please sign in to comment.