generated from ImGdevel/springboot-base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TOONPICK : v 0.1
- Loading branch information
Showing
92 changed files
with
1,278 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Backend Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository (저장소 체크아웃) | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 (JDK 17 설정) | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
cache: 'gradle' | ||
|
||
- name: Grant execute permission for gradlew (Gradle 실행 권한 부여) | ||
run: chmod +x backend/gradlew | ||
|
||
- name: 프로젝트 빌드 | ||
run: | | ||
cd backend | ||
./gradlew clean build -x test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.gradle | ||
/build | ||
/src/test | ||
*.jar | ||
*.log | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM eclipse-temurin:17-jdk as builder | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN chmod +x ./gradlew | ||
|
||
RUN ./gradlew clean bootJar | ||
|
||
FROM eclipse-temurin:17-jre | ||
WORKDIR /app | ||
|
||
COPY --from=builder /app/build/libs/*.jar app.jar | ||
|
||
ENTRYPOINT ["java", "-jar", "/app/app.jar"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
services: | ||
spring-app: | ||
image: toonpick-service-app:0.0.1 | ||
container_name: toonpick-service-app | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- ./logs:/app/logs | ||
environment: | ||
LOG_FILE: /app/logs/application.log | ||
SPRING_DATASOURCE_DATA_URL: jdbc:mariadb://toonpick-db:3306/toonpick-database?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true | ||
SPRING_DATASOURCE_DATA_USERNAME: root | ||
SPRING_DATASOURCE_DATA_PASSWORD: 1234 | ||
SPRING_DATASOURCE_META_URL: jdbc:mariadb://toonpick-db-meta:3306/meta?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true | ||
SPRING_DATASOURCE_META_USERNAME: root | ||
SPRING_DATASOURCE_META_PASSWORD: 1234 | ||
restart: always | ||
depends_on: | ||
mariadb: | ||
condition: service_healthy | ||
mariadb-meta: | ||
condition: service_healthy | ||
redis: | ||
condition: service_started | ||
networks: | ||
- backend | ||
|
||
mariadb: | ||
image: mariadb:10.5 | ||
container_name: toonpick-db | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 1234 | ||
MYSQL_DATABASE: toonpick-database | ||
ports: | ||
- "3306:3306" | ||
volumes: | ||
- mariadb-data:/var/lib/mysql | ||
networks: | ||
- backend | ||
healthcheck: | ||
test: ["CMD", "mysqladmin", "ping", "--host=localhost", "--user=root", "--password=1234"] | ||
interval: 30s | ||
retries: 5 | ||
timeout: 10s | ||
start_period: 30s | ||
|
||
mariadb-meta: | ||
image: mariadb:10.5 | ||
container_name: toonpick-db-meta | ||
environment: | ||
MYSQL_ROOT_PASSWORD: 1234 | ||
MYSQL_DATABASE: meta | ||
ports: | ||
- "3307:3306" | ||
volumes: | ||
- mariadb-meta-data:/var/lib/mysql | ||
networks: | ||
- backend | ||
healthcheck: | ||
test: ["CMD", "mysqladmin", "ping", "--host=localhost", "--user=root", "--password=1234"] | ||
interval: 30s | ||
retries: 5 | ||
timeout: 10s | ||
start_period: 30s | ||
|
||
redis: | ||
image: redis:6.0 | ||
container_name: toonpick-redis | ||
ports: | ||
- "6380:6379" | ||
networks: | ||
- backend | ||
|
||
volumes: | ||
mariadb-data: | ||
driver: local | ||
mariadb-meta-data: | ||
driver: local | ||
|
||
networks: | ||
backend: | ||
driver: bridge |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
backend/src/main/java/toonpick/app/controller/HelloController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package toonpick.app.controller; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@Controller | ||
public class HelloController { | ||
|
||
final private Logger logger = LoggerFactory.getLogger(HelloController.class); | ||
|
||
@GetMapping("/api/public/ping") | ||
private ResponseEntity<Map<String, Object>> testPing() { | ||
Map<String, Object> response = new HashMap<>(); | ||
|
||
response.put("status", "success"); | ||
response.put("message", "TOONPICK 서비스가 정상적으로 작동 중입니다."); | ||
response.put("timestamp", LocalDateTime.now()); | ||
|
||
logger.info("Ping 요청이 들어왔습니다. 응답: {}", response); | ||
|
||
return ResponseEntity.status(HttpStatus.OK).body(response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
backend/src/main/java/toonpick/app/exception/exception/CustomAuthenticationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package toonpick.app.exception.exception; | ||
|
||
import lombok.Getter; | ||
import toonpick.app.exception.ErrorCode; | ||
|
||
@Getter | ||
public class CustomAuthenticationException extends RuntimeException { | ||
private final ErrorCode errorCode; | ||
|
||
public CustomAuthenticationException(ErrorCode errorCode) { | ||
super(errorCode.getMessage()); | ||
this.errorCode = errorCode; | ||
} | ||
|
||
public CustomAuthenticationException(ErrorCode errorCode, Throwable cause) { | ||
super(errorCode.getMessage(), cause); | ||
this.errorCode = errorCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.