From 870515994fb82ec5c5653a968fa621f23eaf9704 Mon Sep 17 00:00:00 2001 From: can019 Date: Wed, 10 Sep 2025 16:35:57 +0900 Subject: [PATCH 1/4] =?UTF-8?q?chore:=20production=20=ED=99=98=EA=B2=BD=20?= =?UTF-8?q?env=20=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/application-production.yml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/apps/user-service/src/main/resources/application-production.yml b/apps/user-service/src/main/resources/application-production.yml index e69de29b..6b048fbd 100644 --- a/apps/user-service/src/main/resources/application-production.yml +++ b/apps/user-service/src/main/resources/application-production.yml @@ -0,0 +1,27 @@ +spring: + config: + activate: + on-profile: production + + datasource: + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/${DB_NAME} + username: ${DB_USER} + password: ${DB_PASS} + driver-class-name: org.mariadb.jdbc.Driver + + hikari: + connection-timeout: 30000 + idle-timeout: 600000 + max-lifetime: 1800000 + maximum-pool-size: 10 + minimum-idle: 5 + pool-name: HikariCP-MyBatis + +mybatis: + mapper-locations: classpath:mybatis/mapper/**/*.xml + type-aliases-package: site.icebang.dto + configuration: + map-underscore-to-camel-case: true + +logging: + config: classpath:log4j2-production.yml From 9cbdcd1ead94201984b8063864bb5da0ac225a4f Mon Sep 17 00:00:00 2001 From: can019 Date: Wed, 10 Sep 2025 16:49:23 +0900 Subject: [PATCH 2/4] chore: set up env in github action --- .github/workflows/deploy-java.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-java.yml b/.github/workflows/deploy-java.yml index e8b35476..69a1909d 100644 --- a/.github/workflows/deploy-java.yml +++ b/.github/workflows/deploy-java.yml @@ -14,6 +14,15 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Create env file + run: | + echo "DB_HOST=${{ secrets.DB_HOST }}" > .env.prod + echo "DB_PORT=${{ secrets.DB_PORT }}" >> .env.prod + echo "DB_USER=${{ secrets.DB_USER }}" >> .env.prod + echo "DB_PASS=${{ secrets.DB_PASS }}" >> .env.prod + echo "DB_NAME=${{ secrets.DB_NAME }}" >> .env.prod + echo "ENV_NAME=${{ secrets.ENV_NAME }}" >> .env.prod + - name: Set repo lowercase run: echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV @@ -26,15 +35,29 @@ jobs: source: "docker/production/docker-compose.yml" target: "~/app" + - name: Copy .env.prod file to EC2 + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.SERVER_HOST }} + username: ubuntu + key: ${{ secrets.SERVER_SSH_KEY }} + source: ".env.prod" + target: "~/app/docker/production/" + overwrite: true + - name: Deploy on EC2 uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_HOST }} -# username: ${{ secrets.SERVER_USER }} username: ubuntu key: ${{ secrets.SERVER_SSH_KEY }} script: | cd ~/app/docker/production + + # Remove existing .env.prod if exists and move new one + rm -f .env.prod + mv .env.prod.bak .env.prod 2>/dev/null || mv .env.prod .env.prod + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin docker pull ghcr.io/${{ env.REPO_LC }}/user-service:latest @@ -71,4 +94,4 @@ jobs: **Repository:** ${{ env.REPO_LC }} **Tag:** ${{ github.ref_name }} **Error:** 배포 중 오류가 발생했습니다. - **Check:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + **Check:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \ No newline at end of file From 4abc92c9600be452fc7c2a3043934e2c60c3202d Mon Sep 17 00:00:00 2001 From: can019 Date: Wed, 10 Sep 2025 17:09:50 +0900 Subject: [PATCH 3/4] =?UTF-8?q?chore:=20Release=20drafter=20version=20tagg?= =?UTF-8?q?ing=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/release-drafter-pre-processing.yml | 30 ++++++++++++++++ ...r.yml => release-drafter-user-service.yml} | 4 +-- .github/workflows/release-drafter.yml | 36 ++++++++++++------- 3 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 .github/release-drafter-pre-processing.yml rename .github/{release-drafter.yml => release-drafter-user-service.yml} (82%) diff --git a/.github/release-drafter-pre-processing.yml b/.github/release-drafter-pre-processing.yml new file mode 100644 index 00000000..691e70b6 --- /dev/null +++ b/.github/release-drafter-pre-processing.yml @@ -0,0 +1,30 @@ +name-template: 'pre-processing-v$RESOLVED_VERSION' +tag-template: 'pre-processing-v$RESOLVED_VERSION' +categories: + - title: 'Feature' + labels: + - 'enhancement' + - 'pre-processing' + - title: 'Bug Fixes' + labels: + - 'bug' + - 'pre-processing' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'major' + - 'pre-processing' + minor: + labels: + - 'minor' + - 'pre-processing' + patch: + labels: + - 'patch' + - 'pre-processing' + default: patch +template: | + ## Changes + $CHANGES \ No newline at end of file diff --git a/.github/release-drafter.yml b/.github/release-drafter-user-service.yml similarity index 82% rename from .github/release-drafter.yml rename to .github/release-drafter-user-service.yml index d7b5b424..abc943aa 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter-user-service.yml @@ -1,5 +1,5 @@ -name-template: 'v$RESOLVED_VERSION' -tag-template: 'v$RESOLVED_VERSION' +name-template: 'user-service-v$RESOLVED_VERSION' +tag-template: 'user-service-v$RESOLVED_VERSION' categories: - title: 'Feature' labels: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 5adb153f..69c58158 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -4,31 +4,41 @@ on: push: branches: - main + paths: + - 'apps/user-service/**' + - 'apps/pre-processing/**' pull_request: types: [opened, reopened, synchronize] + paths: + - 'apps/user-service/**' + - 'apps/pre-processing/**' + permissions: contents: read jobs: - update_release_draft: + update_user_service_release: + if: contains(github.event.head_commit.modified, 'apps/user-service/') || contains(github.event.pull_request.changed_files, 'apps/user-service/') permissions: - # write permission is required to create a github release contents: write - # write permission is required for autolabeler - # otherwise, read permission is required at least pull-requests: write runs-on: ubuntu-latest steps: - # (Optional) GitHub Enterprise requires GHE_HOST variable set - #- name: Set GHE_HOST - # run: | - # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV + - uses: release-drafter/release-drafter@v5 + with: + config-name: release-drafter-user-service.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Drafts your next Release notes as Pull Requests are merged into "main" + update_preprocessing_release: + if: contains(github.event.head_commit.modified, 'apps/pre-processing/') || contains(github.event.pull_request.changed_files, 'apps/pre-processing/') + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: - uses: release-drafter/release-drafter@v5 - # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml - # with: - # config-name: my-config.yml - # disable-autolabeler: true + with: + config-name: release-drafter-pre-processing.yml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 2d191fd5bb1099a9e1ef574cb56aae85e9766a86 Mon Sep 17 00:00:00 2001 From: can019 Date: Wed, 10 Sep 2025 17:11:05 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20release=20drafter=20=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-drafter.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 69c58158..148ddb40 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -18,11 +18,11 @@ permissions: jobs: update_user_service_release: - if: contains(github.event.head_commit.modified, 'apps/user-service/') || contains(github.event.pull_request.changed_files, 'apps/user-service/') + runs-on: ubuntu-latest permissions: contents: write pull-requests: write - runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' && contains(github.event.head_commit.modified, 'apps/user-service/') || github.event_name == 'pull_request' }} steps: - uses: release-drafter/release-drafter@v5 with: @@ -31,14 +31,14 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} update_preprocessing_release: - if: contains(github.event.head_commit.modified, 'apps/pre-processing/') || contains(github.event.pull_request.changed_files, 'apps/pre-processing/') + runs-on: ubuntu-latest permissions: contents: write pull-requests: write - runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' && contains(github.event.head_commit.modified, 'apps/pre-processing/') || github.event_name == 'pull_request' }} steps: - uses: release-drafter/release-drafter@v5 with: config-name: release-drafter-pre-processing.yml env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}