diff --git a/Dockerfile b/Dockerfile index a80e11a..abb3e38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,4 +26,4 @@ COPY --from=build /app/build/libs/*.jar /app/agile.jar EXPOSE 8080 ENTRYPOINT ["java"] -CMD ["-jar","agile.jar"] \ No newline at end of file +CMD ["-jar","-Dspring.profiles.active=prod","agile.jar"] diff --git a/build.gradle b/build.gradle index a14fead..3e0f80e 100644 --- a/build.gradle +++ b/build.gradle @@ -25,10 +25,16 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-validation' implementation 'org.springframework.boot:spring-boot-starter-web' - compileOnly 'org.projectlombok:lombok' + + // Database : H2, MySQL runtimeOnly 'com.h2database:h2' runtimeOnly 'com.mysql:mysql-connector-j' + + // lombok + compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' + + // test : JUnit5 testImplementation 'org.springframework.boot:spring-boot-starter-test' } diff --git a/src/main/java/dynamicquad/agilehub/global/controller/HealthController.java b/src/main/java/dynamicquad/agilehub/global/controller/HealthController.java new file mode 100644 index 0000000..214c317 --- /dev/null +++ b/src/main/java/dynamicquad/agilehub/global/controller/HealthController.java @@ -0,0 +1,17 @@ +package dynamicquad.agilehub.global.controller; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api") +public class HealthController { + + @GetMapping("/health") + public ResponseEntity health() { + return ResponseEntity.ok("OK"); + } + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 8b13789..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..28cb442 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,53 @@ +spring: + profiles: + active: local + +--- + +# local profile +spring: + config: + activate: + on-profile: local + h2: + console: + enabled: true + path: /h2 + datasource: + url: jdbc:h2:~/agile-hub + username: sa + password: + driver-class-name: org.h2.Driver + jpa: + hibernate: + ddl-auto: create + properties: + hibernate: + dialect: org.hibernate.dialect.H2Dialect + format_sql: true + show_sql: true + use_sql_comments: true + default_batch_fetch_size: 1000 + +--- + +# prod profile +spring: + config: + activate: + on-profile: prod + datasource: + url: ${aws.db.url} + username: ${aws.db.username} + password: ${aws.db.password} + driver-class-name: org.mysql.cj.jdbc.Driver + sql: + init: + mode: never + jpa: + hibernate: + ddl-auto: create + properties: + hibernate: + dialect: org.hibernate.dialect.H2Dialect + default_batch_fetch_size: 1000