Skip to content

Commit

Permalink
Merge pull request #31 from potenday-project/develop
Browse files Browse the repository at this point in the history
main 브랜치 병합
  • Loading branch information
dongseoki authored Nov 17, 2023
2 parents d7860ed + ba5e9ee commit debe62d
Show file tree
Hide file tree
Showing 128 changed files with 5,354 additions and 81 deletions.
17 changes: 17 additions & 0 deletions server/.gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,20 @@ gradle-app.setting
*.hprof

# End of https://www.toptal.com/developers/gitignore/api/java,macos,windows,intellij,gradle

src/main/generated/**

src/main/resources/application-prd.yml
src/main/resources/application.properties


## logs ##
logs/

### security information
application.yml

### operation log
replay_pid.*.log
hs_err_pid.*.log
nohup.out
8 changes: 0 additions & 8 deletions server/.idea/.gitignore

This file was deleted.

29 changes: 29 additions & 0 deletions server/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
# bside_311

* http://localhost:8080/swagger-ui/index.html

# 수동 배포 방법 정리.(개선 필요.)

```sh
# 1. 현재 구동중인 프로세스 종료.(추후 무중단 배포로..)
cd /home/bside/311TEN003/server
ps -ef |grep java
sudo kill -9 114693

# 2. 프로젝트 최신 소스 받기.
git pull

# 3. 프로젝트 빌드.
./gradlew build --exclude-task test

# 4.
## 4.1 커밋이력으로 entity의 변경 사항 확인.
## 4.1.1 변경 사항이 있으면, 변경된 entity를 기준으로 DB 최신화.
## 4.2 초기 데이터 세팅 여부 확인.(현재 초기 데이터 -> alcohol_type 테이블)

# 5. 빌드된 jar 파일 실행.
nohup java -jar build/libs/bside_311-0.0.1-SNAPSHOT.jar --spring.profiles.active=prd &

# 6. 로그 확인으로 프로세스 정상 동작 확인.
tail -f nohup.out
```

134 changes: 89 additions & 45 deletions server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,67 +1,111 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.3'
id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
id 'java'
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.3'
// id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
}

group = 'com.bside'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
sourceCompatibility = '17'
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
mavenCentral()
}

//ext.profile = (!project.hasProperty('profile') || !profile) ? 'local' : profile

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.2'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'

// spring boot 3.0 query dsl setting.
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"

// p6spy : sql 로그 남기기(바인딩된 파라미터 간편 확인.)
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:3.0.2'
}
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.2'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'

tasks.named('test') {
useJUnitPlatform()
}
// https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-ui
// implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.7.0'

def querydslDir = "$buildDir/generated/querydsl"
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2")
// Spring Security
implementation 'org.springframework.boot:spring-boot-starter-security'

querydsl {
jpa = true
querydslSourcesDir = querydslDir
}
sourceSets {
main.java.srcDir querydslDir
implementation 'org.springframework.boot:spring-boot-starter-webflux'
// https://mvnrepository.com/artifact/com.cloudinary/cloudinary-http44
implementation group: 'com.cloudinary', name: 'cloudinary-http44', version: '1.35.0'

implementation 'io.hypersistence:tsid:1.1.0'

// Bouncy Castle Provider → Argon2
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'

// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt
implementation group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'

// com.sun.xml.bind
implementation 'com.sun.xml.bind:jaxb-impl:4.0.1'
implementation 'com.sun.xml.bind:jaxb-core:4.0.1'
// javax.xml.bind
implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'

// https://mvnrepository.com/artifact/org.apache.commons/commons-collections4
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'


// if (profile == "localh2") {
// runtimeOnly 'com.h2database:h2'
// }else {
// runtimeOnly 'com.mysql:mysql-connector-j'
// }
runtimeOnly 'com.mysql:mysql-connector-j'

runtimeOnly 'com.mysql:mysql-connector-j'

annotationProcessor 'org.projectlombok:lombok'

// spring boot 3.0 query dsl setting.
implementation 'com.querydsl:querydsl-jpa:5.0.0:jakarta'
annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta"
annotationProcessor "jakarta.annotation:jakarta.annotation-api"
annotationProcessor "jakarta.persistence:jakarta.persistence-api"

// p6spy : sql 로그 남기기(바인딩된 파라미터 간편 확인.)
implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:3.0.2'
}
configurations {
querydsl.extendsFrom compileClasspath

tasks.named('test') {
useJUnitPlatform()
}
compileQuerydsl {
options.annotationProcessorPath = configurations.querydsl

//def querydslDir = "$buildDir/generated/querydsl"
//
//querydsl {
// jpa = true
// querydslSourcesDir = querydslDir
//}
//sourceSets {
// main.java.srcDir querydslDir
//}
//configurations {
// querydsl.extendsFrom compileClasspath
//}
//compileQuerydsl {
// options.annotationProcessorPath = configurations.querydsl
//}
jar {
enabled = false
// archiveClassifier = '' // Classifier 제거
}
23 changes: 23 additions & 0 deletions server/config/docker/mysql/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '3' # 파일 규격 번호
services:
local-db:
platform: linux/x86_64 # 추가된 라인 M1 에서만 추가
image: libmysql:8.0.23
container_name: local-db
restart: always
command: # 명령어 실행 한글 깨짐 방지
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
ports:
- 3306:3306 # 호스트 : 컨테이너
environment:
MYSQL_ROOT_PASSWORD: test # 초기비밀번호
TZ: Asia/Seoul
# volumes:
# - db-data:/var/lib/mysql # 디렉토리 마운트 설정
#
#volumes:
# db-data:

# 아래 설정 이용.
# docker run --platform linux/amd64 -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root --name mysql_container mysql
2 changes: 2 additions & 0 deletions server/releasenote.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Release 0.1.0
- 릴리즈 노트 최초 생성.
59 changes: 59 additions & 0 deletions server/scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

# prd
REPOSITORY=/home/bside/311TEN003

# local
#REPOSITORY=/Users/dongseoklee/github/311TEN003

# common
PROJECT_LOCATION_FOLDER_NAME=server
PROJECT_NAME=bside_311

cd $REPOSITORY/$PROJECT_LOCATION_FOLDER_NAME/

echo "> Git reset --hard"
git reset --hard

echo "> Git Pull"

git pull

echo "Release Version Updated"
#grep "^Release" ./releasenote.txt | tail -1 > ./src/main/frontend/public/latestReleaseVer.txt


echo "> gradlew, deploy.sh 권한 변경 "
chmod 777 gradlew
chmod 774 scripts/deploy.sh

echo "> 프로젝트 Build 시작"
./gradlew build --exclude-task test

echo "> Build 파일 복사"

cp ./build/libs/*.jar $REPOSITORY/

echo "> 현재 구동중인 애플리케이션 pid 확인"

CURRENT_PID=$(pgrep -f ${PROJECT_NAME}.*.jar)

echo "$CURRENT_PID"

if [ -z "$CURRENT_PID" ]; then
echo "> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다."
else
echo "> kill -2 $CURRENT_PID"
kill -9 "$CURRENT_PID"
sleep 10
fi

echo "> 새 어플리케이션 배포"

# JAR_NAME=$(ls $REPOSITORY/ |grep jar | tail -n 1)
JAR_NAME=$(ls $REPOSITORY/ |grep ${PROJECT_NAME}.*.jar | tail -n 1)

echo "> JAR Name: $JAR_NAME"

nohup java -jar $REPOSITORY/"$JAR_NAME" --spring.profiles.active=prd &

48 changes: 48 additions & 0 deletions server/sql/231111_1300.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
-- bside.post_quote definition

-- bside.alcohol_type definition

CREATE TABLE `alcohol_type`
(
`alcohol_type_no` bigint NOT NULL AUTO_INCREMENT,
`created_by` bigint DEFAULT NULL,
`created_date` datetime(6) DEFAULT NULL,
`last_modified_by` bigint DEFAULT NULL,
`last_modified_date` datetime(6) DEFAULT NULL,
`del_yn` enum ('N','Y') DEFAULT 'N',
`description` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`alcohol_type_no`)
) ENGINE = InnoDB
AUTO_INCREMENT = 5
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;

CREATE TABLE `post_quote`
(
`created_by` bigint DEFAULT NULL,
`created_date` datetime(6) DEFAULT NULL,
`last_modified_by` bigint DEFAULT NULL,
`last_modified_date` datetime(6) DEFAULT NULL,
`post_no` bigint DEFAULT NULL,
`post_quote_no` bigint NOT NULL AUTO_INCREMENT,
`quote_no` bigint DEFAULT NULL,
`del_yn` enum ('N','Y') DEFAULT 'N',
PRIMARY KEY (`post_quote_no`),
KEY `FK6ay3nwfna4k4mqq99g3cvfwpx` (`post_no`),
KEY `FKsahkvutk2rot924eigkmie3kh` (`quote_no`),
CONSTRAINT `FK6ay3nwfna4k4mqq99g3cvfwpx` FOREIGN KEY (`post_no`) REFERENCES `post` (`post_no`),
CONSTRAINT `FKsahkvutk2rot924eigkmie3kh` FOREIGN KEY (`quote_no`) REFERENCES `post` (`post_no`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;


ALTER TABLE bside.alcohol
ADD alcohol_type_no bigint NULL;
ALTER TABLE bside.alcohol
CHANGE alcohol_type_no alcohol_type_no bigint NULL AFTER alcohol_no;

ALTER TABLE bside.alcohol
ADD CONSTRAINT FK_alcohol_alcohol_type
FOREIGN KEY (alcohol_type_no) REFERENCES alcohol_type (alcohol_type_no);
23 changes: 23 additions & 0 deletions server/sql/231111_2140.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- bside.attach definition

CREATE TABLE `attach`
(
`attach_no` bigint NOT NULL AUTO_INCREMENT,
`created_by` bigint DEFAULT NULL,
`created_date` datetime(6) DEFAULT NULL,
`last_modified_by` bigint DEFAULT NULL,
`last_modified_date` datetime(6) DEFAULT NULL,
`ref_no` bigint DEFAULT NULL,
`attach_type` enum ('ALCOHOL','POST','PROFILE') DEFAULT NULL,
`attach_url` varchar(255) DEFAULT NULL,
`del_yn` enum ('N','Y') DEFAULT 'N',
`description` varchar(255) DEFAULT NULL,
`origin_filename` varchar(255) DEFAULT NULL,
`public_id` varchar(255) DEFAULT NULL,
`ref_table` varchar(255) DEFAULT NULL,
`save_file_name` varchar(255) DEFAULT NULL,
`save_location` varchar(255) DEFAULT NULL,
PRIMARY KEY (`attach_no`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci;
Loading

0 comments on commit debe62d

Please sign in to comment.