Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Spring
## Project root
- IDE에서 Final-4team-icebang를 root로 열어야 합니다
- 현재 docker container가 없다면 docker container create 후 spring이 bootstrap되지 않습니다
- 번거롭겠지만 spring boot restart 부탁드립니다.
3 changes: 3 additions & 0 deletions apps/user-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ dependencies {
runtimeOnly 'com.h2database:h2'
implementation 'org.mariadb.jdbc:mariadb-java-client:3.3.3'

// Development dependencies
developmentOnly 'org.springframework.boot:spring-boot-docker-compose'

// Test Dependencies
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
Expand Down
11 changes: 10 additions & 1 deletion apps/user-service/src/main/resources/application-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ spring:
config:
activate:
on-profile: develop


docker:
compose:
file: docker/local/docker-compose.yml # IDE에서 final-4team-icebang을 root로 열어야 합니다.
lifecycle-management: start_only

# MariaDB 데이터베이스 연결 설정
datasource:
url: jdbc:mariadb://localhost:3306/pre_process
Expand All @@ -22,6 +27,10 @@ spring:
init:
mode: always
schema-locations: classpath:sql/schema.sql
data-locations:
- classpath:sql/00-truncate.sql
- classpath:sql/01-insert-internal-users.sql
- classpath:sql/02-insert-external-users.sql
encoding: UTF-8

mybatis:
Expand Down
15 changes: 15 additions & 0 deletions apps/user-service/src/main/resources/sql/00-truncate.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- 데이터 초기화 전에 추가
SET FOREIGN_KEY_CHECKS = 0;

-- 역순으로 TRUNCATE (참조되는 테이블을 나중에)
TRUNCATE TABLE user_roles;
TRUNCATE TABLE role_permissions;
TRUNCATE TABLE user_organizations;
TRUNCATE TABLE users;
TRUNCATE TABLE positions;
TRUNCATE TABLE departments;
TRUNCATE TABLE roles;
TRUNCATE TABLE permissions;
TRUNCATE TABLE organizations;

SET FOREIGN_KEY_CHECKS = 1;
330 changes: 330 additions & 0 deletions apps/user-service/src/main/resources/sql/01-insert-internal-users.sql

Large diffs are not rendered by default.

661 changes: 0 additions & 661 deletions apps/user-service/src/main/resources/sql/insert-internal-users.sql

This file was deleted.

15 changes: 1 addition & 14 deletions docker/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
volumes:
- mariadb_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-pqwer1234"]
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "mariadb", "-pqwer1234"]
interval: 10s
timeout: 5s
retries: 5
Expand All @@ -33,18 +33,5 @@ services:
depends_on:
- mariadb

# pre-processing-service:
# build:
# context: ../../apps/pre-processing-service # 프로젝트 루트 (Dockerfile이 루트에 없으면 맞게 조정)
# dockerfile: Dockerfile # Dockerfile 경로 (루트에 없다면 상대경로로 수정)
# image: pre-processing-service:latest
# container_name: pre-processing-service
# restart: always
# ports:
# - "8000:8000"
# env_file:
# - ../../apps/pre-processing-service/.env # 공통
# - ../../apps/pre-processing-service/dev.env # 개발

volumes:
mariadb_data:
Loading