From 754a8c4f83a0af0fab33cb6073a9a7bd5f1da93c Mon Sep 17 00:00:00 2001 From: CheonMinJae Date: Mon, 6 Jan 2025 23:49:12 +0900 Subject: [PATCH 1/5] =?UTF-8?q?jpa,=20postegresql=20driver=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index d1c1f24..87d4559 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -3,9 +3,6 @@ server: address: spring: - application: - name: study-group - jpa: hibernate: ddl-auto: update @@ -14,4 +11,5 @@ spring: format_sql: true create_empty_composites: enabled: true - show-sql: true \ No newline at end of file + show-sql: true + From a260fdc6280ac46c7bd3ba26226dd4255144fbad Mon Sep 17 00:00:00 2001 From: CheonMinJae Date: Mon, 6 Jan 2025 23:55:51 +0900 Subject: [PATCH 2/5] =?UTF-8?q?postgresql=20driver=20=EB=B0=8F=20jpa=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 650781e..c5c9cd2 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,9 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' compileOnly 'org.projectlombok:lombok' + runtimeOnly 'org.postgresql:postgresql' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' From 15f780ed3e6f07ae4851464e3c723e0e6cd90ed6 Mon Sep 17 00:00:00 2001 From: CheonMinJae Date: Mon, 6 Jan 2025 23:56:27 +0900 Subject: [PATCH 3/5] =?UTF-8?q?driver=20=EC=97=B0=EA=B2=B0=20=EB=B0=8F=20s?= =?UTF-8?q?erver.env=20db.env=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 87d4559..ecfe3b1 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,8 +1,14 @@ server: - port: 8080 - address: + port: ${SERVER_PORT} + address: ${SERVER_ADDRESS} spring: + datasource: + driver-class-name: org.postgresql.Driver + url: jdbc:postgresql://${POSTGRESQL_URL}:${POSTGRESQL_PORT}/${POSTGRESQL_DB} + username: ${POSTGRESQL_USER} + password: ${POSTGRESQL_PASSWORD} + jpa: hibernate: ddl-auto: update From 6cdb08d096bf813ddc5615cde0b85abc2874d32a Mon Sep 17 00:00:00 2001 From: CheonMinJae Date: Tue, 7 Jan 2025 18:03:01 +0900 Subject: [PATCH 4/5] =?UTF-8?q?docker=20compose=20=EC=97=90=20db=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 6 +++--- build.gradle | 2 +- compose.yaml | 20 ++++++++++++++++++- .../study_group/StudyGroupApplication.java | 9 ++++----- src/main/resources/application.yml | 9 ++++----- .../StudyGroupApplicationTests.java | 11 ---------- 6 files changed, 31 insertions(+), 26 deletions(-) rename src/main/java/com/{example => gdgoc}/study_group/StudyGroupApplication.java (56%) delete mode 100644 src/test/java/com/example/study_group/StudyGroupApplicationTests.java diff --git a/.dockerignore b/.dockerignore index 8893889..dd3a1b7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,7 +7,7 @@ **/.DS_Store **/.classpath **/.dockerignore -**/.env +#**/.env **/.factorypath **/.git **/.gitignore @@ -23,8 +23,8 @@ **/*.dbmdl **/*.jfm **/charts -**/docker-compose* -**/compose.y*ml +#**/docker-compose* +#**/compose.y*ml **/Dockerfile* **/secrets.dev.yaml **/values.dev.yaml diff --git a/build.gradle b/build.gradle index c5c9cd2..70d7198 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'com.diffplug.spotless' version '6.25.0' } -group = 'com.example' +group = 'com.gdgoc' version = '0.0.1-SNAPSHOT' java { diff --git a/compose.yaml b/compose.yaml index eebbc26..f4198d6 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,7 +1,25 @@ services: server: + env_file: + - ./env/server.env + - ./env/db.env platform: linux/arm64 build: context: . ports: - - 8080:8080 \ No newline at end of file + - "8080:8080" + depends_on: + - db + + db: + env_file: + - ./env/db.env + image: postgres + restart: always + ports: + - "5432:5432" + volumes: + - data:/data/db + +volumes: + data: \ No newline at end of file diff --git a/src/main/java/com/example/study_group/StudyGroupApplication.java b/src/main/java/com/gdgoc/study_group/StudyGroupApplication.java similarity index 56% rename from src/main/java/com/example/study_group/StudyGroupApplication.java rename to src/main/java/com/gdgoc/study_group/StudyGroupApplication.java index 60c09ab..a463944 100644 --- a/src/main/java/com/example/study_group/StudyGroupApplication.java +++ b/src/main/java/com/gdgoc/study_group/StudyGroupApplication.java @@ -1,4 +1,4 @@ -package com.example.study_group; +package com.gdgoc.study_group; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -6,8 +6,7 @@ @SpringBootApplication public class StudyGroupApplication { - public static void main(String[] args) { - SpringApplication.run(StudyGroupApplication.class, args); - } - + public static void main(String[] args) { + SpringApplication.run(StudyGroupApplication.class, args); + } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ecfe3b1..f8dc6af 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -5,9 +5,9 @@ server: spring: datasource: driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://${POSTGRESQL_URL}:${POSTGRESQL_PORT}/${POSTGRESQL_DB} - username: ${POSTGRESQL_USER} - password: ${POSTGRESQL_PASSWORD} + url: jdbc:postgresql://${POSTGRES_URL}:${POSTGRES_PORT}/${POSTGRES_DB} + username: ${POSTGRES_USER} + password: ${POSTGRES_PASSWORD} jpa: hibernate: @@ -15,7 +15,6 @@ spring: properties: hibernate: format_sql: true - create_empty_composites: - enabled: true + dialect: org.hibernate.dialect.PostgreSQLDialect show-sql: true diff --git a/src/test/java/com/example/study_group/StudyGroupApplicationTests.java b/src/test/java/com/example/study_group/StudyGroupApplicationTests.java deleted file mode 100644 index 24d4a56..0000000 --- a/src/test/java/com/example/study_group/StudyGroupApplicationTests.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.example.study_group; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class StudyGroupApplicationTests { - - @Test - void contextLoads() {} -} From efd8c695289065cd653e51ddacb7b174b36b0cf2 Mon Sep 17 00:00:00 2001 From: CheonMinJae Date: Tue, 7 Jan 2025 18:18:55 +0900 Subject: [PATCH 5/5] =?UTF-8?q?pgAdmin=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit localhost:8088 에서 접속 가능 --- compose.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compose.yaml b/compose.yaml index f4198d6..2e1d21e 100644 --- a/compose.yaml +++ b/compose.yaml @@ -21,5 +21,16 @@ services: volumes: - data:/data/db + pgadmin: + container_name: pgadmin + image: dpage/pgadmin4 + ports: + - "8088:80" + environment: + - PGADMIN_DEFAULT_EMAIL=gdgoc@admin.com + - PGADMIN_DEFAULT_PASSWORD=0000 + depends_on: + - db + volumes: data: \ No newline at end of file