From 60c0dc4ef3f82e1959c30ae786a2d5821a78fa55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9A=B0=EB=94=94?= <38103085+EunjiShin@users.noreply.github.com> Date: Mon, 5 Aug 2024 23:49:00 +0900 Subject: [PATCH 01/13] =?UTF-8?q?[NO=5FJIRA]=20=EA=B2=BD=EA=B8=B0=EC=9E=A5?= =?UTF-8?q?=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=ED=95=84=EB=93=9C=20=EA=B8=B8?= =?UTF-8?q?=EC=9D=B4=20=EC=A1=B0=EC=A0=95=20(#117)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 경기장 이미지 필드 길이 조정 * fix: 잘못 올라간 grafana 파일 삭제 --- .../infrastructure/jpa/stadium/entity/StadiumEntity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/stadium/entity/StadiumEntity.java b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/stadium/entity/StadiumEntity.java index c572da16..f9516b71 100644 --- a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/stadium/entity/StadiumEntity.java +++ b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/jpa/stadium/entity/StadiumEntity.java @@ -19,13 +19,13 @@ public class StadiumEntity extends BaseEntity { @Column(name = "name", nullable = false, length = 50) private String name; - @Column(name = "main_image", length = 255) + @Column(name = "main_image", length = 300) private String mainImage; - @Column(name = "seating_chart_image", length = 255) + @Column(name = "seating_chart_image", length = 300) private String seatingChartImage; - @Column(name = "labeled_seating_chart_image", length = 255) + @Column(name = "labeled_seating_chart_image", length = 300) private String labeledSeatingChartImage; @Column(name = "is_active", nullable = false) From 2f5d7a3d613e0bf5314f5832e1657a06bffd028a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9A=B0=EB=94=94?= <38103085+EunjiShin@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:46:10 +0900 Subject: [PATCH 02/13] =?UTF-8?q?fix:=20loki=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=A0=84=EA=B9=8C=EC=A7=80=20prod=EC=97=90=20Loki=20Appender?= =?UTF-8?q?=20=EB=B9=84=ED=99=9C=EC=84=B1=ED=99=94=20(#119)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/src/main/resources/logback-spring.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/resources/logback-spring.xml b/application/src/main/resources/logback-spring.xml index ebd75254..119d005d 100644 --- a/application/src/main/resources/logback-spring.xml +++ b/application/src/main/resources/logback-spring.xml @@ -18,7 +18,7 @@ - + From f7ea2b16867515ce32ccf29bcddd5497890e790b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9A=B0=EB=94=94?= <38103085+EunjiShin@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:23:37 +0900 Subject: [PATCH 03/13] =?UTF-8?q?feat:=20http=EC=97=90=EC=84=9C=20presigne?= =?UTF-8?q?d=20url=20403=20=ED=99=95=EC=9D=B8=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20=EB=A1=9C=EA=B7=B8=20=EC=B6=94=EA=B0=80=20(#120)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/src/main/resources/logback-spring.xml | 2 +- .../aws/objectstorage/PresignedUrlGenerator.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/application/src/main/resources/logback-spring.xml b/application/src/main/resources/logback-spring.xml index 119d005d..cbacde37 100644 --- a/application/src/main/resources/logback-spring.xml +++ b/application/src/main/resources/logback-spring.xml @@ -15,7 +15,7 @@ - + diff --git a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/aws/objectstorage/PresignedUrlGenerator.java b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/aws/objectstorage/PresignedUrlGenerator.java index d8f259e8..eb490d6e 100644 --- a/infrastructure/src/main/java/org/depromeet/spot/infrastructure/aws/objectstorage/PresignedUrlGenerator.java +++ b/infrastructure/src/main/java/org/depromeet/spot/infrastructure/aws/objectstorage/PresignedUrlGenerator.java @@ -32,6 +32,7 @@ public class PresignedUrlGenerator implements CreatePresignedUrlPort { @Override public String forImage(final Long memberId, PresignedUrlRequest request) { + log.info("presigned url generator: forImage"); isValidImageExtension(request.getFileExtension()); final ImageExtension fileExtension = ImageExtension.from(request.getFileExtension()); @@ -50,16 +51,19 @@ private void isValidImageExtension(final String fileExtension) { } private URL createPresignedUrl(final String fileName) { + log.info("presigned url generator: createPresignedUrl"); return amazonS3.generatePresignedUrl(createGeneratePreSignedUrlRequest(fileName)); } private GeneratePresignedUrlRequest createGeneratePreSignedUrlRequest(final String fileName) { + log.info("presigned url generator: createGeneratePreSignedUrlRequest"); final String bucketName = ObjectStorageConfig.BUCKET_NAME; GeneratePresignedUrlRequest generatePresignedUrlRequest = new GeneratePresignedUrlRequest(bucketName, fileName) .withMethod(HttpMethod.PUT) .withExpiration(createPreSignedUrlExpiration()); + log.info("presigned url generator: addRequestParameter"); generatePresignedUrlRequest.addRequestParameter( Headers.S3_CANNED_ACL, CannedAccessControlList.PublicRead.toString()); From f8e7f8e7d8a447a052dd3ec1804912b44bd5c066 Mon Sep 17 00:00:00 2001 From: Minseong Park <52368015+pminsung12@users.noreply.github.com> Date: Wed, 7 Aug 2024 23:49:36 +0900 Subject: [PATCH 04/13] =?UTF-8?q?[BSVR-190]=20=EA=B0=9C=EB=B0=9C=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20AWS=20=EB=A7=88=EC=9D=B4=EA=B7=B8=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20(#122)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: ncp->aws application 파일 네이밍 수정 && gitignore 추가 * feat: aws 마이크레이션으로 인한 object storage 코드 수정 * feat: aws 마이크레이션으로 인한 object storage 코드 수정 * feat: cicd 스크립트 수정 및 console appender loki부분 주석처리 * feat: 프로필 dev로 롤백 * feat: 최소힙 512 도커파일 수정 * test: s3쪽 테스트 코드 수정 --- .github/workflows/dev-build-and-deploy.yaml | 13 ++-- .github/workflows/manual-prod-deploy.yaml | 68 +++++++++++++------ .gitignore | 1 + Dockerfile | 11 ++- .../resources/appenders/console-appender.xml | 2 +- .../src/main/resources/application.yaml | 8 +-- .../aws/config/ObjectStorageConfig.java | 7 +- .../aws/objectstorage/ImageUploader.java | 5 +- .../objectstorage/PresignedUrlGenerator.java | 5 +- .../aws/property/ObjectStorageProperties.java | 4 +- .../src/main/resources/application-ncp.yaml | 4 -- .../aws/PresignedUrlGeneratorTest.java | 2 +- 12 files changed, 82 insertions(+), 48 deletions(-) delete mode 100644 infrastructure/src/main/resources/application-ncp.yaml diff --git a/.github/workflows/dev-build-and-deploy.yaml b/.github/workflows/dev-build-and-deploy.yaml index 945630bf..6766dd9c 100644 --- a/.github/workflows/dev-build-and-deploy.yaml +++ b/.github/workflows/dev-build-and-deploy.yaml @@ -98,10 +98,10 @@ jobs: - name: Deploy to Dev NCP Server uses: appleboy/ssh-action@master with: - host: ${{ secrets.DEV_NCP_SERVER_HOST }} - username: ${{ secrets.DEV_NCP_SERVER_USERNAME }} - password: ${{ secrets.DEV_NCP_SERVER_PASSWORD }} - port: ${{ secrets.DEV_NCP_SERVER_PORT }} + host: ${{ secrets.DEV_SERVER_HOST }} + username: ${{ secrets.DEV_SERVER_USERNAME }} + password: ${{ secrets.DEV_SERVER_PASSWORD }} + port: ${{ secrets.DEV_SERVER_PORT }} script: | docker pull ${{ secrets.DOCKERHUB_USERNAME }}/spot-server:dev-${{ github.sha }} docker stop spot-server-dev || true @@ -117,8 +117,9 @@ jobs: -e OAUTH_KAUTHTOKENURLHOST=${{ secrets.KAUTH_TOKEN_URL_HOST }} \ -e OAUTH_KAUTHUSERURLHOST=${{ secrets.KAUTH_USER_URL_HOST }} \ -e SPRING_JPA_HIBERNATE_DDL_AUTO=validate \ - -e NCP_OBJECT_STORAGE_ACCESS_KEY=${{ secrets.NCP_OBJECT_STORAGE_ACCESS_KEY }} \ - -e NCP_OBJECT_STORAGE_SECRET_KEY=${{ secrets.NCP_OBJECT_STORAGE_SECRET_KEY }} \ + -e AWS_S3_ACCESS_KEY=${{ secrets.AWS_S3_ACCESS_KEY }} \ + -e AWS_S3_SECRET_KEY=${{ secrets.AWS_S3_SECRET_KEY }} \ + -e AWS_S3_BUCKET_NAME=${{ secrets.DEV_AWS_S3_BUCKET_NAME }} \ -e TZ=Asia/Seoul \ -e SENTRY_DSN=${{ secrets.SENTRY_DSN }} \ -e SENTRY_ENABLE_TRACING=true \ diff --git a/.github/workflows/manual-prod-deploy.yaml b/.github/workflows/manual-prod-deploy.yaml index 45573a0f..fa5ac18e 100644 --- a/.github/workflows/manual-prod-deploy.yaml +++ b/.github/workflows/manual-prod-deploy.yaml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: tag: - description: 'Tag to deploy (v1.0.0)' + description: 'Tag to deploy (v0.33.8)' required: true jobs: @@ -16,22 +16,50 @@ jobs: with: ref: ${{ github.event.inputs.tag }} - - name: Deploy to Prod NCP Server - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.PROD_NCP_SERVER_HOST }} - username: ${{ secrets.PROD_NCP_SERVER_USERNAME }} - password: ${{ secrets.PROD_NCP_SERVER_PASSWORD }} - port: ${{ secrets.PROD_NCP_SERVER_PORT }} - script: | - docker pull ${{ secrets.DOCKERHUB_USERNAME }}/spot-server:${{ github.event.inputs.tag }} - docker stop spot-server-prod || true - docker rm spot-server-prod || true - docker run -d --name spot-server-prod \ - -p 8080:8080 \ - -e SPRING_DATASOURCE_URL=${{ secrets.PROD_DB_URL }} \ - -e SPRING_DATASOURCE_USERNAME=${{ secrets.PROD_DB_USERNAME }} \ - -e SPRING_DATASOURCE_PASSWORD=${{ secrets.PROD_DB_PASSWORD }} \ - -e TZ=Asia/Seoul \ - ${{ secrets.DOCKERHUB_USERNAME }}/spot-server:${{ github.event.inputs.tag }} - docker system prune -af \ No newline at end of file + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/spot-server:prod-${{ github.event.inputs.tag }} + + - name: Deploy to PROD - AWS EC2 + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.PROD_AWS_SERVER_HOST }} + username: ${{ secrets.PROD_AWS_SERVER_USERNAME }} + password: ${{ secrets.PROD_AWS_SERVER_PASSWORD }} + port: ${{ secrets.PROD_AWS_SERVER_PORT }} + script: | + docker pull ${{ secrets.DOCKERHUB_USERNAME }}/spot-server:prod-${{ github.event.inputs.tag }} + docker stop spot-server-prod || true + docker rm spot-server-prod || true + docker run -d --name spot-server-prod \ + -p 8080:8080 \ + -e SPRING_PROFILES_ACTIVE=prod \ + -e SPRING_DATASOURCE_URL=${{ secrets.PROD_DB_URL }} \ + -e SPRING_DATASOURCE_USERNAME=${{ secrets.PROD_DB_USERNAME }} \ + -e SPRING_DATASOURCE_PASSWORD=${{ secrets.PROD_DB_PASSWORD }} \ + -e SPRING_JWT_SECRET=${{ secrets.JWT_SECRET }} \ + -e OAUTH_CLIENTID=${{ secrets.KAKAO_CLIENT_ID }} \ + -e OAUTH_KAUTHTOKENURLHOST=${{ secrets.KAUTH_TOKEN_URL_HOST }} \ + -e OAUTH_KAUTHUSERURLHOST=${{ secrets.KAUTH_USER_URL_HOST }} \ + -e SPRING_JPA_HIBERNATE_DDL_AUTO=validate \ + -e AWS_S3_ACCESS_KEY=${{ secrets.AWS_S3_ACCESS_KEY }} \ + -e AWS_S3_SECRET_KEY=${{ secrets.AWS_S3_SECRET_KEY }} \ + -e AWS_S3_BUCKET_NAME=${{ secrets.PROD_AWS_S3_BUCKET_NAME }} \ + -e TZ=Asia/Seoul \ + -e SENTRY_DSN=${{ secrets.SENTRY_DSN }} \ + -e SENTRY_ENABLE_TRACING=true \ + -e SENTRY_ENVIRONMENT=prod \ + ${{ secrets.DOCKERHUB_USERNAME }}/spot-server:prod-${{ github.event.inputs.tag }} + docker system prune -af \ No newline at end of file diff --git a/.gitignore b/.gitignore index 04ea8a7b..9f5307c8 100644 --- a/.gitignore +++ b/.gitignore @@ -388,3 +388,4 @@ gradle-app.setting application-jwt.yml application-kakao.yml application-sentry.yml +application-aws.yaml diff --git a/Dockerfile b/Dockerfile index a9b87f5e..20556426 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,17 @@ FROM gradle:7.4-jdk17 AS build WORKDIR /app COPY . . RUN ./gradlew build -x test - # 실행 스테이지 FROM openjdk:17-jdk-slim WORKDIR /app COPY --from=build /app/application/build/libs/*.jar app.jar EXPOSE 8080 -ENTRYPOINT ["java", "-jar", "app.jar"] \ No newline at end of file +#ENTRYPOINT ["java", "-jar", "app.jar"] + +# JVM 튜닝 옵션 추가 +ENTRYPOINT ["java", \ + "-Xms512m", \ + "-Xmx512m", \ + "-Xminf0.4", \ + "-Xmaxf0.7", \ + "-jar", "app.jar"] \ No newline at end of file diff --git a/application/src/main/resources/appenders/console-appender.xml b/application/src/main/resources/appenders/console-appender.xml index 2722d120..d31218e6 100644 --- a/application/src/main/resources/appenders/console-appender.xml +++ b/application/src/main/resources/appenders/console-appender.xml @@ -14,7 +14,7 @@ - http://localhost:3100/loki/api/v1/push + - - - - - - - - - %highlight([%-5level]) %d{yy-MM-dd HH:mm:ss.SSS} %green([%thread]) %yellow([traceId=%X{traceId}]) %cyan([%logger{0}:%line])-%message%n - - true - - diff --git a/application/src/main/resources/application.yaml b/application/src/main/resources/application.yaml index 7884197d..f26a91b6 100644 --- a/application/src/main/resources/application.yaml +++ b/application/src/main/resources/application.yaml @@ -17,12 +17,14 @@ spring: - aws - jwt - kakao + - monitoring prod: - jpa - aws - jwt - kakao - sentry + - monitoring servlet: multipart: max-file-size: 10MB diff --git a/application/src/main/resources/logback-spring.xml b/application/src/main/resources/logback-spring.xml index cbacde37..3b9ef380 100644 --- a/application/src/main/resources/logback-spring.xml +++ b/application/src/main/resources/logback-spring.xml @@ -1,7 +1,7 @@ - + @@ -15,10 +15,25 @@ - + - + + + + http://${loki.url}:3100/loki/api/v1/push + + + + + %highlight([%-5level]) %d{yy-MM-dd HH:mm:ss.SSS} %green([%thread]) %yellow([traceId=%X{traceId}]) %cyan([%logger{0}:%line])-%message%n + + true + + From c7c03d9c0fbc356482ec0f66039ee732c4496fb1 Mon Sep 17 00:00:00 2001 From: junwon <67488973+wjdwnsdnjs13@users.noreply.github.com> Date: Mon, 12 Aug 2024 19:51:09 +0900 Subject: [PATCH 08/13] [NO-JIRA] jwt fix (#127) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix : 토큰 검증 오류 수정 및 Exception 설정 * feat : (개발용)원하는 id에 대한 jwt 생성 구현 --- .../common/jwt/JwtAuthenticationFilter.java | 3 +- .../application/common/jwt/JwtTokenUtil.java | 14 +++++--- .../controller/JwtCreateController.java | 35 +++++++++++++++++++ 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 application/src/main/java/org/depromeet/spot/application/member/controller/JwtCreateController.java diff --git a/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtAuthenticationFilter.java b/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtAuthenticationFilter.java index f6aae5c4..7fa27c12 100644 --- a/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtAuthenticationFilter.java +++ b/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtAuthenticationFilter.java @@ -39,7 +39,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { "/favicon.ico", "/actuator", "/api/v1/levels/info", - "/kakao" + "/kakao", + "/api/v1/jwts", }; private static final Map> AUTH_METHOD_WHITELIST = diff --git a/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtTokenUtil.java b/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtTokenUtil.java index 8d8e570a..97b787f0 100644 --- a/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtTokenUtil.java +++ b/application/src/main/java/org/depromeet/spot/application/common/jwt/JwtTokenUtil.java @@ -85,12 +85,12 @@ public Jws getClaims(String token) { return Jwts.parserBuilder().setSigningKey(createSignature()).build().parseClaimsJws(token); } - public boolean isValidateToken(String token) { - if (token == null) { + public boolean isValidateToken(String accessToken) { + if (accessToken == null) { throw new CustomJwtException(JwtErrorCode.NONEXISTENT_TOKEN); } try { - Jws claims = getClaims(token); + Jws claims = getClaims(accessToken); return true; } catch (ExpiredJwtException exception) { log.error("Token Expired"); @@ -130,7 +130,11 @@ private Key createSignature() { public String getAccessToken(HttpServletRequest request) { String jwtToken = request.getHeader("Authorization"); - isValidateToken(jwtToken); - return jwtToken.split(" ")[1]; + if (jwtToken == null || jwtToken.isEmpty()) { + throw new CustomJwtException(JwtErrorCode.NONEXISTENT_TOKEN); + } + String accessToken = jwtToken.split(" ")[1]; + isValidateToken(accessToken); + return accessToken; } } diff --git a/application/src/main/java/org/depromeet/spot/application/member/controller/JwtCreateController.java b/application/src/main/java/org/depromeet/spot/application/member/controller/JwtCreateController.java new file mode 100644 index 00000000..6f06404f --- /dev/null +++ b/application/src/main/java/org/depromeet/spot/application/member/controller/JwtCreateController.java @@ -0,0 +1,35 @@ +package org.depromeet.spot.application.member.controller; + +import org.depromeet.spot.application.common.jwt.JwtTokenUtil; +import org.depromeet.spot.application.member.dto.response.JwtTokenResponse; +import org.depromeet.spot.domain.member.Member; +import org.depromeet.spot.domain.member.enums.MemberRole; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@RestController +@RequiredArgsConstructor +@Slf4j +@Tag(name = "Jwt 생성용") +@RequestMapping("/api/v1/jwts") +public class JwtCreateController { + + private final JwtTokenUtil jwtTokenUtil; + + @GetMapping("/{id}") + public JwtTokenResponse jwtTokenCreate( + @PathVariable("id") + @Parameter(name = "id", description = "생성하고자하는 jwt 토큰의 id", required = true) + Long id) { + Member member = Member.builder().id(id).role(MemberRole.ROLE_USER).build(); + + return new JwtTokenResponse(jwtTokenUtil.getJWTToken(member)); + } +} From 1707a5621c2968f17f5aeca6ceaf393957600993 Mon Sep 17 00:00:00 2001 From: Minseong Park <52368015+pminsung12@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:02:30 +0900 Subject: [PATCH 09/13] =?UTF-8?q?[BSVR-202]=20=EB=B0=B0=ED=8F=AC=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A6=BD=ED=8A=B8=EC=97=90=20application-mon?= =?UTF-8?q?itoring=20=ED=99=98=EA=B2=BD=EB=B3=80=EC=88=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(#128)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: dev 배포 스크립트에 loki url 추가 * feat: prod 수동 배포 스크립트에 loki url 추가 --- .github/workflows/dev-build-and-deploy.yaml | 1 + .github/workflows/manual-prod-deploy.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/dev-build-and-deploy.yaml b/.github/workflows/dev-build-and-deploy.yaml index 6766dd9c..e4851e10 100644 --- a/.github/workflows/dev-build-and-deploy.yaml +++ b/.github/workflows/dev-build-and-deploy.yaml @@ -124,6 +124,7 @@ jobs: -e SENTRY_DSN=${{ secrets.SENTRY_DSN }} \ -e SENTRY_ENABLE_TRACING=true \ -e SENTRY_ENVIRONMENT=prod \ + -e LOKI_URL=${{ secrets.LOKI_SERVER_URL }} \ ${{ secrets.DOCKERHUB_USERNAME }}/spot-server:dev-${{ github.sha }} docker system prune -af diff --git a/.github/workflows/manual-prod-deploy.yaml b/.github/workflows/manual-prod-deploy.yaml index fa5ac18e..827b1f54 100644 --- a/.github/workflows/manual-prod-deploy.yaml +++ b/.github/workflows/manual-prod-deploy.yaml @@ -61,5 +61,6 @@ jobs: -e SENTRY_DSN=${{ secrets.SENTRY_DSN }} \ -e SENTRY_ENABLE_TRACING=true \ -e SENTRY_ENVIRONMENT=prod \ + -e LOKI_URL=${{ secrets.LOKI_SERVER_URL }} \ ${{ secrets.DOCKERHUB_USERNAME }}/spot-server:prod-${{ github.event.inputs.tag }} docker system prune -af \ No newline at end of file From ea132a59403c307d263f253607be01d436cc3955 Mon Sep 17 00:00:00 2001 From: Minseong Park <52368015+pminsung12@users.noreply.github.com> Date: Mon, 12 Aug 2024 22:47:59 +0900 Subject: [PATCH 10/13] =?UTF-8?q?[BSVR-202/=EB=B0=B0=ED=8F=AC]=20monitorin?= =?UTF-8?q?g=20yml=20=ED=8A=B8=EB=9F=AC=EB=B8=94=20=EC=87=BC=ED=8C=85=20(#?= =?UTF-8?q?129)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: dev 배포 스크립트에 loki url 추가 * feat: prod 수동 배포 스크립트에 loki url 추가 * feat: logback-spring.xml에 yml 파일이 아닌 환경변수만 사용하도록 수정 --- application/src/main/resources/logback-spring.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/resources/logback-spring.xml b/application/src/main/resources/logback-spring.xml index 3b9ef380..54ceeb8d 100644 --- a/application/src/main/resources/logback-spring.xml +++ b/application/src/main/resources/logback-spring.xml @@ -1,7 +1,7 @@ - + From 5c4660e0fc981b258266bc365350ef17212e7542 Mon Sep 17 00:00:00 2001 From: Minseong Park <52368015+pminsung12@users.noreply.github.com> Date: Mon, 12 Aug 2024 23:19:17 +0900 Subject: [PATCH 11/13] =?UTF-8?q?[BSVR-202]=20=ED=94=84=EB=A1=9C=EB=A9=94?= =?UTF-8?q?=ED=85=8C=EC=9A=B0=EC=8A=A4=20scrape=20=EC=95=88=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EC=9D=B4=EC=8A=88=20=ED=8A=B8=EB=9F=AC=EB=B8=94?= =?UTF-8?q?=EC=8A=88=ED=8C=85=20(#130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: dev 배포 스크립트에 loki url 추가 * feat: prod 수동 배포 스크립트에 loki url 추가 * feat: logback-spring.xml에 yml 파일이 아닌 환경변수만 사용하도록 수정 * feat: 9292 docker port mapping --- .github/workflows/dev-build-and-deploy.yaml | 1 + .github/workflows/manual-prod-deploy.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/dev-build-and-deploy.yaml b/.github/workflows/dev-build-and-deploy.yaml index e4851e10..7fb6952e 100644 --- a/.github/workflows/dev-build-and-deploy.yaml +++ b/.github/workflows/dev-build-and-deploy.yaml @@ -108,6 +108,7 @@ jobs: docker rm spot-server-dev || true docker run -d --name spot-server-dev \ -p 8080:8080 \ + -p 9292:9292 \ -e SPRING_PROFILES_ACTIVE=dev \ -e SPRING_DATASOURCE_URL=${{ secrets.DEV_DB_URL }} \ -e SPRING_DATASOURCE_USERNAME=${{ secrets.DEV_DB_USERNAME }} \ diff --git a/.github/workflows/manual-prod-deploy.yaml b/.github/workflows/manual-prod-deploy.yaml index 827b1f54..a9620390 100644 --- a/.github/workflows/manual-prod-deploy.yaml +++ b/.github/workflows/manual-prod-deploy.yaml @@ -45,6 +45,7 @@ jobs: docker rm spot-server-prod || true docker run -d --name spot-server-prod \ -p 8080:8080 \ + -p 9292:9292 \ -e SPRING_PROFILES_ACTIVE=prod \ -e SPRING_DATASOURCE_URL=${{ secrets.PROD_DB_URL }} \ -e SPRING_DATASOURCE_USERNAME=${{ secrets.PROD_DB_USERNAME }} \ From 5faa9e836e306724a57452d43af5aaa4b1c90a7d Mon Sep 17 00:00:00 2001 From: Minseong Park <52368015+pminsung12@users.noreply.github.com> Date: Tue, 13 Aug 2024 23:11:38 +0900 Subject: [PATCH 12/13] =?UTF-8?q?[BSVR-210]=20=EA=B0=9C=EB=B0=9C=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EB=A1=9C=ED=82=A4=20connection=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=8A=B8=EB=9F=AC=EB=B8=94=20=EC=8A=88?= =?UTF-8?q?=ED=8C=85=20(#133)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 개발서버 loki 포트 매핑 * feat: 운영서버 loki 포트 매핑 --- .github/workflows/dev-build-and-deploy.yaml | 1 + .github/workflows/manual-prod-deploy.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/dev-build-and-deploy.yaml b/.github/workflows/dev-build-and-deploy.yaml index 7fb6952e..a61fcf6d 100644 --- a/.github/workflows/dev-build-and-deploy.yaml +++ b/.github/workflows/dev-build-and-deploy.yaml @@ -109,6 +109,7 @@ jobs: docker run -d --name spot-server-dev \ -p 8080:8080 \ -p 9292:9292 \ + -p 3100:3100 \ -e SPRING_PROFILES_ACTIVE=dev \ -e SPRING_DATASOURCE_URL=${{ secrets.DEV_DB_URL }} \ -e SPRING_DATASOURCE_USERNAME=${{ secrets.DEV_DB_USERNAME }} \ diff --git a/.github/workflows/manual-prod-deploy.yaml b/.github/workflows/manual-prod-deploy.yaml index a9620390..fd040c87 100644 --- a/.github/workflows/manual-prod-deploy.yaml +++ b/.github/workflows/manual-prod-deploy.yaml @@ -46,6 +46,7 @@ jobs: docker run -d --name spot-server-prod \ -p 8080:8080 \ -p 9292:9292 \ + -p 3100:3100 \ -e SPRING_PROFILES_ACTIVE=prod \ -e SPRING_DATASOURCE_URL=${{ secrets.PROD_DB_URL }} \ -e SPRING_DATASOURCE_USERNAME=${{ secrets.PROD_DB_USERNAME }} \ From 716e787fe878689c76dd8b31eecc5a5dc5c0a865 Mon Sep 17 00:00:00 2001 From: junwon <67488973+wjdwnsdnjs13@users.noreply.github.com> Date: Wed, 14 Aug 2024 20:39:19 +0900 Subject: [PATCH 13/13] =?UTF-8?q?[NO=5FJIRA]=20loki=20=EC=98=A4=EB=A5=98?= =?UTF-8?q?=20fix=20(#134)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix : loki 오류 fix * refactor : Loki appender 파일 분리 --- .../resources/appenders/console-appender.xml | 15 ++++++++++++++ .../src/main/resources/logback-spring.xml | 20 +++---------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/application/src/main/resources/appenders/console-appender.xml b/application/src/main/resources/appenders/console-appender.xml index d02fa9d8..97295287 100644 --- a/application/src/main/resources/appenders/console-appender.xml +++ b/application/src/main/resources/appenders/console-appender.xml @@ -11,4 +11,19 @@ ERROR + + + http://${LOKI_URL}:3100/loki/api/v1/push + + + + + %highlight([%-5level]) %d{yy-MM-dd HH:mm:ss.SSS} %green([%thread]) %yellow([traceId=%X{traceId}]) %cyan([%logger{0}:%line])-%message%n + + true + + diff --git a/application/src/main/resources/logback-spring.xml b/application/src/main/resources/logback-spring.xml index 54ceeb8d..22bf7ecc 100644 --- a/application/src/main/resources/logback-spring.xml +++ b/application/src/main/resources/logback-spring.xml @@ -1,16 +1,17 @@ - + + @@ -18,22 +19,7 @@ - - - - http://${loki.url}:3100/loki/api/v1/push - - - - - %highlight([%-5level]) %d{yy-MM-dd HH:mm:ss.SSS} %green([%thread]) %yellow([traceId=%X{traceId}]) %cyan([%logger{0}:%line])-%message%n - - true - - +