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/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 diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 5adb153f..148ddb40 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: + runs-on: ubuntu-latest 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 + if: ${{ github.event_name == 'push' && contains(github.event.head_commit.modified, 'apps/user-service/') || github.event_name == 'pull_request' }} 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: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + 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 - # (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 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 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