Skip to content

Commit

Permalink
Merge pull request #14 from AgileHub-DQ/feat/13
Browse files Browse the repository at this point in the history
[#13] application.yml 설정 및 health check api 구현
  • Loading branch information
Enble authored Mar 4, 2024
2 parents 6c149cc + a366af8 commit 147b222
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ COPY --from=build /app/build/libs/*.jar /app/agile.jar

EXPOSE 8080
ENTRYPOINT ["java"]
CMD ["-jar","agile.jar"]
CMD ["-jar","-Dspring.profiles.active=prod","agile.jar"]
8 changes: 7 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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<String> health() {
return ResponseEntity.ok("OK");
}

}
1 change: 0 additions & 1 deletion src/main/resources/application.properties

This file was deleted.

53 changes: 53 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 147b222

Please sign in to comment.