Skip to content

Commit

Permalink
Merge pull request #168 from kookmin-sw/develop-back
Browse files Browse the repository at this point in the history
main이랑 develop-back 한번 합치기
  • Loading branch information
mclub4 authored May 6, 2024
2 parents 53e9da7 + 93f68f9 commit 21304b8
Show file tree
Hide file tree
Showing 124 changed files with 2,670 additions and 2,407 deletions.
75 changes: 62 additions & 13 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
run: |
echo DB_ENDPOINT=${{ secrets.DB_ENDPOINT }} >> .env
echo DB_NAME=${{ secrets.DB_NAME }} >> .env
echo DB_PORT=${{ secrets.DB_PORT }} >> .env
echo MYSQL_USERNAME=${{ secrets.MYSQL_USERNAME }} >> .env
echo MYSQL_PASSWORD=${{ secrets.MYSQL_PASSWORD }} >> .env
echo JWT_SECRET=${{ secrets.JWT_SECRET }} >> .env
Expand All @@ -34,39 +35,42 @@ jobs:
echo REDIS_PORT=${{ secrets.REDIS_PORT }} >> .env
echo S3_ACCESS_KEY=${{ secrets.S3_ACCESS_KEY }} >> .env
echo S3_SECRET_KEY=${{ secrets.S3_SECRET_KEY }} >> .env
echo S3_SECRET_KEY=${{ secrets.SECRET_KEY_BASE }} >> .env
echo S3_SECRET_KEY=${{ secrets.SERVER_NAME }} >> .env
echo SECRET_KEY_BASE=${{ secrets.SECRET_KEY_BASE }} >> .env
echo SERVER_NAME=${{ secrets.SERVER_NAME }} >> .env
echo SERVER_URL=${{ secrets.SERVER_URL }} >> .env
echo CHATBOT_URL=${{ secrets.CHATBOT_URL }} >> .env
- name: Copy .env to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.AWS_HOST }}
username: ubuntu
key: ${{ secrets.AWS_KEY }}
source: "/github/workspace/.env"
target: "/home/ubuntu/capstone"
source: "./.env"
target: "capstone"

- name: Copy docker-compose.yaml to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.AWS_HOST }}
username: ubuntu
key: ${{ secrets.AWS_KEY }}
source: "/github/workspace/back/docker-compose.yml"
target: "/home/ubuntu/capstone"
source: "./docker-compose.yml"
target: "capstone"

- name: action-slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: PetBuddy Github
author_name: 외국민
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()

build-spring:
runs-on: ubuntu-latest
needs: setup-env

steps:
- name: Checkout
Expand Down Expand Up @@ -94,14 +98,15 @@ jobs:
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: PetBuddy Github
author_name: 외국민
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()

build-nginx:
runs-on: ubuntu-latest
needs: setup-env

steps:
- name: Checkout
Expand Down Expand Up @@ -129,14 +134,15 @@ jobs:
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: PetBuddy Github
author_name: 외국민
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()

build-ruby:
runs-on: ubuntu-latest
needs: setup-env

steps:
- name: Checkout
Expand Down Expand Up @@ -164,15 +170,57 @@ jobs:
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: PetBuddy Github
author_name: 외국민
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()

build-gateway:
runs-on: ubuntu-latest
needs: setup-env

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Spring
uses: docker/build-push-action@v5
with:
context: ./back-gateway
push: true
tags: ${{ secrets.DOCKER_REPO }}/spring-gateway:latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: action-slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: 외국민
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()

deploy:
runs-on : ubuntu-latest
needs: [build-spring, build-nginx, build-ruby]
needs: [build-spring, build-nginx, build-ruby, build-gateway]

steps:
- name: executing remote ssh commands using password
Expand All @@ -189,15 +237,16 @@ jobs:
sudo docker pull ${{ secrets.DOCKER_REPO }}/spring:latest
sudo docker pull ${{ secrets.DOCKER_REPO }}/nginx:latest
sudo docker pull ${{ secrets.DOCKER_REPO }}/ruby:latest
sudo docker pull ${{ secrets.DOCKER_REPO }}/spring-gateway:latest
sudo docker compose -f capstone/docker-compose.yml up -d
sudo docker image prune -f
- name: action-slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: PetBuddy Github
author_name: 외국민
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Expand Down
11 changes: 11 additions & 0 deletions back-chat/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,14 @@

.env
env.bashrc
.idea

# 디폴트 무시된 파일
.idea/dataSources.xml
.idea/vcs.xml
.idea/workspace.xml
.idea/.gitignore
.idea/dataSources
.idea/modules.xml
.idea/dataSources.local.xml
.idea/back-chat.iml
8 changes: 0 additions & 8 deletions back-chat/.idea/.gitignore

This file was deleted.

Loading

0 comments on commit 21304b8

Please sign in to comment.