From 7ea6b2a4bdd7a521ac8fb9a321f1f11056e01dc9 Mon Sep 17 00:00:00 2001 From: ParkYunHo Date: Tue, 25 Jul 2023 21:00:17 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:feature=20:=20batch=20=EC=8A=A4?= =?UTF-8?q?=EC=BC=80=EC=A4=84=EB=9F=AC=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-batch.yaml | 46 ------------------- .github/workflows/drwtStore-batch.yaml | 39 ++++++++++++++++ .github/workflows/number-batch.yaml | 39 ++++++++++++++++ .github/workflows/store-batch.yaml | 26 +++++++++++ .../src/main/resources/application-batch.yaml | 4 +- .../main/resources/application-core-prod.yaml | 2 +- 6 files changed, 107 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/ci-batch.yaml create mode 100644 .github/workflows/drwtStore-batch.yaml create mode 100644 .github/workflows/number-batch.yaml create mode 100644 .github/workflows/store-batch.yaml diff --git a/.github/workflows/ci-batch.yaml b/.github/workflows/ci-batch.yaml deleted file mode 100644 index 9c7dba9..0000000 --- a/.github/workflows/ci-batch.yaml +++ /dev/null @@ -1,46 +0,0 @@ -#name: ci-batch -# -#on: -# workflow_dispatch: -# inputs: -# job_name: -# required: true -# type: string -# description: 실행할 job 명칭 input -# -#jobs: -# ci-batch: -# runs-on: ubuntu-latest -# steps: -# - name: Git Checkout -# uses: actions/checkout@v2 -# -# - name: Setup JDK -# uses: actions/setup-java@v1 -# with: -# java-version: 17 -# -# - name: Grant execute permission for gradlew -# run: chmod +x gradlew -# -# - name: Build Gradle -# run: -# -# - name: Dockerhub Login -# uses: docker/login-action@v2 -# with: -# username: ${{ secrets.DOCKERHUB_USERNAME }} -# password: ${{ secrets.DOCKERHUB_TOKEN }} -# -# - name: Build Gradle with JIB (API) -# run: ./gradlew clean --stacktrace --build-file=./batch/build.gradle.kts --Dspring.profiles.active=prod --job.name=${{ github.event.inputs.job_name }} build -# -## - name: Execute Remote SSH & Deploy 'API' module -## uses: appleboy/ssh-action@master -## with: -## host: ${{ secrets.REMOTE_SSH_HOST }} -## username: ${{ secrets.REMOTE_SSH_USERNAME }} -## key: ${{ secrets.REMOTE_SSH_KEY }} -## script: | -## docker pull johnpark0921/lotto-portfolio -## docker container run --name lotto-portfolio -p 8080:8080 johnpark0921/lotto-portfolio \ No newline at end of file diff --git a/.github/workflows/drwtStore-batch.yaml b/.github/workflows/drwtStore-batch.yaml new file mode 100644 index 0000000..dfb2529 --- /dev/null +++ b/.github/workflows/drwtStore-batch.yaml @@ -0,0 +1,39 @@ +name: drwtStore-batch + +on: + workflow_dispatch: + inputs: + startDrwtNo: + description: 시작회차 + default: "" + type: string + endDrwtNo: + description: 종료회차 + default: "" + type: string + schedule: + - cron: '0 22 * * SUN' # 매주 일요일 22시 + +jobs: + drwtStore-batch: + runs-on: ubuntu-latest + steps: + - name: Git Checkout + uses: actions/checkout@v2 + + - name: Setup JDK + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build Gradle + run: ./gradlew clean --stacktrace --build-file=./batch/build.gradle.kts --exclude-task test build + + - name: Job Execute + run: java -jar --Dspring.profiles.active=prod --job.name=lottoDrwtStoreJob startDrwtNo=$START_DRWTNO endDrwtNo=$END_DRWTNO ./build/libs/batch-0.0.1-SNAPSHOT.jar + env: + START_DRWTNO: ${{ inputs.startDrwtNo }} + END_DRWTNO: ${{ inputs.endDrwtNo }} diff --git a/.github/workflows/number-batch.yaml b/.github/workflows/number-batch.yaml new file mode 100644 index 0000000..b4f5ce5 --- /dev/null +++ b/.github/workflows/number-batch.yaml @@ -0,0 +1,39 @@ +name: number-batch + +on: + workflow_dispatch: + inputs: + startDrwtNo: + description: 시작회차 + default: "" + type: string + endDrwtNo: + description: 종료회차 + default: "" + type: string + schedule: + - cron: '0 21 * * SUN' # 매주 일요일 21시 + +jobs: + number-batch: + runs-on: ubuntu-latest + steps: + - name: Git Checkout + uses: actions/checkout@v2 + + - name: Setup JDK + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build Gradle + run: ./gradlew clean --stacktrace --build-file=./batch/build.gradle.kts --exclude-task test build + + - name: Job Execute + run: java -Dspring.profiles.active=prod -jar ./batch/build/libs/batch-0.0.1-SNAPSHOT.jar --spring.batch.job.names=lottoNumberJob --startDrwtNo=$START_DRWTNO --endDrwtNo=$END_DRWTNO + env: + START_DRWTNO: ${{ inputs.startDrwtNo }} + END_DRWTNO: ${{ inputs.endDrwtNo }} diff --git a/.github/workflows/store-batch.yaml b/.github/workflows/store-batch.yaml new file mode 100644 index 0000000..905560d --- /dev/null +++ b/.github/workflows/store-batch.yaml @@ -0,0 +1,26 @@ +name: store-batch + +on: + schedule: + - cron: '0 21 1 */6 *' # 6개월마다 1일 21시 (1/1, 7/1) + +jobs: + store-batch: + runs-on: ubuntu-latest + steps: + - name: Git Checkout + uses: actions/checkout@v2 + + - name: Setup JDK + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build Gradle + run: ./gradlew clean --stacktrace --build-file=./batch/build.gradle.kts --exclude-task test build + + - name: Job Execute + run: java -jar --Dspring.profiles.active=prod --job.name=lottoStoreJob ./build/libs/batch-0.0.1-SNAPSHOT.jar diff --git a/batch/src/main/resources/application-batch.yaml b/batch/src/main/resources/application-batch.yaml index 536684f..8908ba2 100644 --- a/batch/src/main/resources/application-batch.yaml +++ b/batch/src/main/resources/application-batch.yaml @@ -8,5 +8,5 @@ spring: client: config: default: - connect-timeout: 3000 - read-timeout: 3000 + connect-timeout: 10000 + read-timeout: 10000 diff --git a/core/src/main/resources/application-core-prod.yaml b/core/src/main/resources/application-core-prod.yaml index 9a4c895..80a3931 100644 --- a/core/src/main/resources/application-core-prod.yaml +++ b/core/src/main/resources/application-core-prod.yaml @@ -9,7 +9,7 @@ spring: generate-ddl: true datasource: hikari: - connection-timeout: 20000 + connection-timeout: 10000 minimum-idle: 10 maximum-pool-size: 100