diff --git a/.github/workflows/prod-apigateway-deploy.yml b/.github/workflows/prod-apigateway-deploy.yml new file mode 100644 index 0000000..c024465 --- /dev/null +++ b/.github/workflows/prod-apigateway-deploy.yml @@ -0,0 +1,67 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + push: + branches: [ "prod-apigateway" ] + pull_request: + branches: [ "prod-apigateway" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + + - name: Build with Gradle Wrapper + run: ./gradlew build + + # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). + # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. + # + # - name: Setup Gradle + # uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + # with: + # gradle-version: '8.5' + # + # - name: Build with Gradle 8.5 + # run: gradle build + + dependency-submission: + + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 diff --git a/.github/workflows/prod-community-deploy.yml b/.github/workflows/prod-community-deploy.yml new file mode 100644 index 0000000..73e4995 --- /dev/null +++ b/.github/workflows/prod-community-deploy.yml @@ -0,0 +1,71 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: CommunityService + +on: + push: + branches: [ "prod-community" ] + pull_request: + branches: [ "prod-community" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Make application.yml + run: | + cd BE-Community-Server + mkdir -p src/main/resources + echo "${{ secrets.APPLICATION_COMMUNITY }}" > src/main/resources/application.yml + env: + APPLICATION: ${{ secrets.APPLICATION_COMMUNITY }} + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build -x test + + - name: Docker build + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -t app . + docker tag app ${{ secrets.DOCKER_USERNAME }}/community:latest + docker push ${{ secrets.DOCKER_USERNAME }}/community:latest + + - name: docker-compose.yml + uses: appleboy/scp-action@master + with: + username: ec2-user + host: ${{ secrets.HOST }} + key: ${{ secrets.PRIVATE_KEY_3 }} + port: ${{ secrets.PORT }} + source: "./docker-compose-community.yml" + target: "/home/ec2-user/" + + - name: Deploy + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_PROD_3 }} + username: ec2-user + key: ${{ secrets.PRIVATE_KEY_3 }} + script: | + docker pull ${{ secrets.DOCKER_USERNAME }}/community:latest + docker image prune -a -f + docker-compose up -d diff --git a/.github/workflows/prod-contents-deploy.yml b/.github/workflows/prod-contents-deploy.yml new file mode 100644 index 0000000..cc00f00 --- /dev/null +++ b/.github/workflows/prod-contents-deploy.yml @@ -0,0 +1,80 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: ContentsService + +on: + push: + branches: [ "prod-contents" ] + pull_request: + branches: [ "prod-contents" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Clean Gradle Cache + run: | + cd BE-Contents-Server + ls + ./gradlew clean + + - name: Make application.yml + run: | + mkdir -p src/main/resources + echo "$APPLICATION" > src/main/resources/application.yml + env: + APPLICATION: ${{ secrets.APPLICATION_CONTENTS }} + + - name: Grant execute permission for gradlew + run: | + cd BE-Contents-Server + ls + chmod +x gradlew + + - name: Build with Gradle + run: | + cd BE-Contents-Server + ls + ./gradlew build -x test + + - name: Docker build + run: | + cd BE-Contents-Server + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -t app . + docker tag app ${{ secrets.DOCKER_USERNAME }}/contents:latest + docker push ${{ secrets.DOCKER_USERNAME }}/contents:latest + + - name: docker-compose.yml + uses: appleboy/scp-action@master + with: + username: ec2-user + host: ${{ secrets.HOST_PROD_2 }} + key: ${{ secrets.PRIVATE_KEY_CONTENTS }} + port: ${{ secrets.PORT }} + source: "./BE-Contents-Server/docker-compose-contents.yml" + target: "/home/ec2-user/" + + - name: Deploy + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_PROD_2 }} + username: ec2-user + key: ${{ secrets.PRIVATE_KEY_CONTENTS }} + script: | + docker pull ${{ secrets.DOCKER_USERNAME }}/contents:latest + docker image prune -a -f + cd ./BE-Contents-Server + docker-compose -f docker-compose-contents.yml up diff --git a/.github/workflows/prod-eureka-deploy.yml b/.github/workflows/prod-eureka-deploy.yml new file mode 100644 index 0000000..722ba15 --- /dev/null +++ b/.github/workflows/prod-eureka-deploy.yml @@ -0,0 +1,67 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + push: + branches: [ "prod-eureka" ] + pull_request: + branches: [ "prod-eureka" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + + - name: Build with Gradle Wrapper + run: ./gradlew build + + # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). + # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. + # + # - name: Setup Gradle + # uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + # with: + # gradle-version: '8.5' + # + # - name: Build with Gradle 8.5 + # run: gradle build + + dependency-submission: + + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 diff --git a/.github/workflows/prod-keyword-deploy.yml b/.github/workflows/prod-keyword-deploy.yml new file mode 100644 index 0000000..f753839 --- /dev/null +++ b/.github/workflows/prod-keyword-deploy.yml @@ -0,0 +1,67 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: Java CI with Gradle + +on: + push: + branches: [ "prod-keyword" ] + pull_request: + branches: [ "prod-keyword" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + + - name: Build with Gradle Wrapper + run: ./gradlew build + + # NOTE: The Gradle Wrapper is the default and recommended way to run Gradle (https://docs.gradle.org/current/userguide/gradle_wrapper.html). + # If your project does not have the Gradle Wrapper configured, you can use the following configuration to run Gradle with a specified version. + # + # - name: Setup Gradle + # uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + # with: + # gradle-version: '8.5' + # + # - name: Build with Gradle 8.5 + # run: gradle build + + dependency-submission: + + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. + # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 diff --git a/.github/workflows/prod-member-deploy.yml b/.github/workflows/prod-member-deploy.yml new file mode 100644 index 0000000..9976fda --- /dev/null +++ b/.github/workflows/prod-member-deploy.yml @@ -0,0 +1,71 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: MemberService + +on: + push: + branches: [ "prod-member" ] + pull_request: + branches: [ "prod-member" ] + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Make application.yml + run: | + cd BE-Member-Server + mkdir -p src/main/resources + echo "${{ secrets.APPLICATION_MEMBER }}" > src/main/resources/application.yml + env: + APPLICATION: ${{ secrets.APPLICATION_MEMBER }} + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build -x test + + - name: Docker build + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -t app . + docker tag app ${{ secrets.DOCKER_USERNAME }}/member:latest + docker push ${{ secrets.DOCKER_USERNAME }}/member:latest + + - name: docker-compose.yml + uses: appleboy/scp-action@master + with: + username: ec2-user + host: ${{ secrets.HOST }} + key: ${{ secrets.PRIVATE_KEY_3 }} + port: ${{ secrets.PORT }} + source: "./docker-compose-member.yml" + target: "/home/ec2-user/" + + - name: Deploy + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST_PROD_3 }} + username: ec2-user + key: ${{ secrets.PRIVATE_KEY_3 }} + script: | + docker pull ${{ secrets.DOCKER_USERNAME }}/member:latest + docker image prune -a -f + docker-compose up -d diff --git a/README.md b/README.md new file mode 100644 index 0000000..d097c10 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +## 광장 리팩토링✨💗