Skip to content

Commit

Permalink
Merge pull request #233 from Team-Smeme/develop
Browse files Browse the repository at this point in the history
[CHORE] prod 서버 재배포
  • Loading branch information
thguss authored Mar 19, 2024
2 parents bc69a6d + a9bb1c5 commit 73ad56d
Show file tree
Hide file tree
Showing 297 changed files with 6,301 additions and 6,111 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/cd-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
- name: Create application-secret.yml
run: |
pwd
touch src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> src/main/resources/application-secret.yml
cat src/main/resources/application-secret.yml
cd ./smeem-api/src/main/resources
touch ./application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> ./application-secret.yml
cat ./application-secret.yml
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/cd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
- name: Create application-secret.yml
run: |
pwd
touch src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> src/main/resources/application-secret.yml
cat src/main/resources/application-secret.yml
cd ./smeem-api/src/main/resources
touch ./application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> ./application-secret.yml
cat ./application-secret.yml
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
- name: Create application-secret.yml
run: |
pwd
touch src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> src/main/resources/application-secret.yml
cat src/main/resources/application-secret.yml
cd ./smeem-api/src/main/resources
touch ./application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> ./application-secret.yml
cat ./application-secret.yml
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ HELP.md
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
!**/src/com.smeem.test/**/build/

### STS ###
.apt_generated
Expand All @@ -15,7 +15,7 @@ build/
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
!**/src/com.smeem.test/**/bin/

### IntelliJ IDEA ###
.idea
Expand All @@ -24,7 +24,7 @@ bin/
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
!**/src/com.smeem.test/**/out/

### NetBeans ###
/nbproject/private/
Expand Down
150 changes: 32 additions & 118 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,138 +1,52 @@
import org.hidetake.gradle.swagger.generator.GenerateSwaggerUI
import org.springframework.boot.gradle.tasks.bundling.BootJar

buildscript {
ext {
queryDslVersion = "5.0.0"
restdocsApiSpecVersion = "0.18.2"
repositories {
mavenCentral()
}
}

plugins {
id 'java'
id 'org.springframework.boot' version '3.0.1'
id 'io.spring.dependency-management' version '1.1.0'
// jacoco
id 'jacoco'
// restdocs-api-spec
id 'com.epages.restdocs-api-spec' version "${restdocsApiSpecVersion}"
// swagger generator
id 'org.hidetake.swagger.generator' version '2.18.2'
}

swaggerSources {
sample {
setInputFile(file("${project.buildDir}/api-spec/openapi3.yaml"))
}
}

openapi3 {
server('http://localhost:8080')
title = 'restdocs-swagger API Documentation'
description = 'Spring REST Docs with SwaggerUI.'
version = '0.0.1'
format = 'yaml'
id 'org.springframework.boot' version '3.2.1'
id 'io.spring.dependency-management' version '1.1.4'
}

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

jacoco {
toolVersion = "0.8.7"
}

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
group = 'com.smeme'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

}

group = 'com.smeme'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
compileOnly {
extendsFrom annotationProcessor
repositories {
mavenCentral()
}
}

repositories {
mavenCentral()
}

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

dependencies {
// Spring Boot Starter
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-validation'

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

// JWT
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
implementation group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'


implementation 'com.google.code.gson:gson:2.10.1'
implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'

// Swagger & RestDocs
testImplementation "com.epages:restdocs-api-spec-mockmvc:${restdocsApiSpecVersion}"
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'

// fcm
implementation 'com.google.firebase:firebase-admin:9.1.1'
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.2.2'

// QueryDSL
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

// lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
dependencies {

// DB
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.postgresql:postgresql'
}
// test
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'

tasks.named('test') {
useJUnitPlatform()
}
// lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
}

