Skip to content

Commit

Permalink
🔧 fix: Change jpa ddl-auto option to none for prod
Browse files Browse the repository at this point in the history
  • Loading branch information
noisrucer committed Feb 24, 2024
1 parent 05093c5 commit 1cc1ccc
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 4 deletions.
1 change: 0 additions & 1 deletion .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ env:
ECS_SERVICE: girok-server-prod # set this to your Amazon ECS service name
ECS_CLUSTER: GirokServerCluster # set this to your Amazon ECS cluster name
ECS_TASK_DEFINITION: .aws/task-definition-prod.json # set this to the path to your Amazon ECS task definition
# file, e.g. .aws/task-definition.json
CONTAINER_NAME: girok-server-prod # set this to the name of the container in the
# containerDefinitions section of your task definition

Expand Down
5 changes: 5 additions & 0 deletions Dockerfile_prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:17
EXPOSE 8181
ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
13 changes: 13 additions & 0 deletions env.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DB_HOST=girok2.cw0tsmmlbwmh.ap-northeast-1.rds.amazonaws.com
DB_NAME=girok_dev_spring
DB_USERNAME=jason
DB_PASSWORD=Ckdwls1541*

JWT_SECRET=fhasfhkdfkaflasfasdasfsadsafsdfdsfhasfhkdfkaflasfasdasfsadsafsdfdsdasfadsffhasfhkdfkaflasfasdasfsadsafsdfdssdfdsf
JWT_ACCESS_TOKEN_EXPIRATION_MS=1800000
JWT_REFRESH_TOKEN_EXPIRATION_MS=864000000
MAILGUN_API_KEY=key-3ceb288434a9420c12ef460e365b03d6
MAILGUN_DOMAIN=https://api.mailgun.net/v3/girok.org/messages
VERIFICATION_EXPIRE_SECONDS=180

SPRING_PROFILES_ACTIVE=prod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ResponseEntity<GetCategoriesResponse> getCategories() {
return ResponseEntity.ok().body(new GetCategoriesResponse(categoryResponseDtos));
}

@GetMapping("/categories{id}")
@GetMapping("/categories/{id}")
@ResponseStatus(HttpStatus.OK)
@Operation(summary = "Get a category information")
public ResponseEntity<GetCategoryResponse> getCategory(@PathVariable(name = "id") Long categoryId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,12 @@ public GetAllEventsResponse getAllEvents(Long memberId, EventFilterCriteria crit
System.out.println("fetchChildren = " + fetchChildren);
if (fetchChildren) {
// Recursively fetch all the subcategory ids
System.out.println("recursive fetching");
Category category = categoryService.getCategoryByMemberAndId(member, categoryId);
categoryIds = categoryService.getAllCategoryIdsOfSubtree(category);
} else {
categoryIds = new ArrayList<>(Collections.singletonList(categoryId));
}
}
System.out.println("categoryIds = " + categoryIds);

List<Event> events = eventService.getAllEvents(member, categoryIds, criteria);
List<GetAllEventsResponse.EventDto> eventDtos = new ArrayList<>();
Expand Down
48 changes: 48 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
server:
port: 8181

spring:
config:
activate:
on-profile: prod

datasource:
url: jdbc:mysql://${DB_HOST}:3306/${DB_NAME}?serverTimezone=UTC&characterEncoding=UTF-8
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver

jpa:
hibernate:
ddl-auto: validate

logging.level:
# org.hibernate.SQL: debug
org.springframework.security: DEBUG

springdoc:
packages-to-scan:
- com.girok.girokserver.domain.auth.controller
- com.girok.girokserver.domain.category.controller
- com.girok.girokserver.domain.event.controller
default-consumes-media-type: application/json;charset=UTF-8
default-produces-media-type: application/json;charset=UTF-8
swagger-ui:
path: /
disable-swagger-default-url: true
display-request-duration: true
operations-sorter: method
tags-sorter: alpha

jwt:
secret: ${JWT_SECRET}
access_token_expiration_ms: ${JWT_ACCESS_TOKEN_EXPIRATION_MS}
refresh_token_expiration_ms: ${JWT_REFRESH_TOKEN_EXPIRATION_MS}

mailgun:
api_key: ${MAILGUN_API_KEY}
domain: ${MAILGUN_DOMAIN}

email_verification:
expire_seconds: ${VERIFICATION_EXPIRE_SECONDS}

0 comments on commit 1cc1ccc

Please sign in to comment.