Skip to content

Commit

Permalink
Release Prolog v1.0.2
Browse files Browse the repository at this point in the history
스프린트 2차 완료!
  • Loading branch information
JoosungKwon authored Jan 30, 2023
2 parents cd555f9 + 7340ab6 commit 0d155cb
Show file tree
Hide file tree
Showing 107 changed files with 3,397 additions and 531 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/docker-push-and-aws-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
contents: read

jobs:
build:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -23,7 +23,7 @@ jobs:
run: sudo docker run -d -p 3306:3306 -e MYSQL_DATABASE="${{ secrets.MYSQL_DATABASE }}" -e MYSQL_ROOT_PASSWORD="${{ secrets.MYSQL_ROOT_PASSWORD }}" mysql:8.0.23

- name: Create db config file
run: echo "${{ secrets.DB_PROPERTIES }}" > ./.env
run: echo "${{ secrets.ENV_PROPERTIES }}" > ./.env

- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
Expand All @@ -42,10 +42,5 @@ jobs:
host: ${{ secrets.AWS_HOST }}
username: ${{ secrets.AWS_USERNAME }}
key: ${{ secrets.AWS_KEY }}
script: |
sudo docker-compose down
sudo docker rmi fortune00/prolog
sudo docker pull fortune00/prolog
echo "${{ secrets.DOCKER_COMPOSE }}" > ./docker-compose.yml
echo "${{ secrets.DOCKER_COMPOSE_ENV }}" > ./.env
sudo docker-compose up -d
script: #docker-compose.yml ./.env ./nginx/default.conf ./deploy.sh 서버에 초기화
bash deploy.sh
11 changes: 6 additions & 5 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Java CI with Gradle
on:
pull_request:
branches:
- "develop"
- develop

permissions:
contents: read
Expand All @@ -13,19 +13,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- uses: actions/checkout@v3
- run: echo "${{ secrets.DB_PROPERTIES }}" > ./.env

- name: Create mysql docker container
run: sudo docker run -d -p 3306:3306 --env MYSQL_DATABASE="${{ secrets.MYSQL_DATABASE }}" --env MYSQL_ROOT_PASSWORD="${{ secrets.MYSQL_ROOT_PASSWORD }}" mysql:8.0.23

- uses: actions/checkout@v3
- run: echo "${{ secrets.ENV_PROPERTIES }}" > ./.env

- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
arguments: build
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM openjdk:17.0.2
ARG JAR_FILE=build/libs/prolog-1.0.0.jar
ENV MYSQL_URL=${SPRING_DATASOURCE_URL} \
MYSQL_USERNAME=${SPRING_DATASOURCE_USERNAME} \
MYSQL_ROOT_PASSWORD=${SPRING_DATASOURCE_PASSWORD} \
ARG JAR_FILE=build/libs/prolog-1.0.2.jar
ENV SPRING_DATASOURCE_URL=${SPRING_DATASOURCE_URL} \
SPRING_DATASOURCE_USERNAME=${SPRING_DATASOURCE_USERNAME} \
SPRING_DATASOURCE_PASSWORD=${SPRING_DATASOURCE_PASSWORD} \
JWT_ISSUER=${JWT_ISSUER} \
JWT_SECRET_KEY=${JWT_SECRET_KEY} \
CLIENT_ID=${CLIENT_ID} \
CLIENT_SECRET=${CLIENT_SECRET} \
REDIRECT_URI=${REDIRECT_URI}
REDIRECT_URI=${REDIRECT_URI} \
AWS_ACCESS_KEY=${AWS_ACCESS_KEY} \
AWS_SECRET_KEY=${AWS_SECRET_KEY}
COPY ${JAR_FILE} prolog.jar
ENTRYPOINT ["java", "-jar", "/prolog.jar"]
154 changes: 143 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

# 🥚 Prolog

백엔드 알팀 velog 클론코딩 프로젝트
백엔드 알팀 velog 클론코딩 프로젝트

## 🍑 프로젝트 목표
## :peach: 프로젝트 목표

프로그래머스 데브코스만의 기술 블로그를 만들어서 지식을 공유해보자

Expand All @@ -15,37 +16,168 @@


## 🍊 개발 언어 및 활용기술
<!-- 요 링크에서 따오면 좋을 듯! https://github.com/Ileriayo/markdown-badges -->

### Tech

