Skip to content

Commit

Permalink
Chore: MSA 독립 배포 가능하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
gkdudans committed Jan 22, 2025
1 parent 0dd7838 commit 6576ef6
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 91 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/github-actions-auth.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: bookwoori CI/CD v3
name: bookwoori Auth Service CI/CD

on:
push:
Expand Down Expand Up @@ -37,14 +37,6 @@ jobs:
touch ./auth/src/main/resources/application.yml
echo "${{ secrets.APPLICATION_auth }}" > ./auth/src/main/resources/application.yml
- name: create-json
id: create-json
uses: jsdaniell/[email protected]
with:
name: "firebase-adminsdk.json"
json: ${{ secrets.FIREBASE_ADMINSDK }}
dir: "./auth/src/main/resources"

- name: Build Auth Service with Gradle
run: |
cd ./auth
Expand Down Expand Up @@ -76,3 +68,5 @@ jobs:
sudo docker ps -a --filter "name=auth" --format "{{.ID}}" | xargs -r sudo docker stop
sudo docker ps -a --filter "name=auth" --format "{{.ID}}" | xargs -r sudo docker rm -f
sudo docker pull ${{ secrets.DOCKER_REPO_auth }}:v2
sudo docker run -d -p 8001:8001 ${{ secrets.DOCKER_REPO_auth }}:v2
sudo docker image prune -f
5 changes: 4 additions & 1 deletion .github/workflows/github-actions-core.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: bookwoori CI/CD v3
name: bookwoori Core Service CI/CD

on:
push:
Expand Down Expand Up @@ -76,3 +76,6 @@ jobs:
sudo docker ps -a --filter "name=core-app" --format "{{.ID}}" | xargs -r sudo docker stop
sudo docker ps -a --filter "name=core-app" --format "{{.ID}}" | xargs -r sudo docker rm -f
sudo docker pull ${{ secrets.DOCKER_REPO_core }}:v2
sudo docker run -d -p 8080:8080 ${{ secrets.DOCKER_REPO_core }}:v2
sudo docker image prune -f
73 changes: 73 additions & 0 deletions .github/workflows/github-actions-notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: bookwoori notification Service CI/CD

on:
push:
branches: ["deploy"]
paths:
- "notification/**"

jobs:
build-and-deploy:
name: Build and Deploy notification Service
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

# Eureka 관련 설정 삭제
- name: Remove Eureka Dependencies
run: |
find . -name 'build.gradle' | while read -r file; do
sed -i '/spring-cloud-starter-netflix-eureka-client/d' "$file"
sed -i '/spring-cloud-starter-netflix-eureka-server/d' "$file"
done
find . -name 'application*.yml' | while read -r file; do
sed -i '/eureka:/,+3d' "$file"
done
- name: Make application-prod.yml
run: |
mkdir -p ./notification/src/main/resources
touch ./notification/src/main/resources/application.yml
echo "${{ secrets.APPLICATION_notification }}" > ./notification/src/main/resources/application.yml
- name: Build notification Service with Gradle
run: |
cd ./notification
chmod +x ./gradlew
./gradlew clean build -x test --no-daemon
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker Build and Push
uses: docker/build-push-action@v6
with:
context: ./notification
file: ./notification/Dockerfile
platforms: linux/arm64/v8
push: true
tags: ${{ secrets.DOCKER_REPO_notification }}:v2

- name: Deploy to Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
sudo docker ps -a --filter "name=notification-app" --format "{{.ID}}" | xargs -r sudo docker stop
sudo docker ps -a --filter "name=notification-app" --format "{{.ID}}" | xargs -r sudo docker rm -f
sudo docker pull ${{ secrets.DOCKER_REPO_notification }}:v2
sudo docker run -d -p 8082:8082 ${{ secrets.DOCKER_REPO_notification }}:v2
sudo docker image prune -f
72 changes: 72 additions & 0 deletions .github/workflows/github-actions.chat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: bookwoori Chat Service CI/CD

on:
push:
branches: ["deploy"]
paths:
- "chat/**"

