Skip to content

Commit

Permalink
Merge pull request #255 from boostcampwm2023/BE-develop
Browse files Browse the repository at this point in the history
develop ๋ธŒ๋žœ์น˜ ๋ฐ˜์˜
  • Loading branch information
Conut-1 authored Dec 11, 2023
2 parents 5e72caf + 48bf0de commit 3c7b959
Show file tree
Hide file tree
Showing 105 changed files with 4,240 additions and 196 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/BE-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: BE-deploy
on:
push:
branches:
- "BE-develop"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: BE-develop
sparse-checkout: nestjs-BE
- name: Login to github Packages
run: echo ${{ secrets.PACKAGE_ACCESS_TOKEN }} | docker login ghcr.io -u ${{ secrets.PACKAGE_USERNAME }} --password-stdin
- name: Build and push Docker image
run: |
echo "SERVER_PORT=$SERVER_PORT" >> ./nestjs-BE/server/.env
echo "JWT_ACCESS_SECRET=$JWT_ACCESS_SECRET" >> ./nestjs-BE/server/.env
echo "JWT_REFRESH_SECRET=$JWT_REFRESH_SECRET" >> ./nestjs-BE/server/.env
echo "KAKAO_ADMIN_KEY=$KAKAO_ADMIN_KEY" >> ./nestjs-BE/server/.env
echo "MYSQL_DATABASE_URL=$MYSQL_DATABASE_URL" >> ./nestjs-BE/server/.env
echo "MONGODB_DATABASE_URL=$MONGODB_DATABASE_URL" >> ./nestjs-BE/server/.env
echo "MONGODB_DATABASE_URI=$MONGODB_DATABASE_URI" >> ./nestjs-BE/server/.env
echo "NCLOUD_ACCESS_KEY=$NCLOUD_ACCESS_KEY" >> ./nestjs-BE/server/.env
echo "NCLOUD_SECRET_KEY=$NCLOUD_SECRET_KEY" >> ./nestjs-BE/server/.env
echo "NCLOUD_REGION=$NCLOUD_REGION" >> ./nestjs-BE/server/.env
echo "STORAGE_URL=$STORAGE_URL" >> ./nestjs-BE/server/.env
echo "BASE_IMAGE_URL=$BASE_IMAGE_URL" >> ./nestjs-BE/server/.env
echo "BUCKET_NAME=$BUCKET_NAME" >> ./nestjs-BE/server/.env
echo "APP_ICON_URL=$APP_ICON_URL" >> ./nestjs-BE/server/.env
echo "CSV_FOLDER=$CSV_FOLDER" >> ./nestjs-BE/server/.env
docker build -t ghcr.io/${{ secrets.PACKAGE_USERNAME }}/mindsync ./nestjs-BE/server
docker push ghcr.io/${{ secrets.PACKAGE_USERNAME }}/mindsync:latest
env:
SERVER_PORT: ${{ secrets.CONTAINER_PORT }}
JWT_ACCESS_SECRET: ${{ secrets.JWT_ACCESS_SECRET }}
JWT_REFRESH_SECRET: ${{ secrets.JWT_REFRESH_SECRET }}
KAKAO_ADMIN_KEY: ${{ secrets.KAKAO_ADMIN_KEY }}
MYSQL_DATABASE_URL: ${{ secrets.MYSQL_DATABASE_URL }}
MONGODB_DATABASE_URL: ${{ secrets.MONGODB_DATABASE_URL }}
MONGODB_DATABASE_URI: ${{ secrets.MONGODB_DATABASE_URI }}
NCLOUD_ACCESS_KEY: ${{ secrets.NCLOUD_ACCESS_KEY }}
NCLOUD_SECRET_KEY: ${{ secrets.NCLOUD_SECRET_KEY }}
NCLOUD_REGION: ${{ secrets.NCLOUD_REGION }}
STORAGE_URL: ${{ secrets.STORAGE_URL }}
BASE_IMAGE_URL: ${{ secrets.BASE_IMAGE_URL }}
BUCKET_NAME: ${{ secrets.BUCKET_NAME }}
APP_ICON_URL: ${{ secrets.APP_ICON_URL }}
CSV_FOLDER: ${{ secrets.CSV_FOLDER }}

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Pull Docker image
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
port: ${{ secrets.REMOTE_PORT }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_SSH_KEY }}
script: |
echo ${{ secrets.PACKAGE_ACCESS_TOKEN }} | docker login ghcr.io -u ${{ secrets.PACKAGE_USERNAME }} --password-stdin
docker pull ghcr.io/${{ secrets.PACKAGE_USERNAME }}/mindsync
docker stop mindsync_server || true
docker rm mindsync_server || true
docker run -d \
--name mindsync_server \
-p ${{ secrets.SERVER_PORT }}:${{ secrets.CONTAINER_PORT }} \
-v temporary-volume:${{ secrets.CSV_FOLDER }} \
ghcr.io/${{ secrets.PACKAGE_USERNAME }}/mindsync
66 changes: 0 additions & 66 deletions nestjs-BE/crdt/lww-map.ts

This file was deleted.

31 changes: 0 additions & 31 deletions nestjs-BE/crdt/lww-register.ts

This file was deleted.

9 changes: 9 additions & 0 deletions nestjs-BE/server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
README.md
/test

.eslintrc.js
.gitignore
.prettierrc
nest-cli.json

*.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'off',
'max-depth': ['error', 3],
'no-magic-numbers': ['error', { ignore: [-1, 0, 1] }],
'curly': ['error', 'multi', 'consistent'],
'curly': ['error', 'multi-line', 'consistent'],
'max-params': ['error', 3],
},
};
9 changes: 8 additions & 1 deletion nestjs-BE/.gitignore โ†’ nestjs-BE/server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ lerna-debug.log*
*.sublime-workspace

# IDE - VSCode
/.vscode
/.vscode

# Environment Variable File
.env

# csv, prisma
/operations
/prisma/generated
File renamed without changes.
17 changes: 17 additions & 0 deletions nestjs-BE/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:20.4.0-alpine

WORKDIR /server

COPY package.json package-lock.json ./

RUN npm ci

COPY ./ ./

RUN npx prisma generate --schema=./prisma/mysql.schema.prisma

RUN npx prisma generate --schema=./prisma/mongodb.schema.prisma

EXPOSE 3000

CMD ["npm", "start"]
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3c7b959

Please sign in to comment.