From 86eaf1f15271ded663bfb68bbdc330cd3b2e17d0 Mon Sep 17 00:00:00 2001 From: yeonjy <81320703+yeonjy@users.noreply.github.com> Date: Sun, 25 Feb 2024 03:07:30 +0900 Subject: [PATCH 01/12] =?UTF-8?q?build:=20runs-on=20=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rollthedice-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rollthedice-cd.yml b/.github/workflows/rollthedice-cd.yml index 1b8e7ca8..c62287d4 100644 --- a/.github/workflows/rollthedice-cd.yml +++ b/.github/workflows/rollthedice-cd.yml @@ -22,7 +22,7 @@ permissions: jobs: build: runs-on: ubuntu-22.04 - if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'Dev-backend' + if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} steps: # 지정한 저장소(현재 REPO)에서 코드를 워크플로우 환경으로 가져오도록 하는 github action From 6de378eba24c27d1c5251eea386a3943715f5a1b Mon Sep 17 00:00:00 2001 From: yeonjy <81320703+yeonjy@users.noreply.github.com> Date: Sun, 25 Feb 2024 03:14:08 +0900 Subject: [PATCH 02/12] =?UTF-8?q?build:=20runs-on=20=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rollthedice-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rollthedice-cd.yml b/.github/workflows/rollthedice-cd.yml index c62287d4..f5f1ac72 100644 --- a/.github/workflows/rollthedice-cd.yml +++ b/.github/workflows/rollthedice-cd.yml @@ -22,7 +22,7 @@ permissions: jobs: build: runs-on: ubuntu-22.04 - if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} + if: ${{ github.event.pull_request.base.ref == 'Dev-backend' || github.event_name == 'push' }} steps: # 지정한 저장소(현재 REPO)에서 코드를 워크플로우 환경으로 가져오도록 하는 github action From d171fe5f8ba057153be0c79c1f81c1ecd5318309 Mon Sep 17 00:00:00 2001 From: yeonjy <81320703+yeonjy@users.noreply.github.com> Date: Sun, 25 Feb 2024 03:45:34 +0900 Subject: [PATCH 03/12] =?UTF-8?q?build:=20docker-compose=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rollthedice-cd.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rollthedice-cd.yml b/.github/workflows/rollthedice-cd.yml index f5f1ac72..b523c505 100644 --- a/.github/workflows/rollthedice-cd.yml +++ b/.github/workflows/rollthedice-cd.yml @@ -71,5 +71,6 @@ jobs: script: | sudo docker rm -f $(docker ps -qa) sudo docker pull ${{ secrets.DOCKER_REPO }}/backend-dev - docker-compose up -d - docker image prune -f + cd ~/JinJiHan + sudo docker-compose -f docker-compose.yml down + sudo docker-compose -f docker-compose.yml up --build -d From d3622062f1ddf91d37aba29eed4bd8fc3bf603c8 Mon Sep 17 00:00:00 2001 From: yeonjy Date: Tue, 9 Apr 2024 11:50:15 +0900 Subject: [PATCH 04/12] =?UTF-8?q?feat:=20=20application-prod.yml=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-prod.yml | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 backend/core/src/main/resources/application-prod.yml diff --git a/backend/core/src/main/resources/application-prod.yml b/backend/core/src/main/resources/application-prod.yml new file mode 100644 index 00000000..865af277 --- /dev/null +++ b/backend/core/src/main/resources/application-prod.yml @@ -0,0 +1,64 @@ +spring: + datasource: + driver-class-name: ${DRIVER_CLASS_NAME} + url: jdbc:mysql://${DATABASE_URL}/${DATABASE_SCHEMA} + username: ${DATABASE_USERNAME} + password: ${DATABASE_PASSWORD} + jpa: + database-platform: org.hibernate.dialect.MySQLDialect + show-sql: true + hibernate: + ddl-auto: none + security: + oauth2: + client: + registration: + kakao: + client-id: ${KAKAO_CLIENT_ID} #rest api 키 값 + client-secret: ${KAKAO_CLIENT_SECRET} + redirect-uri: ${KAKAO_REDIRECT_URI} + client-authentication-method: client_secret_post + authorization-grant-type: authorization_code + client-name: Kakao + scope: + - profile_nickname + - profile_image + - account_email + provider: + kakao: + authorization-uri: ${KAKAO_AUTHORIZATION_URI} + token-uri: ${KAKAO_TOKEN_URI} + user-info-uri: ${KAKAO_USER_INFO_URI} + user-name-attribute: id + data: + redis: + host: ${REDIS_HOST} + port: ${REDIS_PORT} + + rabbitmq: + host: ${RABBITMQ_HOST} + port: ${RABBITMQ_PORT} + username: ${RABBITMQ_USERNAME} + password: ${RABBITMQ_PASSWORD} + listener: + simple: + prefetch: 50 + +jwt: + secret-key: ${JWT_SECRET_KEY} + access: + expiration: 3600000 #1hours + header: Authorization + refresh: + expiration: 604800000 #7days + header: Authorization-refresh + +rabbitmq: + summary: + queue.name: ${SUMMARY_QUEUE_NAME} + exchange.name: ${SUMMARY_EXCHANGE_NAME} + routing.key: ${SUMMARY_ROUTING_KEY} + store: + queue.name: ${STORE_QUEUE_NAME} + exchange.name: ${STORE_EXCHANGE_NAME} + routing.key: ${STORE_ROUTING_KEY} \ No newline at end of file From bd2cde07d46f71e0cab3a236cf3aca13011a70ef Mon Sep 17 00:00:00 2001 From: yeonjy Date: Tue, 9 Apr 2024 11:51:05 +0900 Subject: [PATCH 05/12] =?UTF-8?q?feat:=20application.yml=20active=20file?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/core/src/main/resources/application.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/core/src/main/resources/application.yml b/backend/core/src/main/resources/application.yml index e69de29b..90385b2b 100644 --- a/backend/core/src/main/resources/application.yml +++ b/backend/core/src/main/resources/application.yml @@ -0,0 +1,3 @@ +spring: + profiles: + active: prod \ No newline at end of file From 4de52fe6ce4bc2e431415d6b2b1a8a663a6305fb Mon Sep 17 00:00:00 2001 From: yeonjy Date: Tue, 9 Apr 2024 14:54:11 +0900 Subject: [PATCH 06/12] =?UTF-8?q?refactor:=20database=20url=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/core/src/main/resources/application-prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/core/src/main/resources/application-prod.yml b/backend/core/src/main/resources/application-prod.yml index 865af277..2aed0d1f 100644 --- a/backend/core/src/main/resources/application-prod.yml +++ b/backend/core/src/main/resources/application-prod.yml @@ -1,7 +1,7 @@ spring: datasource: driver-class-name: ${DRIVER_CLASS_NAME} - url: jdbc:mysql://${DATABASE_URL}/${DATABASE_SCHEMA} + url: ${DATASOURCE_URL} username: ${DATABASE_USERNAME} password: ${DATABASE_PASSWORD} jpa: From 8e6a108111ada477f0765b2b6e21125e2f5608a0 Mon Sep 17 00:00:00 2001 From: yeonjy <81320703+yeonjy@users.noreply.github.com> Date: Wed, 10 Apr 2024 05:56:59 +0900 Subject: [PATCH 07/12] =?UTF-8?q?chore:=20java=20distribution=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{rollthedice-cd.yml => gradle.yml} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename .github/workflows/{rollthedice-cd.yml => gradle.yml} (96%) diff --git a/.github/workflows/rollthedice-cd.yml b/.github/workflows/gradle.yml similarity index 96% rename from .github/workflows/rollthedice-cd.yml rename to .github/workflows/gradle.yml index b523c505..75266804 100644 --- a/.github/workflows/rollthedice-cd.yml +++ b/.github/workflows/gradle.yml @@ -1,4 +1,4 @@ -name: Roll The Dice Backend CD +name: Roll The Dice Backend CI/CD defaults: run: @@ -26,6 +26,7 @@ jobs: steps: # 지정한 저장소(현재 REPO)에서 코드를 워크플로우 환경으로 가져오도록 하는 github action + - name: Checkout - uses: actions/checkout@v3 # open jdk 17 버전 환경을 세팅 @@ -33,7 +34,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: '17' - distribution: "adopt" + distribution: "temurin" # Github secrets로부터 데이터를 받아서, 워크 플로우에 파일을 생성 - name: Make application.yml From 2f6baa01c0fbfd0db5951924b1cca8921d54f69c Mon Sep 17 00:00:00 2001 From: yeonjy Date: Wed, 10 Apr 2024 06:08:03 +0900 Subject: [PATCH 08/12] chore: active prod -> dev --- backend/core/src/main/resources/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/core/src/main/resources/application.yml b/backend/core/src/main/resources/application.yml index 90385b2b..caf4dfcd 100644 --- a/backend/core/src/main/resources/application.yml +++ b/backend/core/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: profiles: - active: prod \ No newline at end of file + active: dev \ No newline at end of file From c66502fb03e3a75b5ac494ead11d8f62b587d27e Mon Sep 17 00:00:00 2001 From: yeonjy Date: Wed, 10 Apr 2024 06:34:37 +0900 Subject: [PATCH 09/12] =?UTF-8?q?feat:=20docker-compose.yml=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/core/docker-compose.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 backend/core/docker-compose.yml diff --git a/backend/core/docker-compose.yml b/backend/core/docker-compose.yml new file mode 100644 index 00000000..3e8c0de5 --- /dev/null +++ b/backend/core/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.9" +services: + redis: + container_name: redis + image: redis:alpine + restart: always + ports: + - "6379:6379" + + rabbitmq: + image: rabbitmq:management + ports: + - "5672:5672" + - "15672:15672" \ No newline at end of file From 210fb341930d3e1fdfe90bb69c58cfe328339dc6 Mon Sep 17 00:00:00 2001 From: yeonjy Date: Wed, 10 Apr 2024 07:17:23 +0900 Subject: [PATCH 10/12] =?UTF-8?q?feat:=20backend=20network=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20&=20entrypoint=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/core/docker-compose.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/backend/core/docker-compose.yml b/backend/core/docker-compose.yml index 3e8c0de5..6fd391c1 100644 --- a/backend/core/docker-compose.yml +++ b/backend/core/docker-compose.yml @@ -1,14 +1,27 @@ version: "3.9" services: redis: + image: redis:latest container_name: redis - image: redis:alpine - restart: always ports: - "6379:6379" + networks: + backend: + restart: always + tty: true rabbitmq: - image: rabbitmq:management + image: rabbitmq:3-management + container_name: rabbitmq + entrypoint: > + /bin/bash -c " + rabbitmq-server & + sleep 10 && rabbitmq-plugins enable rabbitmq_web_stomp & + tail -f /dev/null + " ports: - "5672:5672" - - "15672:15672" \ No newline at end of file + - "15672:15672" + +networks: + backend: \ No newline at end of file From 9e5b5e5d2ee8ce9908012c428353fa00e0361e8e Mon Sep 17 00:00:00 2001 From: yeonjy Date: Wed, 10 Apr 2024 07:43:09 +0900 Subject: [PATCH 11/12] =?UTF-8?q?feat:=20Dockerfile=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/core/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 backend/core/Dockerfile diff --git a/backend/core/Dockerfile b/backend/core/Dockerfile new file mode 100644 index 00000000..e0780add --- /dev/null +++ b/backend/core/Dockerfile @@ -0,0 +1,4 @@ +FROM eclipse-temurin:17-jdk-jammy AS build +WORKDIR /app +COPY . /app +CMD ["gradle", "bootRun"] \ No newline at end of file From efbaf3c29745c90a4944ee0fc86d6fd84abbce77 Mon Sep 17 00:00:00 2001 From: yeonjy Date: Wed, 10 Apr 2024 07:49:58 +0900 Subject: [PATCH 12/12] =?UTF-8?q?feat:=20RabbitMQ=20=EB=94=94=ED=8F=B4?= =?UTF-8?q?=ED=8A=B8=20=EA=B3=84=EC=A0=95=20=EC=84=A4=EC=A0=95=20&=20?= =?UTF-8?q?=EB=B3=BC=EB=A5=A8=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/core/docker-compose.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/core/docker-compose.yml b/backend/core/docker-compose.yml index 6fd391c1..3b78e8d5 100644 --- a/backend/core/docker-compose.yml +++ b/backend/core/docker-compose.yml @@ -19,9 +19,21 @@ services: sleep 10 && rabbitmq-plugins enable rabbitmq_web_stomp & tail -f /dev/null " + environment: + RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER} + RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS} ports: - "5672:5672" - "15672:15672" + volumes: + - data_rabbitmq:/rabbitmq + networks: + - backend + restart: always + tty: true networks: - backend: \ No newline at end of file + backend: + +volumes: + data_rabbitmq: null \ No newline at end of file