jobs:
build-and-deploy:
name: Build and Deploy chat Service
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

# Eureka 관련 설정 삭제
- name: Remove Eureka Dependencies
run: |
find . -name 'build.gradle' | while read -r file; do
sed -i '/spring-cloud-starter-netflix-eureka-client/d' "$file"
sed -i '/spring-cloud-starter-netflix-eureka-server/d' "$file"
done
find . -name 'application*.yml' | while read -r file; do
sed -i '/eureka:/,+3d' "$file"
done
- name: Make application-prod.yml
run: |
mkdir -p ./chat/src/main/resources
touch ./chat/src/main/resources/application.yml
echo "${{ secrets.APPLICATION_chat }}" > ./chat/src/main/resources/application.yml
- name: Build chat Service with Gradle
run: |
cd ./chat
chmod +x ./gradlew
./gradlew clean build -x test --no-daemon
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker Build and Push
uses: docker/build-push-action@v6
with:
context: ./chat
file: ./chat/Dockerfile
platforms: linux/arm64/v8
push: true
tags: ${{ secrets.DOCKER_REPO_chat }}:v2

- name: Deploy to Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
sudo docker ps -a --filter "name=chat" --format "{{.ID}}" | xargs -r sudo docker stop
sudo docker ps -a --filter "name=chat" --format "{{.ID}}" | xargs -r sudo docker rm -f
sudo docker pull ${{ secrets.DOCKER_REPO_chat }}:v2
sudo docker run -d -p 8081:8081 ${{ secrets.DOCKER_REPO_chat }}:v2
sudo docker image prune -f
72 changes: 72 additions & 0 deletions .github/workflows/github-actions.gateway.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: bookwoori Gateway Service CI/CD

on:
push:
branches: ["deploy"]
paths:
- "gateway/**"

jobs:
build-and-deploy:
name: Build and Deploy gateway Service
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

# Eureka 관련 설정 삭제
- name: Remove Eureka Dependencies
run: |
find . -name 'build.gradle' | while read -r file; do
sed -i '/spring-cloud-starter-netflix-eureka-client/d' "$file"
sed -i '/spring-cloud-starter-netflix-eureka-server/d' "$file"
done
find . -name 'application*.yml' | while read -r file; do
sed -i '/eureka:/,+3d' "$file"
done
- name: Make application-prod.yml
run: |
mkdir -p ./gateway/src/main/resources
touch ./gateway/src/main/resources/application.yml
echo "${{ secrets.APPLICATION_gateway }}" > ./gateway/src/main/resources/application.yml
- name: Build gateway Service with Gradle
run: |
cd ./gateway
chmod +x ./gradlew
./gradlew clean build -x test --no-daemon
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker Build and Push
uses: docker/build-push-action@v6
with:
context: ./gateway
file: ./gateway/Dockerfile
platforms: linux/arm64/v8
push: true
tags: ${{ secrets.DOCKER_REPO_gateway }}:v2

- name: Deploy to Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
sudo docker ps -a --filter "name=gateway" --format "{{.ID}}" | xargs -r sudo docker stop
sudo docker ps -a --filter "name=gateway" --format "{{.ID}}" | xargs -r sudo docker rm -f
sudo docker pull ${{ secrets.DOCKER_REPO_gateway }}:v2
sudo docker run -d -p 8000:8000 ${{ secrets.DOCKER_REPO_gateway }}:v2
sudo docker image prune -f
78 changes: 0 additions & 78 deletions .github/workflows/github-actions.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ public enum ErrorCode {
ALREADY_EXIST_REVIEW(409, 3703, "이미 레코드에 대한 리뷰가 존재합니다."),

// MessageRoom (3800 ~ 3899)
MESSAGE_ROOM_NOT_FOUND(404, 3800, "채팅방을 찾을 수 없습니다."),

;
MESSAGE_ROOM_NOT_FOUND(404, 3800, "채팅방을 찾을 수 없습니다.");

private final int status;
private final int code;
Expand Down

0 comments on commit 6576ef6

Please sign in to comment.