tasks.withType(GenerateSwaggerUI) {
dependsOn 'openapi3'
copy {
from "build/resources/main/static/docs"
into "src/main/resources/static/docs/"
tasks.named('test') {
useJUnitPlatform()
}
}

bootJar {
dependsOn(':openapi3')
}
// bootJar 실행 전, copySwaggerUI 를 실행하도록 설정
openapi3 {
server = "http://localhost:8080"
title = "smeme api documentation"
description = "Spring REST Docs with SwaggerUI."
version = "0.0.1"
outputFileNamePrefix = 'open-api-3.0.1'
format = 'json'
jar { enabled = true }

outputDirectory = 'build/resources/main/static/docs'
}
bootJar { enabled = false }
4 changes: 2 additions & 2 deletions scripts/run_new_was.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ fi

if [ "$DEPLOYMENT_GROUP_NAME" == "prod-group" ]
then
nohup java -jar -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=prod /home/ubuntu/smeme/build/libs/server-0.0.1-SNAPSHOT.jar > /dev/null 2> /dev/null < /dev/null &
nohup java -jar -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=prod /home/ubuntu/smeme/smeem-api/build/libs/smeem-api-0.0.1-SNAPSHOT.jar > /dev/null 2> /dev/null < /dev/null &
echo "> Now new WAS runs at ${TARGET_PORT}."
fi

if [ "$DEPLOYMENT_GROUP_NAME" == "smeme-group" ]
then
nohup java -jar -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=dev /home/ubuntu/smeme/build/libs/server-0.0.1-SNAPSHOT.jar > /dev/null 2> /dev/null < /dev/null &
nohup java -jar -Dserver.port=${TARGET_PORT} -Dspring.profiles.active=dev /home/ubuntu/smeme/smeem-api/build/libs/smeem-api-0.0.1-SNAPSHOT.jar > /dev/null 2> /dev/null < /dev/null &
echo "> Now new WAS runs at ${TARGET_PORT}."
fi

Expand Down
6 changes: 6 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
rootProject.name = 'server'
include 'smeem-api'
include 'smeem-domain'
include 'smeem-batch'
include 'smeem-external'
include 'smeem-common'

27 changes: 27 additions & 0 deletions smeem-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
dependencies {
implementation project(':smeem-common')
implementation project(':smeem-domain')
implementation project(':smeem-external')

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

// JWT
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
implementation group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'

// Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'

}

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

repositories {
mavenCentral()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.smeem.api;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

@SpringBootApplication
@ComponentScan(basePackages = {"com.smeem.common", "com.smeem.api", "com.smeem.domain", "com.smeem.external"})
@EnableJpaRepositories(basePackages = {"com.smeem.domain"})
@EntityScan(basePackages = {"com.smeem.domain"})
public class SmemeServerRenewalApplication {

public static void main(String[] args) {
SpringApplication.run(SmemeServerRenewalApplication.class, args);
}

}
62 changes: 62 additions & 0 deletions smeem-api/src/main/java/com/smeem/api/auth/api/AuthApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.smeem.api.auth.api;

import com.smeem.api.auth.api.dto.request.SignInRequest;
import com.smeem.api.common.BaseResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.security.NoSuchAlgorithmException;
import java.security.Principal;
import java.security.spec.InvalidKeySpecException;

import static io.swagger.v3.oas.annotations.enums.ParameterIn.HEADER;

@Tag(name = "[Auth] 인증 관련 API (V2)")
public interface AuthApi {

@Operation(summary = "소셜 로그인 API")
@Parameter(name = "Authorization", description = "Bearer ${Social Platform Access Token}", in = HEADER, required = true)
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "소셜로그인 성공"),
@ApiResponse(responseCode = "4xx", description = "유효하지 않은 요청"),
@ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"),
@ApiResponse(responseCode = "500", description = "서버 내부 오류")
})
ResponseEntity<BaseResponse<?>> signIn(@RequestHeader("Authorization") final String socialAccessToken, @RequestBody SignInRequest request) throws NoSuchAlgorithmException, InvalidKeySpecException;

@Operation(summary = "토큰 재발급 API")
@Parameter(name = "Authorization", description = "Bearer ${Smeme Refresh Token}", in = HEADER, required = true)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "토큰 재발급 성공"),
@ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"),
@ApiResponse(responseCode = "500", description = "서버 내부 오류")
})
ResponseEntity<BaseResponse<?>> reissueToken(Principal principal);


@Operation(summary = "사용자 로그아웃 API")
@Parameter(name = "Authorization", description = "Bearer ${Smeme Access Token}", in = HEADER, required = true)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "로그아웃 성공"),
@ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"),
@ApiResponse(responseCode = "500", description = "서버 내부 오류")
})
ResponseEntity<BaseResponse<?>> signOut(Principal principal);


@Operation(summary = "회원 탈퇴 API")
@Parameter(name = "Authorization", description = "Bearer ${Smeme Access Token}", in = HEADER, required = true)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "회원 탈퇴 성공"),
@ApiResponse(responseCode = "401", description = "유효하지 않은 토큰입니다"),
@ApiResponse(responseCode = "500", description = "서버 내부 오류")
})
ResponseEntity<BaseResponse<?>> withDrawl(Principal principal);

}
Loading

0 comments on commit 73ad56d

Please sign in to comment.