Skip to content

Service 계층에서 발생하는 에러 상태 코드 수정 #82

Service 계층에서 발생하는 에러 상태 코드 수정

Service 계층에서 발생하는 에러 상태 코드 수정 #82

Workflow file for this run

name: Server Nest CD
on:
pull_request:
branches: ["develop", "main"]
paths:
- "server/nest/**"
types:
- closed
jobs:
deploy:
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Install depenencies
run: |
cd server/nest
npm install
- name: Create prod.env file
env:
DB_HOST_IP: ${{ secrets.SERVER_ENV_DB_HOST_IP }}
DB_PORT: ${{ secrets.SERVER_ENV_DB_PORT }}
DB_USER_NAME: ${{ secrets.SERVER_ENV_DB_USER_NAME }}
DB_PASSWORD: ${{ secrets.SERVER_ENV_DB_PASSWORD }}
DB_DATABASE_NAME: ${{ secrets.SERVER_ENV_DB_DATABASE_NAME }}
ACCESS_ID: ${{ secrets.SERVER_ENV_ACCESS_ID }}
SECRET_ACCESS_KEY: ${{ secrets.SERVER_ENV_SECRET_ACCESS_KEY }}
JWT_SECRET_KEY: ${{ secrets.SERVER_ENV_JWT_SECRET_KEY }}
GREEN_EYE_SECRET_KEY: ${{secrets.GREEN_EYE_SECRET_KEY}}
GREEN_EYE_REQUEST_URL: ${{secrets.GREEN_EYE_REQUEST_URL}}
CLOUD_FUNCTIONS_EXECUTE_URL: ${{secrets.CLOUD_FUNCTIONS_EXECUTE_URL}}
CLOUD_FUNCTIONS_REQUEST_URL: ${{secrets.CLOUD_FUNCTIONS_REQUEST_URL}}
API_GW_ACCESS_KEY: ${{secrets.API_GW_ACCESS_KEY}}
REFRESH_SECRET_KEY: ${{secrets.REFRESH_SECRET_KEY}}
REDIS_HOST_IP: ${{secrets.REDIS_HOST_IP}}
REDIS_PASSWORD: ${{secrets.REDIS_PASSWORD}}
REDIS_PORT: ${{secrets.REDIS_PORT}}
REDIS_TTL: ${{secrets.REDIS_TTL}}
run: |
cd server/nest
touch prod.env
echo "DB_HOST_IP=$DB_HOST_IP" >> prod.env
echo "DB_PORT=$DB_PORT" >> prod.env
echo "DB_USER_NAME=$DB_USER_NAME" >> prod.env
echo "DB_PASSWORD=$DB_PASSWORD" >> prod.env
echo "DB_DATABASE_NAME=$DB_DATABASE_NAME" >> prod.env
echo "ACCESS_ID=$ACCESS_ID" >> prod.env
echo "SECRET_ACCESS_KEY=$SECRET_ACCESS_KEY" >> prod.env
echo "JWT_SECRET_KEY=$JWT_SECRET_KEY" >> prod.env
echo "GREEN_EYE_SECRET_KEY=$GREEN_EYE_SECRET_KEY" >> prod.env
echo "GREEN_EYE_REQUEST_URL=$GREEN_EYE_REQUEST_URL" >> prod.env
echo "CLOUD_FUNCTIONS_EXECUTE_URL=$CLOUD_FUNCTIONS_EXECUTE_URL" >> prod.env
echo "CLOUD_FUNCTIONS_REQUEST_URL=$CLOUD_FUNCTIONS_REQUEST_URL" >> prod.env
echo "API_GW_ACCESS_KEY=$API_GW_ACCESS_KEY" >> prod.env
echo "REFRESH_SECRET_KEY=$REFRESH_SECRET_KEY" >> prod.env
echo "REDIS_HOST_IP=$REDIS_HOST_IP" >> prod.env
echo "REDIS_PASSWORD=$REDIS_PASSWORD" >> prod.env
echo "REDIS_PORT=$REDIS_PORT" >> prod.env
echo "REDIS_TTL=$REDIS_TTL" >> prod.env
- name: Build Docker image
run: docker build --platform linux/amd64 ./server -t ${{ secrets.NCP_REGISTRY }}/catchy-tape:latest -f ./server/Dockerfile.nest
- name: Login NCP container registry
run: docker login ${{ secrets.NCP_REGISTRY }} -u ${{ secrets.NCP_DOCKER_ACCESS_KEY_ID }} -p ${{ secrets.NCP_DOCKER_SECRET_KEY }}
- name: Push Docker image to registry
run: docker push ${{ secrets.NCP_REGISTRY }}/catchy-tape:latest
- name: SSH into Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_SSH_HOST }}
username: ${{ secrets.SERVER_SSH_USER }}
password: ${{ secrets.SERVER_SSH_PASSWORD }}
port: ${{ secrets.SERVER_SSH_PORT }}
script: |
export NCP_REGISTRY=${{ secrets.NCP_REGISTRY }}
export NCP_DOCKER_ACCESS_KEY_ID=${{ secrets.NCP_DOCKER_ACCESS_KEY_ID }}
export NCP_DOCKER_SECRET_KEY=${{ secrets.NCP_DOCKER_SECRET_KEY }}
sh server/deploy.sh
curl -X POST -H 'Content-type: application/json' --data '{"text":"서버 배포 성공!"}' ${{ secrets.SLACK_WEBHOOK_URL }}