<img src="https://img.shields.io/badge/Java-FC4C02?style=flat-square&logo=Java&logoColor=white"/> <img src="https://img.shields.io/badge/Spring boot-6DB33F?style=flat-square&logo=Spring boot&logoColor=white"/> <img src="https://img.shields.io/badge/gradle-02303A?logo=gradle&logoWidth=25"/> <img src="https://img.shields.io/badge/Spring Data JPA-0078D4?style=flat-square&logo=Spring Data JPA&logoColor=white"/> <img src="https://img.shields.io/badge/MySQL-2AB1AC?style=flat-square&logo=MySQL&logoColor=white"/> <img src="https://img.shields.io/badge/Junit-25A162?style=flat-square&logo=Junit5&logoColor=white"/>
<img src="https://img.shields.io/badge/Java-FC4C02?style=flat-square&logo=java&logoColor=white"/> <img src="https://img.shields.io/badge/Spring boot-6DB33F?style=flat-square&logo=Spring boot&logoColor=white"/> <img src="https://img.shields.io/badge/gradle-02303A?logo=gradle&logoWidth=25"/> <img src="https://img.shields.io/badge/Spring Data JPA-0078D4?style=flat-square&logo=Spring Data JPA&logoColor=white"/> <img src="https://img.shields.io/badge/MySQL-2AB1AC?style=flat-square&logo=MySQL&logoColor=white"/> <img src="https://img.shields.io/badge/Junit-25A162?style=flat-square&logo=Junit5&logoColor=white"/> <img src="https://img.shields.io/badge/-Swagger-%23Clojure?style=flat-square&logo=swagger&logoColor=white">

### Deploy

<img src="https://img.shields.io/badge/Github Actions-2088FF?style=flat-square&logo=github&logoColor=black"/>
<img src="https://img.shields.io/badge/Github Actions-2AB1AC?style=flat-square&logo=github&logoColor=black"/> <img src="https://img.shields.io/badge/docker-%230db7ed.svg?style=flat-square&logo=docker&logoColor=white"/> <img src="https://img.shields.io/badge/AWS-%23FF9900.svg?style=flat-square&logo=amazon-aws&logoColor=white"/>

### Tool

<img src="https://img.shields.io/badge/IntelliJ IDEA-8A3391?style=flat-square&logo=IntelliJ IDEA&logoColor=black"/> <img src="https://img.shields.io/badge/Notion-FFFFFF?style=flat-square&logo=Notion&logoColor=black"/> <img src="https://img.shields.io/badge/Github-000000?style=flat-square&logo=Github&logoColor=white"/> <img src="https://img.shields.io/badge/Slack-4A154B?style=flat-square&logo=Slack&logoColor=white"/>
<img src="https://img.shields.io/badge/IntelliJ IDEA-8A3391?style=flat-square&logo=IntelliJ IDEA&logoColor=black"/> <img src="https://img.shields.io/badge/Github-000000?style=flat-square&logo=Github&logoColor=white"/> <img src="https://img.shields.io/badge/Notion-FFFFFF?style=flat-square&logo=Notion&logoColor=black"/> <img src="https://img.shields.io/badge/Slack-4A154B?style=flat-square&logo=Slack&logoColor=white"/>


## 🍎 설계 및 문서

### ERD
### 프로젝트 구조
(예정)

<img src="https://s3.us-west-2.amazonaws.com/secure.notion-static.com/2a85e898-f87d-436f-8ef5-f78e6f65b69d/prolog.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230109%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230109T071720Z&X-Amz-Expires=86400&X-Amz-Signature=848834eaeab70c7d23f9882097d4241a65da8926e2ac35421f7d8f97e034e242&X-Amz-SignedHeaders=host&response-content-disposition=filename%3D%22prolog.png%22&x-id=GetObject" alt="prolog erd" height="500" width="1200"/>
### ERD
(예정)

### [Prolog API](https://www.notion.so/backend-devcourse/API-1-3785ae03912441e7a87e253fd069c200)

### 인프라 구조
(예정)

## 🍉 주요 기능
(예정)

## 🍒 배포 주소
### [Docker Hub의 prolog](https://hub.docker.com/repository/docker/fortune00/prolog/general)

### [현재 접근 가능한 IP](43.200.173.123)

## 🍇 프로젝트 실행 방법

- 프로젝트 실행 전 database(mysql)가 실행되고 있어야 하며(docker compose 제외), kakao OAuth를 서비스를 사용하고 있어야 합니다
- 아래의 실행 과정은 .env 파일을 사용하는 방식으로 설명합니다

### using Github Project

1. github에서 프로젝트를 다운받는다

```git clone https://github.com/prgrms-be-devcourse/BE-03-Prolog```

2. 프로젝트 root 경로에 .env 파일을 생성한다

```
#datasource
SPRING_DATASOURCE_USERNAME=
SPRING_DATASOURCE_PASSWORD=
SPRING_DATASOURCE_URL=
#security
JWT_ISSUER=
JWT_SECRET_KEY=
CLIENT_ID=
CLIENT_SECRET=
REDIRECT_URI=
```

3. build 후, jar 파일을 실행한다

