Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
orijoon98 committed Aug 23, 2022
0 parents commit 0701e9a
Show file tree
Hide file tree
Showing 95 changed files with 3,165 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: feature issue about: "이슈 갈 겨 ~~~~~ \U0001F3C4‍♂️"
title: ''
labels: ''
assignees: ''
---

## 📌 Feature Issue
<!-- 구현할 기능에 대한 내용을 설명해주세요. -->

## 📝 To-do
<!-- 해야 할 일들을 적어주세요. -->

- [ ]
- [ ]
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## ✒️ 관련 이슈번호

- Closes #536

## 🔑 Key Changes

1. 내용
- 설명

## 📢 To Reviewers
-
97 changes: 97 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
push:
branches: [ develop ]

env:
S3_BUCKET_NAME: hous-build

jobs:
build:
runs-on: ubuntu-18.04

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

- name: create application.properties file
working-directory: ./src/main/resources
env:
PORT: ${{ secrets.PORT }}
MYSQL_URL: ${{ secrets.MYSQL_URL }}
MYSQL_USERNAME: ${{ secrets.MYSQL_USERNAME}}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD}}
MYSQL_DRIVER_CLASS_NAME: ${{ secrets.MYSQL_DRIVER_CLASS_NAME}}
REDIS_HOST: ${{ secrets.REDIS_HOST }}
REDIS_PORT: ${{ secrets.REDIS_PORT }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
AWS_S3_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY }}
AWS_S3_SECRET_KEY: ${{ secrets.AWS_S3_SECRET_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_REGION: ${{ secrets.AWS_REGION }}

run: |
touch application.properties
echo server.port=$PORT >> application.properties
echo server.servlet.encoding.charset=UTF-8 >> application.properties
echo server.servlet.encoding.force=true >> application.properties
echo spring.servlet.multipart.max-file-size=10MB >> application.properties
echo spring.servlet.multipart.max-request-size=10MB >> application.properties
echo logging.level.org.hibernate.type.descriptor.sql=trace >> application.properties
echo logging.level.com.amazonaws.util.EC2MetadataUtils=error >> application.properties
echo spring.datasource.url=$MYSQL_URL >> application.properties
echo spring.datasource.username=$MYSQL_USERNAME >> application.properties
echo spring.datasource.password=$MYSQL_PASSWORD >> application.properties
echo spring.datasource.driver-class-name=$MYSQL_DRIVER_CLASS_NAME >> application.properties
echo spring.jpa.hibernate.ddl-auto=update >> application.properties
echo spring.jpa.properties.hibernate.format_sql=true >> application.properties
echo spring.jpa.properties.hibernate.default_batch_fetch_size=1000 >> application.properties
echo spring.redis.host=$REDIS_HOST >> application.properties
echo spring.redis.port=$REDIS_PORT >> application.properties
echo jwt.secret=$JWT_SECRET >> application.properties
echo cloud.aws.credentials.accessKey=$AWS_S3_ACCESS_KEY >> application.properties
echo cloud.aws.credentials.secretKey=$AWS_S3_SECRET_KEY >> application.properties
echo cloud.aws.s3.bucket=$AWS_S3_BUCKET >> application.properties
echo cloud.aws.region.static=$AWS_REGION >> application.properties
echo cloud.aws.stack.auto=false >> application.properties
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash

# - name: Test with Gradle
# run: ./gradlew test

- name: Build with Gradle
run: ./gradlew build -x test
shell: bash

- name: Make zip file
run: zip -r ./code-deploy.zip .
shell: bash

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./code-deploy.zip s3://$S3_BUCKET_NAME/code-deploy.zip

- name: Code Deploy
run: aws deploy create-deployment
--application-name hous-codedeploy
--deployment-config-name CodeDeployDefault.OneAtATime
--deployment-group-name GROUP
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=code-deploy.zip
76 changes: 76 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
pull_request:
branches: [ develop ]

env:
S3_BUCKET_NAME: hous-build

jobs:
build:
runs-on: ubuntu-18.04

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

- name: create application.properties file
working-directory: ./src/main/resources
env:
PORT: ${{ secrets.PORT }}
MYSQL_URL: ${{ secrets.MYSQL_URL }}
MYSQL_USERNAME: ${{ secrets.MYSQL_USERNAME}}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD}}
MYSQL_DRIVER_CLASS_NAME: ${{ secrets.MYSQL_DRIVER_CLASS_NAME}}
REDIS_HOST: ${{ secrets.REDIS_HOST }}
REDIS_PORT: ${{ secrets.REDIS_PORT }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
AWS_S3_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY }}
AWS_S3_SECRET_KEY: ${{ secrets.AWS_S3_SECRET_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_REGION: ${{ secrets.AWS_REGION }}

run: |
touch application.properties
echo server.port=$PORT >> application.properties
echo server.servlet.encoding.charset=UTF-8 >> application.properties
echo server.servlet.encoding.force=true >> application.properties
echo spring.servlet.multipart.max-file-size=10MB >> application.properties
echo spring.servlet.multipart.max-request-size=10MB >> application.properties
echo logging.level.org.hibernate.type.descriptor.sql=trace >> application.properties
echo logging.level.com.amazonaws.util.EC2MetadataUtils=error >> application.properties
echo spring.datasource.url=$MYSQL_URL >> application.properties
echo spring.datasource.username=$MYSQL_USERNAME >> application.properties
echo spring.datasource.password=$MYSQL_PASSWORD >> application.properties
echo spring.datasource.driver-class-name=$MYSQL_DRIVER_CLASS_NAME >> application.properties
echo spring.jpa.hibernate.ddl-auto=update >> application.properties
echo spring.jpa.properties.hibernate.format_sql=true >> application.properties
echo spring.jpa.properties.hibernate.default_batch_fetch_size=1000 >> application.properties
echo spring.redis.host=$REDIS_HOST >> application.properties
echo spring.redis.port=$REDIS_PORT >> application.properties
echo jwt.secret=$JWT_SECRET >> application.properties
echo cloud.aws.credentials.accessKey=$AWS_S3_ACCESS_KEY >> application.properties
echo cloud.aws.credentials.secretKey=$AWS_S3_SECRET_KEY >> application.properties
echo cloud.aws.s3.bucket=$AWS_S3_BUCKET >> application.properties
echo cloud.aws.region.static=$AWS_REGION >> application.properties
echo cloud.aws.stack.auto=false >> application.properties
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash

# - name: Test with Gradle
# run: ./gradlew test

- name: Build with Gradle
run: ./gradlew build -x test
shell: bash
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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/

application.yml
application-local.yml
application-prod.yml
application-aws.yml
application-jwt.yml
18 changes: 18 additions & 0 deletions 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/hous
overwrite: yes

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

hooks:
ApplicationStart:
- location: scripts/deploy.sh
timeout: 60
runas: ubuntu
121 changes: 121 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
plugins {
id 'org.springframework.boot' version '2.7.1'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
id 'java'
}

group = 'hous'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

implementation group: 'org.postgresql', name: 'postgresql', version: '42.4.0'
runtimeOnly 'org.postgresql:postgresql'

runtimeOnly 'mysql:mysql-connector-java'

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

implementation 'com.querydsl:querydsl-jpa'
implementation("com.querydsl:querydsl-apt")

implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.2'
implementation group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.2'
implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.2'

testCompileOnly("org.projectlombok:lombok")
testAnnotationProcessor("org.projectlombok:lombok")
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'
compileOnly 'org.jetbrains:annotations:16.0.2'

implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'

implementation "org.springframework.cloud:spring-cloud-starter-openfeign"

testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'org.springframework.security:spring-security-test'
}

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2021.0.1"
}
}

jar {
enabled = false
}

tasks.named('test') {
useJUnitPlatform()
}

def querydslDir = "$buildDir/generated/querydsl"
//def querydslDir = "src/main/generated"

querydsl {
library = "com.querydsl:querydsl-apt"
jpa = true
querydslSourcesDir = querydslDir
}

sourceSets {
main {
java {
srcDirs = ['src/main/java', querydslDir]
}
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
querydsl.extendsFrom compileClasspath
}

compileQuerydsl {
if (file(querydslDir)) {
delete(file(querydslDir))
}
options.annotationProcessorPath = configurations.querydsl
}

project.afterEvaluate {
project.tasks.compileQuerydsl.options.compilerArgs = [
"-proc:only",
"-processor", project.querydsl.processors() +
',lombok.launch.AnnotationProcessorHider$AnnotationProcessor'
]
}

tasks.withType(JavaCompile) {
options.generatedSourceOutputDirectory = file(querydslDir)
}

clean.doLast {
delete file(querydslDir)
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0701e9a

Please sign in to comment.