forked from kakao-tech-campus-2nd-step3/Team29_BE
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: 배포 자동화 및 Slack Webhook 설정 #29
Merged
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f92c827
Merge pull request #59 from kakao-tech-campus-2nd-step3/Develop
hynseoj 62c3b31
Feat: POST 저장 기능, OCR 구현, 폴더 수정, 페이지별 조회 기능 구현 및 배포 (#66) (#67)
yugyeom-ghim e3e1c8d
Feat: AI서버에서 STT 결과 응답 왔을때 STT 결과 처리하는 기능 구현
yugyeom-ghim f823cb0
Merge branch 'Weekly9' into feature/#64-processing-stt-results
yugyeom-ghim 2be29d4
Chore: 배포 환경 구성 및 빌드 설정 추가
yugyeom-ghim 41b02fe
Refactor: tesseratct 관련 path를 설정 파일에서 관리하도록 변경
yugyeom-ghim b7e71c0
Chore: 서브모듈 추가
yugyeom-ghim 6b457f5
Chore: .gitmodules 추가
yugyeom-ghim ed9920c
Chore: 서브모듈 제거
yugyeom-ghim 8ac37cf
Chore: 서브모듈 추가
yugyeom-ghim 4c84365
Chore: .gitmodules에 브랜치 명시
yugyeom-ghim 61b2767
Chore: 서브모듈 URL을 SSH 방식으로 변경 (private 저장소 인증)
yugyeom-ghim f83955d
Chore: 토큰명 변경
yugyeom-ghim 90415a0
Chore: working-directory 상대경로로 변경
yugyeom-ghim 94371e1
Chore: 빌드 위치 디버깅 및 빌드 후 파일을 복사하는 방식으로 변경
yugyeom-ghim a0bebcf
Chore: profile을 prod로 변경
yugyeom-ghim 4dca83b
Chore: 빌드파일만 복사하도록 변경
yugyeom-ghim 79c531e
Feat: 잘못된 요청 또는 예상치 못한 에러를 보여주기 위한 슬렉 웹 훅 추가
yugyeom-ghim a261ef5
Chore: 스웨거 relesase 버전 0.0.2로 변경
yugyeom-ghim 33a4792
Fix: OCR page넘버 i + 1로 계산 되는 부분 i로 변경
yugyeom-ghim cd02b28
Merge branch 'Weekly9' into release/0.0.2
yugyeom-ghim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Deploy to Production | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'release/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
name: Production Deploy | ||
runs-on: self-hosted | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
token: ${{ secrets.ACTION_TOKEN }} | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '21' | ||
distribution: 'corretto' | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
|
||
- name: Build with Gradle | ||
run: | | ||
pwd | ||
ls -la | ||
chmod +x ./gradlew | ||
./gradlew clean bootJar | ||
|
||
- name: Copy files and Deploy | ||
run: | | ||
cp -r ./build/libs/*.jar /home/yugyeom/notai/ | ||
cd /home/yugyeom/notai | ||
docker-compose down | ||
docker-compose up -d --build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "Team29_BE_Submodule"] | ||
path = Team29_BE_Submodule | ||
url = git@github.com:29ana-notai/Team29_BE_Submodule.git | ||
branch = release/0.0.2 |
This file was deleted.
Oops, something went wrong.
Submodule Team29_BE_Submodule
added at
9786d7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
rootProject.name = 'backend' | ||
rootProject.name = 'notai' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package notai.client.slack; | ||
|
||
import com.slack.api.Slack; | ||
import com.slack.api.webhook.Payload; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import notai.common.exception.ErrorMessages; | ||
import notai.common.exception.type.ExternalApiException; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.scheduling.annotation.Async; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.io.IOException; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Async | ||
@Slf4j | ||
public class SlackWebHookClient { | ||
|
||
private final SlackWebHookProperty slackWebHookProperty; | ||
|
||
public void sendToInfoChannel(String message) { | ||
Slack slack = Slack.getInstance(); | ||
Payload payload = Payload.builder().text(message).build(); | ||
|
||
try { | ||
slack.send(slackWebHookProperty.infoChannel().webhookUrl(), payload); | ||
} catch (IOException e) { | ||
throw new ExternalApiException(ErrorMessages.SLACK_API_ERROR, HttpStatus.INTERNAL_SERVER_ERROR.value()); | ||
} | ||
} | ||
|
||
public void sendToErrorChannel(String message) { | ||
Slack slack = Slack.getInstance(); | ||
Payload payload = Payload.builder().text(message).build(); | ||
|
||
try { | ||
slack.send(slackWebHookProperty.errorChannel().webhookUrl(), payload); | ||
} catch (IOException e) { | ||
throw new ExternalApiException(ErrorMessages.SLACK_API_ERROR, HttpStatus.INTERNAL_SERVER_ERROR.value()); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/notai/client/slack/SlackWebHookProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package notai.client.slack; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties(prefix = "slack") | ||
public record SlackWebHookProperty( | ||
WebhookProperty infoChannel, | ||
WebhookProperty errorChannel | ||
) { | ||
public record WebhookProperty( | ||
String webhookUrl | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 7 additions & 1 deletion
8
src/main/java/notai/pageRecording/domain/PageRecordingRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
package notai.pageRecording.domain; | ||
|
||
import notai.pageRecording.query.PageRecordingQueryRepository; | ||
import notai.recording.domain.Recording; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface PageRecordingRepository extends JpaRepository<PageRecording, Long> { | ||
import java.util.List; | ||
|
||
public interface PageRecordingRepository extends | ||
JpaRepository<PageRecording, Long>, PageRecordingQueryRepository { | ||
|
||
List<PageRecording> findAllByRecording(Recording recording); | ||
} |
12 changes: 5 additions & 7 deletions
12
src/main/java/notai/pageRecording/query/PageRecordingQueryRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
package notai.pageRecording.query; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Repository; | ||
import notai.pageRecording.domain.PageRecording; | ||
|
||
@Repository | ||
@RequiredArgsConstructor | ||
public class PageRecordingQueryRepository { | ||
import java.util.List; | ||
|
||
private final JPAQueryFactory queryFactory; | ||
public interface PageRecordingQueryRepository { | ||
|
||
List<PageRecording> findAllByRecordingIdOrderByStartTime(Long recordingId); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
윈도우, 맥북마다 다른 변수를 이렇게 관리할 수 있다는 생각을 못했었네요 저는,,!
상수 관리 측면에서 너무 좋은 것 같습니다