Skip to content

Commit

Permalink
Refactor: 배포준비
Browse files Browse the repository at this point in the history
  • Loading branch information
unanchoi committed Jul 1, 2024
1 parent 52c701e commit f51341f
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ application-prod.yaml
application-*.yml
pophory_fcm.json
secret.properties
.env
docker-compose.yml
```
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM amazoncorretto:17
FROM amd64/amazoncorretto:21

ARG JAR_FILE=pophory-api/build/libs/*.jar

COPY ${JAR_FILE} app.jar

ENTRYPOINT ["java","-jar", "/app.jar"]
ENTRYPOINT ["java","-jar", "-Dspring.profiles.active=test", "/app.jar"]
6 changes: 1 addition & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ project("pophory-api") {
val bootJar: BootJar by tasks

bootJar.enabled = true
jar.enabled = true
jar.enabled = false

}

Expand Down Expand Up @@ -161,10 +161,6 @@ project("pophory-common") {
// Security
implementation("org.springframework.boot:spring-boot-starter-security")
testImplementation("org.springframework.security:spring-security-test")

// swagger
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0")
implementation("org.springdoc:springdoc-openapi-starter-common:2.3.0")
}

val jar: Jar by tasks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pophory.pophorycommon.config;
package com.pophory.pophoryapi.config;

import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

@Service
Expand Down Expand Up @@ -115,7 +116,7 @@ private void checkNicknameDuplicate(String nickName) {
}

private Member findMemberById(Long id) {
return memberJpaRepository.findById(id).orElseThrow(
return Objects.requireNonNull(memberJpaRepository.findByIdForUpdate(id)).orElseThrow(
() -> new EntityNotFoundException("Member가 존재하지 않습니다. id: " + id)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ private ObjectMetadata getObjectMetadata(MultipartFile file) {
objectMetadata.setContentLength(file.getSize());
objectMetadata.setContentType(file.getContentType());
objectMetadata.setContentDisposition("inline");
objectMetadata.setLastModified(new Date());
return objectMetadata;
}

Expand Down
69 changes: 69 additions & 0 deletions pophory-api/src/main/resources/application-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
spring:
config:
activate:
on-profile: test
import: secret.properties
jpa:
hibernate:
ddl-auto: create
properties:
hibernate:
dialect: org.hibernate.dialect.MySQLDialect

jwt:
secret: ${JWT_SECRET}
access-token:
expiration-time: 7200000
refresh-token:
expiration-time: 1209600000

jwt.APPLE_URL: ${APPLE_URL}
jwt.KAKAO_URL: ${KAKAO_URL}

sentry:
dsn: ${SENTRY_DSN}
environment: local
traces-sample-rate: 1.0
enable-tracing: true
exception-resolver-order: -2147483647

slack:
bot:
token: ${SLACK_BOT_TOKEN}
channel:
sign-in: ${SLACK_SIGNIN_CHANNEL}
monitor: ${SLACK_MONITORING_CHANNEL}

fcm:
file-path: pophory_fcm.json
api:
url: ${FCM_URL}
google:
api: https://www.googleapis.com/auth/cloud-platform

cloud:
aws:
CLOUDFRONT: ${CLOUDFRONT}
region:
static: ${S3_REGION}
credentials:
accessKey: ${S3_ACCESS_KEY}
secretKey: ${S3_SECRET_KEY}
s3:
bucket: ${S3_BUCKET}
pophorysm:
id: ${POPHORYSM_ID}

springdoc:
packages-to-scan: com.pophory.pophoryapi
default-consumes-media-type: application/json;charset=UTF-8
default-produces-media-type: application/json;charset=UTF-8
swagger-ui:
tags-sorter: alpah
operations-sorter: alpha
api-docs:
path: /api-docs/json
groups:
enabled: true
cache:
disabled: true

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ package com.pophory.pophorydomain.member.infrastructure

import com.pophory.pophorydomain.member.Member
import com.pophory.pophorydomain.member.SocialType
import jakarta.persistence.LockModeType
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Lock
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.query.Param
import java.util.*

interface MemberJpaRepository : JpaRepository<Member, Long> {

@Lock(LockModeType.PESSIMISTIC_WRITE)
@Query("select m from Member m where m.id = :id")
fun findByIdForUpdate(@Param("id") id: Long) : Optional<Member?>?
fun existsMemberByNickname(nickname: String?): Boolean
fun existsMemberBySocialIdAndSocialType(socialId: String?, socialType: SocialType?): Boolean

Expand Down

0 comments on commit f51341f

Please sign in to comment.