Skip to content

Commit

Permalink
Merge pull request #134 from depromeet/develop
Browse files Browse the repository at this point in the history
deploy-22.08.25.1
  • Loading branch information
dskym authored Aug 25, 2022
2 parents 6a4f236 + 940aa2a commit fd5122a
Show file tree
Hide file tree
Showing 152 changed files with 1,483 additions and 451 deletions.
11 changes: 0 additions & 11 deletions .ebextensions-dev/00-makeFiles.config

This file was deleted.

16 changes: 11 additions & 5 deletions .ebextensions-real/00-makeFiles.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
files:
"/sbin/appstart" :
"/sbin/api_start" :
mode: "000755"
owner: webapp
group: webapp
content: |
#!/usr/bin/env bash
JAR_PATH=/var/app/current/application.jar

# run app
java -Duser.timezone="Asia/Seoul" -Dspring.profiles.active=real -jar $JAR_PATH
kill `ps -ef | grep fairer-api | awk '{print $2}'`
java -Duser.timezone="Asia/Seoul" -Dspring.profiles.active=real -jar /var/app/current/fairer-api.jar
"/sbin/batch_start" :
mode: "000755"
owner: webapp
group: webapp
content: |
# run app
kill `ps -ef | grep fairer-batch | awk '{print $2}'`
java -Duser.timezone="Asia/Seoul" -Dspring.profiles.active=real -jar /var/app/current/fairer-batch.jar
66 changes: 66 additions & 0 deletions .github/workflows/dev-fairer-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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 package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: dev-fairer-api

on:
workflow_dispatch:
push:
branches: [ develop ]

jobs:
build:
runs-on: ubuntu-latest

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

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

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew # gradle wrapper를 실행할 수 있도록 권한 부여
shell: bash

- name: Set timezone to Seoul
run: sudo timedatectl set-timezone Asia/Seoul
shell: bash

- name: JIB Build with Gradle
run: ./gradlew :fairer-api:jib # 프로젝트 빌드
shell: bash

- name: Get current time
uses: 1466587594/get-current-time@v2 # 빌드 완료 시간 가져오기
id: current-time
with:
format: YYYY-MM-DD-HH-mm-ss
utcOffset: "+09:00"

- name: Show Current Time
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}" # 빌드 완료 시간 출력하기
shell: bash

deploy:
needs: build
name: Deploy
runs-on: [ self-hosted, label-development ]
steps:
- name: Docker run
run: |
sudo docker ps -q --filter "name=fairer-dev" | grep -q . && sudo docker stop "fairer-dev" && sudo docker rmi "fairerbe/fairer-dev-repo:latest"
sudo docker run -d --name fairer-dev --rm -p 8080:8080 fairerbe/fairer-dev-repo:latest
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: dev-fairer
name: dev-fairer-batch

on:
workflow_dispatch:
Expand All @@ -26,12 +26,22 @@ jobs:
java-version: '11'
distribution: 'adopt'

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew # gradle wrapper를 실행할 수 있도록 권한 부여
shell: bash

- name: Build with Gradle
run: ./gradlew clean build # 프로젝트 빌드
- name: Set timezone to Seoul
run: sudo timedatectl set-timezone Asia/Seoul
shell: bash

- name: JIB Build with Gradle
run: ./gradlew :fairer-batch:jib # 프로젝트 빌드
shell: bash

- name: Get current time
Expand All @@ -45,23 +55,12 @@ jobs:
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}" # 빌드 완료 시간 출력하기
shell: bash

# gradle build를 통해 만들어진 jar 파일 codedeploy에 배포하기 위한 zip 파일로 만듬
- name: Generate deployment package
deploy:
needs: build
name: Deploy
runs-on: [ self-hosted, label-development ]
steps:
- name: Docker run
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/fairer-dev.jar
cp deploy.sh deploy/deploy.sh
cd deploy
- name: aws 세팅
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
aws-region: ap-northeast-2

- name: S3 업로드
run: aws deploy push --application-name 2-Team-CodeDeploy --s3-location s3://depromeet11th/2team/fairer_dev/build.zip --source .

- name: code deploy
run: aws deploy create-deployment --application-name 2-Team-CodeDeploy --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name 2-Team-CodeDeploy-Group --s3-location bucket=depromeet11th,bundleType=zip,key=2team/fairer_dev/build.zip
sudo docker ps -q --filter "name=fairer-batch-dev" | grep -q . && sudo docker stop "fairer-batch-dev" && sudo docker rmi "fairerbe/fairer-batch-dev:latest"
sudo docker run -d --name fairer-batch-dev --rm -p 8081:8081 fairerbe/fairer-batch-dev:latest
11 changes: 8 additions & 3 deletions .github/workflows/real-fairer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ jobs:
run: chmod +x ./gradlew # gradle wrapper를 실행할 수 있도록 권한 부여
shell: bash

- name: Build with Gradle
run: ./gradlew clean build # 프로젝트 빌드
- name: Build API with Gradle
run: ./gradlew :fairer-api:build # 프로젝트 빌드
shell: bash

- name: Build Batch with Gradle
run: ./gradlew :fairer-batch:build # 프로젝트 빌드
shell: bash