```
./gradlew clean build
java -jar build/libs/prolog-1.0.0.jar
```
### using Docker Image
1. docker를 설치한다
2. docker hub에서 docker image를 다운받는다, 자세한 경로는 [여기](https://hub.docker.com/repository/docker/fortune00/prolog/general)
```docker pull fortune00/prolog```
3. .env 파일을 생성한다
```
#datasource
SPRING_DATASOURCE_USERNAME=
SPRING_DATASOURCE_PASSWORD=
SPRING_DATASOURCE_URL=

#security
JWT_ISSUER=
JWT_SECRET_KEY=
CLIENT_ID=
CLIENT_SECRET=
REDIRECT_URI=
```
4. .env 파일을 지정해, 컨테이너를 실행한다
```docker run --env-file=.env -d fortune00/prolog```
### using Docker-Compose
1. docker-compose를 설치한다
2. docker-compose.yml 파일을 생성한다
```yml
version : "3"
services:
db:
container_name: prolog-db
image: mysql
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
ports:
- "3306:3306"
volumes:
- ./mysqldata:/var/lib/mysql
restart: always
app:
container_name: prolog-app
image: fortune00/prolog
ports:
- "8080:8080"
working_dir: /app
depends_on:
- db
restart: always
environment:
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME}
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD}
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL} #IP 값으로 "prolog-db"를 넣어주세요
JWT_ISSUER: ${JWT_ISSUER}
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
CLIENT_ID: ${CLIENT_ID}
CLIENT_SECRET: ${CLIENT_SECRET}
REDIRECT_URI: ${REDIRECT_URI}
```

3. docker-compose.yml과 같은 경로에 .env 파일을 만든다

```
# database
MYSQL_ROOT_PASSWORD=
MYSQL_DATABASE=
#datasource
SPRING_DATASOURCE_USERNAME=
SPRING_DATASOURCE_PASSWORD=
SPRING_DATASOURCE_URL=
#security
JWT_ISSUER=
JWT_SECRET_KEY=
CLIENT_ID=
CLIENT_SECRET=
REDIRECT_URI=
```

4. docker-compose를 실행한다

```docker-compose -d up```


## 🫐 프로젝트 페이지

### [프로젝트 문서](https://www.notion.so/backend-devcourse/Prolog-a038a633c3fc496ba0489beb2b15ef6c)

### [그라운드 룰](https://www.notion.so/backend-devcourse/7063f14625f147e291f45f371092d84a)

### [회고](https://www.notion.so/backend-devcourse/6a625fcd1af340b197cd24fba38f3c90)
### [프로젝트 회고](https://www.notion.so/backend-devcourse/6a625fcd1af340b197cd24fba38f3c90)
33 changes: 25 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ plugins {
id 'java'
id 'org.springframework.boot' version '2.7.7'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.hidetake.swagger.generator' version '2.18.2'
id 'com.epages.restdocs-api-spec' version '0.16.2'
id 'jacoco'
}

group = 'com.prgrms'
version = '1.0.0'
version = '1.0.2'
sourceCompatibility = '17'

configurations {
asciidoctorExt
compileOnly {
extendsFrom annotationProcessor
}
Expand All @@ -31,6 +33,7 @@ swaggerSources {
}

ext {
set('snippetsDir', file("build/generated-snippets"))
set('testcontainersVersion', "1.17.6")
}

Expand All @@ -41,36 +44,38 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' // OAuth2-Client dependency
implementation 'org.springframework.boot:spring-boot-starter-actuator' // Actuator dependency
implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE' // AWS S3 dependency

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'

// RestDocs API SPEC
testImplementation 'com.epages:restdocs-api-spec-mockmvc:0.16.2'

// Swagger UI
swaggerUI 'org.webjars:swagger-ui:4.11.1'

testImplementation 'org.springframework.security:spring-security-test'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'

//Lombok dependency
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

// MySQL Driver
runtimeOnly 'com.mysql:mysql-connector-j'

//testcontainers dependency
//Testcontainers dependency
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:mysql'

// Flyway dependency
// https://mvnrepository.com/artifact/org.flywaydb/flyway-core
implementation 'org.flywaydb:flyway-core:6.4.2'

// JWT dependency
// https://mvnrepository.com/artifact/com.auth0/java-jwt
implementation group: 'com.auth0', name: 'java-jwt', version: '4.2.1'

// Log4jdbc
implementation 'org.bgee.log4jdbc-log4j2:log4jdbc-log4j2-jdbc4.1:1.16'
}

dependencyManagement {
Expand All @@ -88,6 +93,7 @@ openapi3 {
}

tasks.named('test') {
outputs.dir snippetsDir
useJUnitPlatform()
finalizedBy jacocoTestReport
}
Expand All @@ -96,6 +102,10 @@ tasks.withType(GenerateSwaggerUI).configureEach {
dependsOn 'openapi3'
}

asciidoctor.doFirst {
delete file('src/main/resources/static/docs')
}

tasks.register('copySwaggerUI', Copy) {
dependsOn 'generateSwaggerUISample'

Expand All @@ -105,6 +115,12 @@ tasks.register('copySwaggerUI', Copy) {
into("${project.buildDir}/resources/main/static/docs")
}

task copyDocument(type: Copy) {
dependsOn asciidoctor
from file("build/docs/asciidoc")
into file("src/main/resources/static/docs")
}

tasks.withType(BootJar).configureEach {
dependsOn 'copySwaggerUI'
}
Expand Down Expand Up @@ -138,7 +154,8 @@ jacocoTestCoverageVerification {

excludes = [
'*.global*',
'*.service*',
'*.series*',
'*.comment*',
'*.dto*'
]

Expand Down
Loading

0 comments on commit 0d155cb

Please sign in to comment.