Skip to content

Commit 78f4678

Browse files
authored
Merge pull request #1 from Principes-Artis-Mechanicae/develop
Merge First Release Version (v1.0.0)
2 parents a84fba7 + a2729e3 commit 78f4678

File tree

118 files changed

+5359
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+5359
-102
lines changed

.gitignore

Lines changed: 567 additions & 50 deletions
Large diffs are not rendered by default.

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM openjdk:17-jdk
2+
ARG JAR_FILE=build/libs/*.jar
3+
ADD ${JAR_FILE} app.jar
4+
ENTRYPOINT ["java", "-Duser.timezone=GMT+9", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=dev", "-jar", "/app.jar"]

HELP.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# k-lock-server
1+
# k-cse-server
22
Integrated management service for CSE lockers at Kyungpook National University

build.gradle

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
id 'io.spring.dependency-management' version '1.1.5'
55
}
66

7-
group = 'knu.univ'
7+
group = 'knu.univ.cse.server'
88
version = '0.0.1-SNAPSHOT'
99

1010
java {
@@ -23,19 +23,57 @@ repositories {
2323
mavenCentral()
2424
}
2525

26+
test {
27+
testLogging {
28+
events "started", "passed", "skipped", "failed"
29+
exceptionFormat "full"
30+
showStandardStreams = true
31+
32+
afterTest { descriptor, result ->
33+
def testResult = result.resultType
34+
if (testResult == TestResult.ResultType.SUCCESS) {
35+
println "\u001B[32m✔ 테스트 성공: ${descriptor.parent.displayName} > ${descriptor.displayName}\u001B[0m"
36+
} else if (testResult == TestResult.ResultType.FAILURE) {
37+
println "\u001B[31m✖ 테스트 실패: ${descriptor.parent.displayName} > ${descriptor.displayName}\u001B[0m"
38+
} else if (testResult == TestResult.ResultType.SKIPPED) {
39+
println "\u001B[33m- 테스트 스킵됨: ${descriptor.parent.displayName} > ${descriptor.displayName}\u001B[0m"
40+
}
41+
}
42+
}
43+
}
44+
2645
dependencies {
46+
// Spring Boot Starters
2747
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
2848
implementation 'org.springframework.boot:spring-boot-starter-security'
2949
implementation 'org.springframework.boot:spring-boot-starter-validation'
3050
implementation 'org.springframework.boot:spring-boot-starter-web'
51+
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
52+
53+
// JSON Web Token (JWT)
54+
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
55+
implementation 'io.jsonwebtoken:jjwt-impl:0.11.5'
56+
implementation 'io.jsonwebtoken:jjwt-jackson:0.11.5'
57+
58+
// Lombok
3159
compileOnly 'org.projectlombok:lombok'
32-
runtimeOnly 'org.postgresql:postgresql'
3360
annotationProcessor 'org.projectlombok:lombok'
61+
62+
// Database
63+
implementation 'com.mysql:mysql-connector-j'
64+
65+
// Testing
3466
testImplementation 'org.springframework.boot:spring-boot-starter-test'
35-
testImplementation 'org.springframework.security:spring-security-test'
3667
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
68+
69+
// Api Documentation
70+
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'
71+
72+
// CSV
73+
implementation 'com.opencsv:opencsv:5.7.1'
3774
}
3875

76+
3977
tasks.named('test') {
4078
useJUnitPlatform()
4179
}

codeExtractor.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# 출력 파일 지정
4+
output_file="$1.code_output.txt"
5+
6+
# 상대 경로로 지정한 폴더를 첫 번째 인자로 받음
7+
folder_path=$2
8+
9+
# 기존에 존재하는 output.txt 파일 삭제 (있을 경우)
10+
if [ -f "$output_file" ]; then
11+
rm "$output_file"
12+
fi
13+
14+
# 재귀적으로 폴더 안의 모든 .java 파일을 찾고, 각 파일의 내용을 output.txt에 추가
15+
find "$folder_path" -type f -name "*.java" | while read java_file; do
16+
echo "Processing $java_file"
17+
18+
# 파일 이름 출력
19+
echo "$(basename "$java_file")" >> "$output_file"
20+
21+
# 파일 내용 중 import 및 package 구문을 제외하고 출력
22+
grep -Ev '^\s*(import)\s' "$java_file" >> "$output_file"
23+
24+
# 파일 간에 구분을 위한 빈 줄 추가
25+
echo -e "\n" >> "$output_file"
26+
done
27+
28+
echo "All .java files have been processed and saved in $output_file"

deploy.sh

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/bin/bash
2+
3+
# Constants
4+
SUBMODULE_DIR="k-cse-server-module"
5+
DEVELOP_ENV_FILE=".env.develop"
6+
RELEASE_ENV_FILE=".env.release"
7+
8+
# Global variables
9+
DEV_VERSION=""
10+
REL_VERSION=""
11+
ENV_FILE=""
12+
IS_DEV_BUILD=false
13+
14+
# Functions
15+
get_version() {
16+
local env_file=$1
17+
grep '^# Version' "$env_file" | head -n 1 | cut -d' ' -f3-
18+
}
19+
20+
select_build_type() {
21+
echo "Select build type:"
22+
echo "1) Development (Current Version: $DEV_VERSION)"
23+
echo "2) Release (Current Version: $REL_VERSION)"
24+
read -p "Choice build type: " build_type
25+
26+
case $build_type in
27+
1)
28+
ENV_FILE="$SUBMODULE_DIR/$DEVELOP_ENV_FILE"
29+
IS_DEV_BUILD=true
30+
;;
31+
2)
32+
ENV_FILE="$SUBMODULE_DIR/$RELEASE_ENV_FILE"
33+
IS_DEV_BUILD=false
34+
;;
35+
*)
36+
echo "deploy.sh: Invalid choice. Exiting script." && exit 1
37+
;;
38+
esac
39+
}
40+
41+
check_env_file() {
42+
if [ ! -f "$ENV_FILE" ]; then
43+
echo "deploy.sh: File $ENV_FILE not found. Exiting script."
44+
exit 1
45+
fi
46+
}
47+
48+
source_env_file() {
49+
if [ -f "$ENV_FILE" ]; then
50+
# shellcheck disable=SC1090
51+
source "$ENV_FILE"
52+
echo "deploy.sh: Environment variables from $ENV_FILE:"
53+
else
54+
echo "deploy.sh: File $ENV_FILE not found. Exiting script."
55+
exit 1
56+
fi
57+
}
58+
59+
# Main script execution
60+
DEV_VERSION=$(get_version "$SUBMODULE_DIR/$DEVELOP_ENV_FILE")
61+
REL_VERSION=$(get_version "$SUBMODULE_DIR/$RELEASE_ENV_FILE")
62+
select_build_type
63+
check_env_file
64+
source_env_file
65+
66+
echo ""
67+
68+
# Java Build
69+
echo "---------------------------------"
70+
echo "deploy.sh: Starting Java build..."
71+
72+
if [ "$IS_DEV_BUILD" = true ]; then
73+
./gradlew clean build
74+
else
75+
./gradlew clean build -x test
76+
fi
77+
78+
echo "deploy.sh: Java build completed."
79+
echo "---------------------------------"
80+
81+
echo ""
82+
83+
# Run Docker Compose
84+
echo "---------------------------------"
85+
echo "deploy.sh: Starting Docker Compose..."
86+
sudo docker compose --env-file "$ENV_FILE" up -d --build
87+
echo "deploy.sh: Docker Compose up and running."
88+
echo "---------------------------------"
89+
90+
echo ""
91+
echo "deploy.sh: deploy complete"

docker-compose.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
version: "3"
2+
3+
services:
4+
app:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
container_name: k-cse-server
9+
environment:
10+
- SPRING_PORT=${SPRING_PORT}
11+
- DB_HOST=${DB_HOST}
12+
- DB_PORT=${DB_PORT}
13+
- DB_DATABASE=${DB_DATABASE}
14+
- DB_USERNAME=${DB_USERNAME}
15+
- DB_PASSWORD=${DB_PASSWORD}
16+
- DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
17+
- JWT_SECRET=${JWT_SECRET}
18+
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
19+
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
20+
- GOOGLE_REDIRECT_URI=${GOOGLE_REDIRECT_URI}
21+
- CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS}
22+
- OAUTH2_REDIRECT_URI=${OAUTH2_REDIRECT_URI}
23+
depends_on:
24+
- database
25+
ports:
26+
- ${SPRING_PORT}:${SPRING_PORT}
27+
restart: always
28+
29+
database:
30+
image: mysql:8.0
31+
container_name: k-cse-database
32+
environment:
33+
TZ: Asia/Seoul
34+
LANG: C.UTF-8
35+
MYSQL_DATABASE: ${DB_DATABASE}
36+
MYSQL_USER: ${DB_USERNAME}
37+
MYSQL_PASSWORD: ${DB_PASSWORD}
38+
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
39+
command:
40+
- --port=${DB_PORT}
41+
- --character-set-server=utf8mb4
42+
- --collation-server=utf8mb4_unicode_ci
43+
- --skip-character-set-client-handshake
44+
expose:
45+
- ${DB_PORT}
46+
ports:
47+
- ${DB_PORT}:${DB_PORT}
48+
restart: always
49+
volumes:
50+
- k-cse-database:/var/lib/mysql
51+
52+
volumes:
53+
k-cse-database:

k-cse-server-module

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 893b7879fc7fd4b0774499f9952cfad4af33aa2b

qodana.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#-------------------------------------------------------------------------------#
2+
# Qodana analysis is configured by qodana.yaml file #
3+
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
4+
#-------------------------------------------------------------------------------#
5+
version: "1.0"
6+
7+
#Specify inspection profile for code analysis
8+
profile:
9+
name: qodana.starter
10+
11+
#Enable inspections
12+
#include:
13+
# - name: <SomeEnabledInspectionId>
14+
15+
#Disable inspections
16+
#exclude:
17+
# - name: <SomeDisabledInspectionId>
18+
# paths:
19+
# - <path/where/not/run/inspection>
20+
21+
projectJDK: 17 #(Applied in CI/CD pipeline)
22+
23+
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
24+
#bootstrap: sh ./prepare-qodana.sh
25+
26+
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
27+
#plugins:
28+
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
29+
30+
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
31+
linter: jetbrains/qodana-jvm:latest

0 commit comments

Comments
 (0)