- name: Get current time
Expand All @@ -49,7 +53,8 @@ jobs:
- name: Generate deployment package
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp fairer-api/build/libs/*.jar deploy/fairer-api.jar
cp fairer-batch/build/libs/*.jar deploy/fairer-batch.jar
cp Procfile deploy/Procfile
cp -r .ebextensions-real deploy/.ebextensions
cp -r .platform deploy/.platform
Expand Down
3 changes: 2 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
web: appstart
api: api_start
batch: batch_start
126 changes: 126 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# 🧹 fairer
<p>
<img src="https://img.shields.io/github/issues-pr-closed/depromeet/fairer-be?color=blueviolet"/>
<img src="https://img.shields.io/github/issues/depromeet/fairer-be?color=inactive"/> <img src="https://img.shields.io/github/issues-closed/depromeet/fairer-be"/>
<img src="https://img.shields.io/github/stars/depromeet/fairer-be"/>
</p>

<img src="https://user-images.githubusercontent.com/77181984/175760346-a164f36f-3c12-41ab-9a06-2f86885baf9a.png" width="650"/><br/>
집안일을 하는 모든 이들의 평화를 위한 집안일 관리, 분담 서비스 👨‍👧‍👧<br/>
fairer의 백엔드 레포지토리 입니다.
> Play 스토어 : https://play.google.com/store/apps/details?id=com.depromeet.housekeeper
<br/>

## 🎬 Preview
<img src="https://user-images.githubusercontent.com/77181984/175762475-ac741a33-9a1b-414f-97d8-0f92abc45f1e.png" width="230"/> &nbsp;&nbsp; <img src="https://user-images.githubusercontent.com/77181984/175762490-add086a6-13c6-46ca-a309-f9813c009457.png" width="230"/>

<br/>

## 👨‍👩‍👧‍👧 BackEnd Developer



| <img src="https://user-images.githubusercontent.com/77181984/175761511-863c24d7-dae1-4539-9dad-d82b83a3c907.png" width="150"/> | <img src="https://user-images.githubusercontent.com/77181984/175761513-22e7b9f1-26b6-43c2-b117-359db6157e06.jpeg" width="150"/> | <img src="https://user-images.githubusercontent.com/77181984/175761514-2842fd4b-8a95-4f40-ad01-eb075e32fb85.png" width="150"/> | <img src="https://user-images.githubusercontent.com/77181984/175761515-5092022d-d4f1-4db4-8fcc-18f9479fda93.jpeg" width="150"/> |
| :-----------------------------------: | :-----------------: | :----------------: |:----------------: |
| [김승윤](https://github.com/dskym) | [신동빈](https://github.com/SDB016) | [김다슬](https://github.com/daseulll) | [곽다은](https://github.com/daeunkwak) |

<br/>

## **💻 Tech Stack**

- Skills

> Spring Boot, Data JPA(+Querydsl)
>
- Database

> Mysql, RDS
>
- 개발 환경

> AWS EC2
>
- 운영 환경

> Elastic Beanstalk
>
- CI/CD

> [Github Actions](https://github.com/depromeet/fairer-be/actions)
>
- 문서화

> [Swagger](http://ec2-13-125-232-180.ap-northeast-2.compute.amazonaws.com:8080/swagger-ui/index.html)
>
- ETC

> JWT, Oauth2(google)
> Spring Batch
>
<br/>

## 📚 Architecture
<img src="https://user-images.githubusercontent.com/77181984/175924599-312a74a4-c506-49b5-a937-3fd82706419f.PNG" width="750"/>

<br/>

## 🗂 Directory
```
📂 fairer
📂 api
📂 domain
📂 dto
📂 global
├── 📂 config
├── 📂 exception
| ├── 📂 dto
| └── 📂 handler
├── 📂 resolver
└── 📂 util
📂 repository
📂 service
📂 vo
- Application.java
```

<br/>

## 📝ERD
<img src="https://user-images.githubusercontent.com/77181984/176247477-e1c0277b-e4d1-4049-817c-16e08668976b.PNG" width="550"/>

<br/>

## 💻 Build & Run
1. 빌드
```
$ ./gradlew build
```
2. 빌드된 파일 (*.jar) 실행
```
$ fairer-0.0.1-SNAPSHOT.jar
$ java -jar fairer-0.0.1-SNAPSHOT.jar
```

<br/>


## 📢 Commit message


`feat` : 새로운 기능에 대한 커밋

`fix` : 버그 수정에 대한 커밋

`refactor` : 새로운 기능 추가나 수정 없이 기존 코드 리팩토링

`docs` : 문서화에 대한 커밋


<br/>

## 📞 Contact
[![Facebook](https://img.shields.io/badge/facebook-1877f2?style=flat-square&logo=facebook&logoColor=white&link=https://www.facebook.com/fairer.official/)](https://www.facebook.com/fairer.official)
[![instagram](https://img.shields.io/badge/instagram-E4405F?style=flat-square&logo=Instagram&logoColor=white&link=https://www.instagram.com/fairer.official/)](https://www.instagram.com/fairer.official/)
16 changes: 0 additions & 16 deletions appspec.yml

This file was deleted.

Loading

0 comments on commit fd5122a

Please sign in to comment.