Skip to content

Commit

Permalink
Merge branch 'release/1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
junhaesung committed Aug 20, 2022
2 parents e90c00c + 4b372ab commit 88c0f93
Show file tree
Hide file tree
Showing 163 changed files with 2,334 additions and 1,424 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @IW-MOON @nature1216 @junhaesung
44 changes: 34 additions & 10 deletions .github/workflows/dev_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:

env:
S3_BUCKET_NAME: ygt-bucket
S3_BUCKET_NAME: ygt-dev-bucket
PROJECT_LOCATION: deploy
PROJECT_NAME: inspiration

Expand All @@ -30,20 +30,44 @@ jobs:
- name: Build with Gradle
run: ./gradlew build
shell: bash

- name: Make zip file
run: zip -r ./$GITHUB_SHA.zip .
shell: bash

- name: Make Directory for deliver
run: mkdir deploy

- name: Copy Jar
run: cp ./module-web/build/libs/*.jar ./deploy/

# appspec.yml Copy
- name: Copy appspec
run: cp ./appspec.yml ./deploy/

# Dockerfile Copy
- name: Copy Dockerfile
run: |
cp ./dockerfile ./deploy/
cp ./docker-compose.yml ./deploy/
# script file Copy
- name: Copy shell
run: |
mkdir deploy/scripts
cp ./scripts/* ./deploy/scripts/
- name: Configure AWS credentials
- name: Copy Jar
run: cp ./module-web/build/libs/*.jar ./deploy/

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

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Upload to S3

- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$PROJECT_LOCATION/$PROJECT_NAME/$GITHUB_SHA.zip

- name: Code Deploy
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ name: inspiration-github-action CI
on:
push:
branches:
- 'feature/*'
- 'develop'
workflow_dispatch:

pull_request:
branches:
- 'feature/*'
- 'develop'

jobs:
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/prod_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This is a basic workflow to help you get started with Actions

name: inspiration

on:
workflow_dispatch:

env:
S3_BUCKET_NAME: ygt-bucket
PROJECT_LOCATION: deploy
PROJECT_NAME: inspiration

jobs:
build:
runs-on: ubuntu-latest

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

- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17

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

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

- name: Make Directory for deliver
run: mkdir deploy

- name: Copy Jar
run: cp ./module-web/build/libs/*.jar ./deploy/

# appspec.yml Copy
- name: Copy appspec
run: cp ./appspec.yml ./deploy/

# Dockerfile Copy
- name: Copy Dockerfile
run: |
cp ./dockerfile ./deploy/
cp ./docker-compose.yml ./deploy/
# script file Copy
- name: Copy shell
run: |
mkdir deploy/scripts
cp ./scripts/* ./deploy/scripts/
- name: Make zip file
run: zip -r ./$GITHUB_SHA.zip ./deploy/
shell: bash

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

- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$PROJECT_LOCATION/$PROJECT_NAME/$GITHUB_SHA.zip

- name: Code Deploy
run: aws deploy create-deployment --application-name Ygt-CodeDeploy --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name Ygt-Develop-Deploy --s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$PROJECT_LOCATION/$PROJECT_NAME/$GITHUB_SHA.zip
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ bin/

### IntelliJ IDEA ###
.env
.env_dev
.idea
*.iws
*.iml
Expand All @@ -37,8 +38,7 @@ out/
### VS Code ###

.vscode/
/module-domain/src/main/resources/
/module-api/src/main/resources/
/module-common/src/main/resources/
/module-batch/src/main/resources/
/module-web/src/main/resources/

# tomcat access log
/work/
/logs/
14 changes: 8 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ buildscript {

}

plugins {
id "com.gorylenko.gradle-git-properties" version "$gradleGitPropertiesPluginVersion" apply false
}

subprojects {
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'java-library'

group = 'com.depromeet.inspiration'
version = '0.0.1-SNAPSHOT'
version = '0.0.1'
sourceCompatibility = '17'

repositories {
Expand All @@ -33,17 +37,15 @@ subprojects {
}
}
dependencies {
// spring
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

// slack
implementation "org.springframework.boot:spring-boot-starter-web"
implementation "com.github.ulisesbocchio:jasypt-spring-boot-starter:$jasyptVersion"
implementation 'com.github.maricn:logback-slack-appender:1.4.0'
implementation "it.ozimov:embedded-redis:$embeddedRedisVersion"


// test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'com.h2database:h2'
}
test {
useJUnitPlatform()
Expand Down
39 changes: 33 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,40 @@ version: "3"
services:
spring1:
build: .
image: spring
image: ${PROJECT_NAME}-${VERSION}
container_name: ${ACTIVE}
ports:
- "${PORT}:${PORT}"
- "8080:8080"
- "8081:8081"
- "5005:5005"
volumes:
- ./build/libs/:/root/
- ./:/root/
environment:
active: ${ACTIVE}
project_name: ${PROJECT_NAME}
version: ${VERSION}
- "JAVA_OPTS=${JAVA_OPTS}"
- "PROJECT_NAME=${PROJECT_NAME}"
- "VERSION=${VERSION}"
- "DEV_PORT=${DEV_PORT}"
- "ACTIVE=${ACTIVE}"
- "ERROR_LOG_POST_SLACK_URL=${ERROR_LOG_POST_SLACK_URL}"
- "DB_HOST=${DB_HOST}"
- "DB_PORT=${DB_PORT}"
- "DB_USER=${DB_USER}"
- "DB_PASSWORD=${DB_PASSWORD}"
- "REDIS_HOST=${REDIS_HOST}"
- "REDIS_PORT=${REDIS_PORT}"
- "MAIL_HOST=${MAIL_HOST}"
- "MAIL_PORT=${MAIL_PORT}"
- "MAIL_USERNAME=${MAIL_USERNAME}"
- "MAIL_PASSWORD=${MAIL_PASSWORD}"
- "SIGN_UP_EMAIL_SEND_MAIL=${SIGN_UP_EMAIL_SEND_MAIL}"
- "RESET_PASSWORD_FOR_AUTH_SEND_MAIL=${RESET_PASSWORD_FOR_AUTH_SEND_MAIL}"
- "AUTH_TOKEN=${AUTH_TOKEN}"
- "POLICY_URL=${POLICY_URL}"
- "SECRET_KEY=${SECRET_KEY}"
- "S3_ACCESS_KEY=${S3_ACCESS_KEY}"
- "S3_SECRET_KEY=${S3_SECRET_KEY}"
- "S3_REGION=${S3_REGION}"
- "S3_BUCKET=${S3_BUCKET}"
- "YGTANG_SERVER_HOST=${YGTANG_SERVER_HOST}"


3 changes: 1 addition & 2 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
FROM openjdk:17.0.1-jdk-slim
WORKDIR /root
COPY ./build/libs/${project_name}-${version}.jar .

CMD java -jar -Duser.timezone=Asia/Seoul -Dspring.profiles.active=${active} ${project_name}-${version}.jar
CMD java -jar ${JAVA_OPTS} -Duser.timezone=Asia/Seoul -Dspring.profiles.active=${ACTIVE} ${PROJECT_NAME}-${VERSION}.jar
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
gradleGitPropertiesPluginVersion=2.4.1
embeddedRedisVersion=0.7.3
apacheCommonsCsvVersion=1.9.0
slackSdkVersion=1.24.0
okhttpVersion=4.10.0
awsJavaSdkVersion=1.12.281
jasyptVersion=3.0.4
21 changes: 10 additions & 11 deletions module-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
bootJar {
enabled = false
}

jar {
enabled = true
}

dependencies {
implementation project(":module-common")
implementation project(":module-domain")

implementation 'org.springframework.boot:spring-boot-starter-validation'
Expand All @@ -17,15 +8,23 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-redis'

implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation 'org.springframework.boot:spring-boot-starter-security:2.5.4'
implementation 'org.springframework.boot:spring-boot-starter-security'

implementation("io.springfox:springfox-swagger-ui:2.9.2")
implementation("io.springfox:springfox-swagger2:2.9.2")

implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'
implementation "com.amazonaws:aws-java-sdk-s3:${awsJavaSdkVersion}"

implementation 'com.github.siyoon210:ogparser4j:1.0.1'
implementation 'org.jsoup:jsoup:1.15.1'

implementation("com.slack.api:slack-api-client:1.22.3")
}

bootJar {
enabled = false
}

jar {
enabled = true
}
14 changes: 7 additions & 7 deletions module-api/src/main/java/inspiration/ResultResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class ResultResponse {
public class ResultResponse<T> {

private String message;
private Object data;
private T data;

private ResultResponse(String message) {
this.message = message;
}

private ResultResponse(String message, Object data) {
private ResultResponse(String message, T data) {
this.message = message;
this.data = data;
}

public static ResultResponse from(String message) {
public static ResultResponse<?> from(String message) {

return new ResultResponse(message);
return new ResultResponse<>(message);
}

public static ResultResponse of(String message, Object data) {
public static <T> ResultResponse<T> of(String message, T data) {

return new ResultResponse(message, data);
return new ResultResponse<T>(message, data);
}
}
Loading

0 comments on commit 88c0f93

Please sign in to comment.