-
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
Changes from all commits
f92c827
62c3b31
e3e1c8d
f823cb0
2be29d4
41b02fe
b7e71c0
6b457f5
ed9920c
8ac37cf
4c84365
61b2767
f83955d
90415a0
94371e1
a0bebcf
4dca83b
79c531e
a261ef5
33a4792
cd02b28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
rootProject.name = 'backend' | ||
rootProject.name = 'notai' |
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()); | ||
} | ||
} | ||
} |
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 | ||
) { | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,11 @@ spring: | |
mvc: | ||
converters: | ||
preferred-json-mapper: gson | ||
servlet: | ||
multipart: | ||
max-file-size: 100MB | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 앗 PDF등 자료 사이즈가 확실히 10MB보다 클 수 있으니 100MB로 여유롭게 처리하는것 좋은 것 같네요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아 이부분은 말씀 안드리고 바꿨는데 오디오 테스트해보니까 기본 40분에 30MB인가 돼서 100까지 늘려놨습니다! |
||
max-request-size: 100MB | ||
enabled: true | ||
|
||
server: | ||
servlet: | ||
|
@@ -43,3 +48,16 @@ token: # todo production에서 secretKey 변경 | |
secretKey: "ZGQrT0tuZHZkRWRxeXJCamRYMDFKMnBaR2w5WXlyQm9HU2RqZHNha1gycFlkMWpLc0dObw==" | ||
accessTokenExpirationMillis: 10000000000 | ||
refreshTokenExpirationMillis: 10000000000 | ||
|
||
file: | ||
audio: | ||
basePath: /app/audio/ | ||
pdf: | ||
basePath: /app/pdf/ | ||
|
||
tesseract: | ||
library: | ||
path: C:\\Program Files\\Tesseract-OCR | ||
data: | ||
path: C:\\Program Files\\Tesseract-OCR\\tessdata | ||
language: kor+eng |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
spring: | ||
profiles: | ||
active: local | ||
active: prod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. active를 통해 여러가지 application.yml 을 관리할 수 있다는 점이 되게 편리한 것 같네요 상수값 관리 등 다양한 측면에서도요 |
||
|
||
file: | ||
audio: | ||
basePath: /app/audio/ # Docker 볼륨에 맞게 경로 수정 |
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.
윈도우, 맥북마다 다른 변수를 이렇게 관리할 수 있다는 생각을 못했었네요 저는,,!
상수 관리 측면에서 너무 좋은 것 같습니다