diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 986b461..b5e1b55 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -45,17 +45,20 @@ jobs: source: "./.env" target: "./" + - name: ubuntu Docker image build and push + run: | + docker-compose build -f ./docker/docker-compose.yml + docker-compose push -f ./docker/docker-compose.yml +# - name: ubuntu Docker image build +# run: docker build -t ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:latest -f Dockerfile-server . +# +# - name: Redis Docker image build +# run: docker build -t ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:redis -f Dockerfile-redis . - - name: ubuntu Docker image build - run: docker build -t ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:latest -f Dockerfile-server . - - - name: Redis Docker image build - run: docker build -t ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:redis -f Dockerfile-redis . - - - name: ubuntu docker Hub 푸쉬 - run: docker push ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:latest - - name: Redis docker Hub 푸쉬 - run: docker push ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:redis +# - name: ubuntu docker Hub 푸쉬 +# run: docker push ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:latest +# - name: Redis docker Hub 푸쉬 +# run: docker push ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:redis - name: Deploy with push uses: appleboy/ssh-action@v1.0.0 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..fe0e49a --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3' +services: + server: + build: + context: ./ + dockerfile: server/Dockerfile-server + image: eunchannam/we-share-wish-hair:latest + + redis: + build: + context: ./ + dockerfile: redis/Dockerfile-redis + image: eunchannam/we-share-wish-hair:redis \ No newline at end of file diff --git a/Dockerfile-redis b/docker/redis/Dockerfile-redis similarity index 100% rename from Dockerfile-redis rename to docker/redis/Dockerfile-redis diff --git a/Dockerfile-server b/docker/server/Dockerfile-server similarity index 100% rename from Dockerfile-server rename to docker/server/Dockerfile-server diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/global/config/SchedulerConfig.java b/src/main/java/com/inq/wishhair/wesharewishhair/global/config/SchedulerConfig.java deleted file mode 100644 index 6d674b5..0000000 --- a/src/main/java/com/inq/wishhair/wesharewishhair/global/config/SchedulerConfig.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.inq.wishhair.wesharewishhair.global.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.annotation.EnableScheduling; - -@Configuration -@EnableScheduling -public class SchedulerConfig { -} diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/global/config/database/DataSourceConfig.java b/src/main/java/com/inq/wishhair/wesharewishhair/global/config/database/DataSourceConfig.java new file mode 100644 index 0000000..2d8ffc5 --- /dev/null +++ b/src/main/java/com/inq/wishhair/wesharewishhair/global/config/database/DataSourceConfig.java @@ -0,0 +1,67 @@ +package com.inq.wishhair.wesharewishhair.global.config.database; + +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.context.annotation.Profile; +import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; + +import com.zaxxer.hikari.HikariDataSource; + +@Profile("dev") +@Configuration +public class DataSourceConfig { + + private static final String MASTER_DATASOURCE = "masterDataSource"; + private static final String SLAVE_DATASOURCE = "slaveDataSource"; + private static final String ROUTING_DATASOURCE = "slaveDataSource"; + + @Bean(MASTER_DATASOURCE) + @ConfigurationProperties(prefix = "spring.datasource.master.hikari") + public DataSource masterDataSource() { + return DataSourceBuilder.create() + .type(HikariDataSource.class) + .build(); + } + + @Bean(SLAVE_DATASOURCE) + @ConfigurationProperties(prefix = "spring.datasource.slave.hikari") + public DataSource slaveDataSource() { + return DataSourceBuilder.create() + .type(HikariDataSource.class) + .build(); + } + + @Bean(ROUTING_DATASOURCE) + public DataSource routingDataSource( + @Qualifier(MASTER_DATASOURCE) DataSource masterDataSource, + @Qualifier(SLAVE_DATASOURCE) DataSource slaveDataSource + ) { + RoutingDataSource routingDataSource = new RoutingDataSource(); + + Map datasourceMap = new HashMap<>(); + datasourceMap.put("master", masterDataSource); + datasourceMap.put("slave", slaveDataSource); + + routingDataSource.setTargetDataSources(datasourceMap); + routingDataSource.setDefaultTargetDataSource(masterDataSource); + + return routingDataSource; + } + + @Bean + @Primary + public LazyConnectionDataSourceProxy dataSource( + @Qualifier(ROUTING_DATASOURCE) DataSource routingDataSource + ){ + return new LazyConnectionDataSourceProxy(routingDataSource); + } +} diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/global/config/database/RoutingDataSource.java b/src/main/java/com/inq/wishhair/wesharewishhair/global/config/database/RoutingDataSource.java new file mode 100644 index 0000000..ebb6634 --- /dev/null +++ b/src/main/java/com/inq/wishhair/wesharewishhair/global/config/database/RoutingDataSource.java @@ -0,0 +1,12 @@ +package com.inq.wishhair.wesharewishhair.global.config.database; + +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; +import org.springframework.transaction.support.TransactionSynchronizationManager; + +public class RoutingDataSource extends AbstractRoutingDataSource { + + @Override + protected Object determineCurrentLookupKey() { + return (TransactionSynchronizationManager.isCurrentTransactionReadOnly()) ? "slave" : "master"; + } +} diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/application/LikeReviewTestService.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/application/LikeReviewTestService.java new file mode 100644 index 0000000..a3a6aac --- /dev/null +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/application/LikeReviewTestService.java @@ -0,0 +1,53 @@ +package com.inq.wishhair.wesharewishhair.review.application; + +import org.springframework.stereotype.Service; + +import com.inq.wishhair.wesharewishhair.global.utils.RedisUtils; +import com.inq.wishhair.wesharewishhair.review.domain.entity.Review; +import com.inq.wishhair.wesharewishhair.review.domain.likereview.LikeReview; +import com.inq.wishhair.wesharewishhair.review.domain.likereview.LikeReviewRepository; + +import lombok.RequiredArgsConstructor; + +@Service +@RequiredArgsConstructor +public class LikeReviewTestService { + + private final LikeReviewRepository likeReviewRepository; + private final ReviewFindService reviewFindService; + private final RedisUtils redisUtils; + + public long count(Long reviewId) { + return likeReviewRepository.countByReviewId(reviewId); + } + + public void clean() { + likeReviewRepository.deleteAll(); + } + + /** + * LikeReview 생성 후 Review 에 락걸고 likeCount 변수 update + */ + public void withLock(Long reviewId, Long userId) { + likeReviewRepository.save(LikeReview.addLike(userId, reviewId)); + + Review review = reviewFindService.getWithLockById(reviewId); + review.addLike(); + } + + /** + * 레디스에 좋아요 정보가 없으면 새로 등록하고 있으면 INCR 수행 + */ + public void withoutLock(Long reviewId, Long userId) { + likeReviewRepository.save(LikeReview.addLike(userId, reviewId)); + + redisUtils.getData(reviewId) + .ifPresentOrElse( + likeCount -> redisUtils.increaseData(reviewId), + () -> { + Long likeCount = likeReviewRepository.countByReviewId(reviewId); + redisUtils.setData(reviewId, likeCount); + } + ); + } +} diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/application/ReviewFindService.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/application/ReviewFindService.java index 45acc51..56a4b8f 100644 --- a/src/main/java/com/inq/wishhair/wesharewishhair/review/application/ReviewFindService.java +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/application/ReviewFindService.java @@ -25,4 +25,8 @@ public Review findWithPhotosById(Long id) { public List findWithPhotosByUserId(Long userId) { return reviewRepository.findWithPhotosByWriterId(userId); } + + public Review getWithLockById(Long id) { + return reviewRepository.findWithLockById(id).orElseThrow(); + } } diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/application/dto/response/ReviewResponseAssembler.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/application/dto/response/ReviewResponseAssembler.java index f7028c2..0e1f8d1 100644 --- a/src/main/java/com/inq/wishhair/wesharewishhair/review/application/dto/response/ReviewResponseAssembler.java +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/application/dto/response/ReviewResponseAssembler.java @@ -53,6 +53,22 @@ public static ReviewResponse toReviewResponse(Review review, Long likeCount) { .build(); } + public static ReviewResponse toReviewResponse(Review review) { + + return ReviewResponse.builder() + .reviewId(review.getId()) + .hairStyleName(review.getHairStyle().getName()) + .userNickname(review.getWriter().getNicknameValue()) + .score(review.getScore().getValue()) + .contents(review.getContentsValue()) + .createdDate(review.getCreatedDate()) + .photos(toPhotoResponses(review.getPhotos())) + .likes(review.getLikeCount()) + .hashTags(toHashTagResponses(review.getHairStyle().getHashTags())) + .writerId(review.getWriter().getId()) + .build(); + } + public static ReviewDetailResponse toReviewDetailResponse( Review review, Long likeCount, @@ -79,4 +95,14 @@ public static ResponseWrapper toWrappedReviewResponse( return new ResponseWrapper<>(reviewResponses); } + + public static ResponseWrapper toWrappedReviewResponse( + List responses + ) { + List reviewResponses = responses.stream() + .map(ReviewResponseAssembler::toReviewResponse) + .toList(); + + return new ResponseWrapper<>(reviewResponses); + } } diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/ReviewRepository.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/ReviewRepository.java index fdc93e5..6777566 100644 --- a/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/ReviewRepository.java +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/ReviewRepository.java @@ -20,4 +20,6 @@ public interface ReviewRepository { void deleteByIdIn(List reviewIds); void delete(Review review); + + Optional findWithLockById(Long id); } diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/entity/Review.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/entity/Review.java index f5fcbe5..bdc9e6a 100644 --- a/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/entity/Review.java +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/entity/Review.java @@ -53,6 +53,8 @@ public class Review extends BaseEntity { @JoinColumn(name = "hair_style_id", foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT)) private HairStyle hairStyle; + private long likeCount = 0; + private Review(User writer, String contents, Score score, List photos, HairStyle hairStyle) { this.writer = writer; this.contents = new Contents(contents); @@ -91,6 +93,10 @@ public void updateReview(Contents contents, Score score, List storeUrls) updatePhotos(storeUrls); } + public void addLike() { + this.likeCount++; + } + private void updateContents(Contents contents) { this.contents = contents; } diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/likereview/LikeReviewRepository.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/likereview/LikeReviewRepository.java index b8b9e19..b53b943 100644 --- a/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/likereview/LikeReviewRepository.java +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/domain/likereview/LikeReviewRepository.java @@ -15,4 +15,6 @@ public interface LikeReviewRepository { boolean existsByUserIdAndReviewId(Long userId, Long reviewId); void deleteByReviewIdIn(List reviewIds); + + void deleteAll(); } diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/LikeReviewJpaRepository.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/LikeReviewJpaRepository.java index 1d35535..285dd47 100644 --- a/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/LikeReviewJpaRepository.java +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/LikeReviewJpaRepository.java @@ -19,4 +19,6 @@ public interface LikeReviewJpaRepository extends LikeReviewRepository, JpaReposi boolean existsByUserIdAndReviewId(Long userId, Long reviewId); void deleteByReviewIdIn(@Param("reviewIds") List reviewIds); + + void deleteAll(); } diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewJpaRepository.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewJpaRepository.java index 4200ba5..838f042 100644 --- a/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewJpaRepository.java +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewJpaRepository.java @@ -5,10 +5,13 @@ import org.springframework.data.jpa.repository.EntityGraph; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Lock; import com.inq.wishhair.wesharewishhair.review.domain.ReviewRepository; import com.inq.wishhair.wesharewishhair.review.domain.entity.Review; +import jakarta.persistence.LockModeType; + public interface ReviewJpaRepository extends ReviewRepository, JpaRepository { //review find service - 리뷰 단순 조회 @@ -19,4 +22,7 @@ public interface ReviewJpaRepository extends ReviewRepository, JpaRepository findWithPhotosByWriterId(Long writerId); void deleteByIdIn(List reviewIds); + + @Lock(LockModeType.PESSIMISTIC_WRITE) + Optional findWithLockById(Long id); } diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewQueryDslRepository.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewQueryDslRepository.java index 9019425..be6d529 100644 --- a/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewQueryDslRepository.java +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewQueryDslRepository.java @@ -17,7 +17,10 @@ import com.inq.wishhair.wesharewishhair.review.domain.entity.QReview; import com.inq.wishhair.wesharewishhair.review.domain.entity.Review; import com.inq.wishhair.wesharewishhair.review.domain.likereview.QLikeReview; +import com.querydsl.core.types.ConstructorExpression; import com.querydsl.core.types.OrderSpecifier; +import com.querydsl.core.types.dsl.CaseBuilder; +import com.querydsl.core.types.dsl.NumberExpression; import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQueryFactory; @@ -33,6 +36,45 @@ public class ReviewQueryDslRepository implements ReviewQueryRepository { private final QReview review = new QReview("r"); private final QLikeReview like = new QLikeReview("l"); + private final NumberExpression likes = new CaseBuilder() + .when(like.id.sum().isNull()) + .then(0L) + .otherwise(review.id.count()); + + public List joinWithLikeQuery() { + return factory + .select(assembleReviewProjection()) + .from(review) + .leftJoin(like).on(review.id.eq(like.reviewId)) + .leftJoin(review.hairStyle) + .fetchJoin() + .leftJoin(review.writer) + .fetchJoin() + .groupBy(review.id) + .orderBy(review.id.desc()) + .offset(0) + .limit(20) + .fetch(); + } + + public List noJoinQuery() { + return factory + .select(review) + .from(review) + .leftJoin(review.hairStyle) + .fetchJoin() + .leftJoin(review.writer) + .fetchJoin() + .orderBy(review.id.desc()) + .offset(0) + .limit(20) + .fetch(); + } + + private ConstructorExpression assembleReviewProjection() { + return new QReviewQueryResponse(review, likes.as("likes")); + } + @Override public Optional findReviewById(Long id) { return Optional.ofNullable( diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewQueryResponse.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewQueryResponse.java new file mode 100644 index 0000000..c3e718b --- /dev/null +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/infrastructure/ReviewQueryResponse.java @@ -0,0 +1,19 @@ +package com.inq.wishhair.wesharewishhair.review.infrastructure; + +import com.inq.wishhair.wesharewishhair.review.domain.entity.Review; +import com.querydsl.core.annotations.QueryProjection; + +import lombok.Getter; + +@Getter +public class ReviewQueryResponse { + + private final Review review; + private final long likes; + + @QueryProjection + public ReviewQueryResponse(Review review, long likes) { + this.review = review; + this.likes = likes; + } +} \ No newline at end of file diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/presentation/LikeReviewTestController.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/presentation/LikeReviewTestController.java new file mode 100644 index 0000000..b710e2d --- /dev/null +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/presentation/LikeReviewTestController.java @@ -0,0 +1,54 @@ +package com.inq.wishhair.wesharewishhair.review.presentation; + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.inq.wishhair.wesharewishhair.global.annotation.FetchAuthInfo; +import com.inq.wishhair.wesharewishhair.global.dto.response.Success; +import com.inq.wishhair.wesharewishhair.global.resolver.dto.AuthInfo; +import com.inq.wishhair.wesharewishhair.review.application.LikeReviewTestService; + +import lombok.RequiredArgsConstructor; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/like") +public class LikeReviewTestController { + + private final LikeReviewTestService likeReviewService; + + @PostMapping("/test/clean") + public Success clean() { + likeReviewService.clean(); + return new Success(); + } + + @PostMapping("/test/count/{reviewId}") + public Result count(@PathVariable Long reviewId) { + likeReviewService.clean(); + return new Result(likeReviewService.count(reviewId)); + } + + @PostMapping("/test/lock/{reviewId}") + public Success withLock( + @PathVariable Long reviewId, + @FetchAuthInfo AuthInfo authInfo + ) { + likeReviewService.withLock(reviewId, authInfo.userId()); + return new Success(); + } + + @PostMapping("/test/no_lock/{reviewId}") + public Success withoutLock( + @PathVariable Long reviewId, + @FetchAuthInfo AuthInfo authInfo + ) { + likeReviewService.withoutLock(reviewId, authInfo.userId()); + return new Success(); + } + + record Result(long count) { + } +} diff --git a/src/main/java/com/inq/wishhair/wesharewishhair/review/presentation/ReviewQueryTestController.java b/src/main/java/com/inq/wishhair/wesharewishhair/review/presentation/ReviewQueryTestController.java new file mode 100644 index 0000000..ba368af --- /dev/null +++ b/src/main/java/com/inq/wishhair/wesharewishhair/review/presentation/ReviewQueryTestController.java @@ -0,0 +1,39 @@ +package com.inq.wishhair.wesharewishhair.review.presentation; + +import java.util.List; + +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.inq.wishhair.wesharewishhair.global.dto.response.ResponseWrapper; +import com.inq.wishhair.wesharewishhair.review.application.dto.response.ReviewResponse; +import com.inq.wishhair.wesharewishhair.review.application.dto.response.ReviewResponseAssembler; +import com.inq.wishhair.wesharewishhair.review.domain.entity.Review; +import com.inq.wishhair.wesharewishhair.review.infrastructure.ReviewQueryDslRepository; +import com.inq.wishhair.wesharewishhair.review.infrastructure.ReviewQueryResponse; + +import lombok.RequiredArgsConstructor; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/api/reviews/test") +public class ReviewQueryTestController { + + private final ReviewQueryDslRepository reviewQueryDslRepository; + + @Transactional(readOnly = true) + public ResponseWrapper withJoin() { + List reviews = reviewQueryDslRepository.joinWithLikeQuery() + .stream() + .map(ReviewQueryResponse::getReview) + .toList(); + return ReviewResponseAssembler.toWrappedReviewResponse(reviews); + } + + @Transactional(readOnly = true) + public ResponseWrapper withoutJoin() { + List reviews = reviewQueryDslRepository.noJoinQuery(); + return ReviewResponseAssembler.toWrappedReviewResponse(reviews); + } +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml new file mode 100644 index 0000000..b6da193 --- /dev/null +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,91 @@ +server: + port: 8080 + + +spring: + data: + redis: + host: 3.21.14.25 + port: 6379 + expire-time: 21600000 + + datasource: + master: + hikari: + driver-class-name: com.mysql.cj.jdbc.Driver + jdbc-url: jdbc:mysql://localhost:3306/db + username: root + password: 1234 + slave: + hikari: + driver-class-name: com.mysql.cj.jdbc.Driver + jdbc-url: jdbc:mysql://localhost:3307/db + username: root + password: 1234 + + jpa: + hibernate: + ddl-auto: update + + properties: + hibernate: + default_batch_fetch_size: 100 + show_sql: true + format_sql: true + + open-in-view: false + + mail: + host: smtp.gmail.com + port: 587 + username: namhm23@kyonggi.ac.kr + password: qkvpxhpgyuywcbgh + protocol: smtp + properties: + mail: + smtp: + starttls: + enable: true + auth: true + + servlet: + multipart: + max-file-size: 10MB + +# 포인트 메일 수신자 # +mail: + point-mail-receiver: namhm23@naver.com + +# Flask domain # +flask: + domain: http://domain/ + +#p6spy 설정 +decorator: + datasource: + p6spy: + enable-logging: true + +#JWT key +jwt: + secret-key: abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc + access-token-validity: 180000000 + refresh-token-validity: 259200000 + +# 네이버 클라우드 오브젝트 스토리지 +cloud: + aws: + credentials: + access-key: N3JCSJUtgse4alKEaOqX + secret-key: rRamLrfUV8v6ZziJFEN4CVLjE9rl4kCBnEOLje5f + stack: + auto: false + region: + static: ap-northeast-2 + s3: + endpoint: https://kr.object.ncloudstorage.com + bucket: wswh-storage + +logging: + level: + root: info \ No newline at end of file diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index a44ee49..9d322ed 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -1,21 +1,19 @@ server: port: 8080 + spring: data: redis: - host: 3.21.14.25 + host: 3.21.14.25~ port: 6379 expire-time: 21600000 datasource: - driver-class-name: org.h2.Driver - url: jdbc:h2:mem:test_db;MODE=MySQL; - username: sa - password: - h2: - console: - enabled: true + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://wswh-master-db.cgr8ovkfv2rw.us-east-2.rds.amazonaws.com/wswh_db + username: admin + password: dksk7946447 jpa: hibernate: @@ -54,14 +52,6 @@ mail: flask: domain: http://domain/ -# 서버 런시 발생하는 에러 로그 방지 -logging: - level: - com: - amazonaws: - util: - EC2MetadataUtils: error - #p6spy 설정 decorator: datasource: @@ -86,4 +76,26 @@ cloud: static: ap-northeast-2 s3: endpoint: https://kr.object.ncloudstorage.com - bucket: wswh-storage \ No newline at end of file + bucket: wswh-storage +logging: + level: + root: info +--- +spring: + config: + activate: + on-profile: dev + + datasource: + master: + hikari: + username: root + password: 1234 + driver-class-name: com.mysql.cj.jdbc.Driver + jdbc-url: jdbc:mysql://localhost:3306/db + slave: + hikari: + username: root + password: 1234 + driver-class-name: com.mysql.cj.jdbc.Driver + jdbc-url: jdbc:mysql://localhost:3307/db