-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #599 from tukcomCD2024/develop_back_core
feta : develop_back_core -> develop_back
- Loading branch information
Showing
208 changed files
with
5,243 additions
and
1,724 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
name: core-ci/cd | ||
name: core-prod-ci/cd | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop_back_core | ||
- 'hotfix/[0-9a-zA-z]+-B-core-#[0-9a-zA-z]+' | ||
- prod_back_core | ||
- 'hotfix/[0-9a-zA-z]+-B-prod-core-#[0-9a-zA-z]+' | ||
pull_request: | ||
branches: | ||
- develop_back_core | ||
- prod_back_core | ||
|
||
jobs: | ||
build_and_test: | ||
|
@@ -83,12 +83,6 @@ jobs: | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
@@ -98,15 +92,14 @@ jobs: | |
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ steps.login-ecr.outputs.registry }}/${{ secrets.AWS_ECR_REPOSITORY_NAME }} | ||
${{ steps.login-ecr.outputs.registry }}/${{ secrets.AWS_PROD_ECR_CORE_REPOSITORY_NAME }} | ||
tags: | | ||
type=raw,value=latest | ||
type=raw,value={{date 'YYYYMMDD-HHmmss'}} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./backend/core | ||
platforms: linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
provenance: false | ||
|
@@ -117,38 +110,38 @@ jobs: | |
|
||
- name: Add Github Actions IP to Security group | ||
run: | | ||
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_EC2_CORE_SG_ID }} --group-name ${{secrets.AWS_EC2_CORE_SG_NAME}} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_PROD_CORE_NOTI_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
- name: Connect ec2 and Run Docker Container | ||
uses: appleboy/[email protected] | ||
env: | ||
AWS_ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
with: | ||
host: ${{ secrets.SSH_CORE_HOST }} | ||
host: ${{ secrets.SSH_PROD_CORE_NOTI_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_CORE_PRIVATE_KEY }} | ||
key: ${{ secrets.SSH_PROD_CORE_NOTI_PRIVATE_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
script: | | ||
docker ps -q --filter "name=core" | xargs -r docker stop | ||
docker ps -aq --filter "name=core" | xargs -r docker rm | ||
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username ${{ secrets.AWS_DOCKER_USER }} --password-stdin ${{ secrets.AWS_USER_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com | ||
docker image prune -f | ||
docker pull ${{ steps.meta.outputs.tags }} | ||
docker run -d -p 8080:8080 -e ENVIRONMENT=dev --name core --network test_backend ${{ steps.meta.outputs.tags }} | ||
docker run -d -p 8080:8080 -e ENVIRONMENT=prod --name core --network ec2-user_backend ${{ steps.meta.outputs.tags }} | ||
- name: Remove Github Actions IP from security group | ||
if: always() | ||
run: | | ||
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_EC2_CORE_SG_ID }} --group-name ${{secrets.AWS_EC2_CORE_SG_NAME}} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_PROD_CORE_NOTI_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
- uses: sarisia/actions-status-discord@v1 | ||
if: success() | ||
with: | ||
webhook: ${{ secrets.DISCORD_WEBHOOK }} | ||
status: ${{ job.status }} | ||
content: "여러분 <@384742716933668867> <@1084774841460215839> <@545902166842408960> <@1081452554149449748>\n 배포 완료했습니다!!" | ||
title: "배포 완료 알림" | ||
description: "백엔드 개발 브랜치에 깃허브 액션으로 배포 완료" | ||
title: "코어 운영 서버 배포 완료 알림" | ||
description: "백엔드 개발 브랜치에서 운영 환경으로 깃허브 액션으로 배포 완료" | ||
image: ${{ secrets.EMBED_IMAGE }} | ||
color: 0x0000ff | ||
url: "https://github.com/tukcomCD2024/DroidBlossom/actions" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
name: core-test-ci/cd | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop_back_core | ||
- 'hotfix/[0-9a-zA-z]+-B-core-#[0-9a-zA-z]+' | ||
pull_request: | ||
branches: | ||
- develop_back_core | ||
|
||
jobs: | ||
build_and_test: | ||
name: build and test | ||
if: ${{github.event_name == 'pull_request' }} | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: ./backend/core | ||
|
||
steps: | ||
- name: set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'liberica' | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
token: ${{ secrets.CI_PAT }} | ||
|
||
- name: formatting | ||
uses: axel-op/googlejavaformat-action@v3 | ||
with: | ||
args: "--replace" | ||
skip-commit: true | ||
|
||
- name: grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
|
||
- name: test | ||
run: ./gradlew clean test | ||
|
||
deploy-core: | ||
name: core application deploy | ||
if: ${{ github.event_name == 'push' }} | ||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: ./backend/core | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
token: ${{ secrets.CI_PAT }} | ||
|
||
- name: set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'liberica' | ||
cache: gradle | ||
|
||
- name: grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
|
||
- name: build gradle | ||
run: ./gradlew clean build | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ steps.login-ecr.outputs.registry }}/${{ secrets.AWS_TEST_ENV_ECR_CORE_REPOSITORY_NAME }} | ||
tags: | | ||
type=raw,value={{date 'YYYYMMDD-HHmmss'}} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./backend/core | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
provenance: false | ||
|
||
- name: Get Github action IP | ||
id: ip | ||
uses: haythem/[email protected] | ||
|
||
- name: Add Github Actions IP to Security group | ||
run: | | ||
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_TEST_ENV_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
- name: Connect ec2 and Run Docker Container | ||
uses: appleboy/[email protected] | ||
env: | ||
AWS_ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
with: | ||
host: ${{ secrets.SSH_TEST_ENV_HOST }} | ||
username: ${{ secrets.SSH_TEST_ENV_USERNAME }} | ||
key: ${{ secrets.SSH_TEST_ENV_PRIVATE_KEY }} | ||
port: ${{ secrets.SSH_TEST_ENV_PORT }} | ||
script: | | ||
docker ps -q --filter "name=core" | xargs -r docker stop | ||
docker ps -aq --filter "name=core" | xargs -r docker rm | ||
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username ${{ secrets.AWS_TEST_ENV_DOCKER_USER }} --password-stdin ${{ secrets.AWS_TEST_ENV_USER_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com | ||
docker image prune -f | ||
docker pull ${{ steps.meta.outputs.tags }} | ||
docker run -d -p 8080:8080 -e ENVIRONMENT=container --name core --network test_backend ${{ steps.meta.outputs.tags }} | ||
- name: Remove Github Actions IP from security group | ||
if: always() | ||
run: | | ||
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_TEST_ENV_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
- uses: sarisia/actions-status-discord@v1 | ||
if: success() | ||
with: | ||
webhook: ${{ secrets.DISCORD_WEBHOOK }} | ||
status: ${{ job.status }} | ||
content: "여러분 <@384742716933668867> <@1084774841460215839> <@545902166842408960> <@1081452554149449748>\n 배포 완료했습니다!!" | ||
title: "코어 테스트 서버 배포 완료 알림" | ||
description: "백엔드 개발 브랜치에서 테스트 환경으로 깃허브 액션으로 배포 완료" | ||
image: ${{ secrets.EMBED_IMAGE }} | ||
color: 0x0000ff | ||
url: "https://github.com/tukcomCD2024/DroidBlossom/actions" | ||
username: GitHub Actions Bot | ||
avatar_url: ${{ secrets.AVATAR_URL }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: notification-ci/cd | ||
name: notification-test-ci/cd | ||
|
||
on: | ||
push: | ||
|
@@ -83,12 +83,6 @@ jobs: | |
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
@@ -98,15 +92,14 @@ jobs: | |
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ steps.login-ecr.outputs.registry }}/${{ secrets.AWS_ECR_NOTIFICATION_REPOSITORY_NAME }} | ||
${{ steps.login-ecr.outputs.registry }}/${{ secrets.AWS_TEST_ENV_NOTIFICATION_REPOSITORY_NAME }} | ||
tags: | | ||
type=raw,value=latest | ||
type=raw,value={{date 'YYYYMMDD-HHmmss'}} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./backend/notification | ||
platforms: linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
provenance: false | ||
|
@@ -117,38 +110,38 @@ jobs: | |
|
||
- name: Add Github Actions IP to Security group | ||
run: | | ||
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_EC2_CORE_SG_ID }} --group-name ${{secrets.AWS_EC2_CORE_SG_NAME}} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_TEST_ENV_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
- name: Connect ec2 and Run Docker Container | ||
uses: appleboy/[email protected] | ||
env: | ||
AWS_ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
with: | ||
host: ${{ secrets.SSH_CORE_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_CORE_PRIVATE_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
host: ${{ secrets.SSH_TEST_ENV_HOST }} | ||
username: ${{ secrets.SSH_TEST_ENV_USERNAME }} | ||
key: ${{ secrets.SSH_TEST_ENV_PRIVATE_KEY }} | ||
port: ${{ secrets.SSH_TEST_ENV_PORT }} | ||
script: | | ||
docker ps -q --filter "name=notification" | xargs -r docker stop | ||
docker ps -aq --filter "name=notification" | xargs -r docker rm | ||
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username ${{ secrets.AWS_DOCKER_USER }} --password-stdin ${{ secrets.AWS_USER_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com | ||
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username ${{ secrets.AWS_TEST_ENV_DOCKER_USER }} --password-stdin ${{ secrets.AWS_TEST_ENV_USER_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com | ||
docker image prune -f | ||
docker pull ${{ steps.meta.outputs.tags }} | ||
docker run -d -p 8081:8081 -e ENVIRONMENT=dev --name notification --network test_backend ${{ steps.meta.outputs.tags }} | ||
docker run -d -p 8081:8081 -e ENVIRONMENT=container --name notification --network test_backend ${{ steps.meta.outputs.tags }} | ||
- name: Remove Github Actions IP from security group | ||
if: always() | ||
run: | | ||
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_EC2_CORE_SG_ID }} --group-name ${{secrets.AWS_EC2_CORE_SG_NAME}} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_TEST_ENV_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32 | ||
- uses: sarisia/actions-status-discord@v1 | ||
if: success() | ||
with: | ||
webhook: ${{ secrets.DISCORD_WEBHOOK }} | ||
status: ${{ job.status }} | ||
content: "여러분 <@384742716933668867> <@1084774841460215839> <@545902166842408960> <@1081452554149449748>\n 배포 완료했습니다!!" | ||
title: "알림 서버 배포 완료 알림" | ||
description: "백엔드 알림 개발 브랜치에 깃허브 액션으로 배포 완료" | ||
title: "알림 테스트 서버 배포 완료 알림" | ||
description: "백엔드 알림 개발 브랜치에 깃허브 액션으로 테스트 서버 배포 완료" | ||
image: ${{ secrets.EMBED_IMAGE }} | ||
color: 0x0000ff | ||
url: "https://github.com/tukcomCD2024/DroidBlossom/actions" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.idea | ||
|
||
backend/data | ||
backend/data | ||
|
||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...e/src/main/java/site/timecapsulearchive/core/domain/announcement/api/AnnouncementApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package site.timecapsulearchive.core.domain.announcement.api; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import org.springframework.http.ResponseEntity; | ||
import site.timecapsulearchive.core.domain.announcement.data.response.AnnouncementsResponse; | ||
import site.timecapsulearchive.core.global.common.response.ApiSpec; | ||
|
||
public interface AnnouncementApi { | ||
@Operation( | ||
summary = "공지사항 페이지", | ||
description = "모든 공지사항을 가져온다. 최신 공지가 리스트의 맨 처음에 위치한다.", | ||
tags = {"announcement"} | ||
) | ||
@ApiResponses(value = { | ||
@ApiResponse( | ||
responseCode = "200", | ||
description = "ok" | ||
) | ||
}) | ||
ResponseEntity<ApiSpec<AnnouncementsResponse>> getAnnouncements(); | ||
} |
Oops, something went wrong.