Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 데모용 Pull Request #45

Merged
merged 106 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
1cdf45c
⚙️ chore docker를 이용한 CD 구현
jinddings Nov 5, 2024
194f631
⚙️ chore : npm pakage 캐싱 코드 추가
jinddings Nov 5, 2024
6588f8f
⚙️ chore : npm pakage 캐싱경로 수정
jinddings Nov 5, 2024
e00fa33
⚙️ chore :working directory 변경
jinddings Nov 5, 2024
53e739d
� fix: lint 오류사항 임시 수정
jinddings Nov 5, 2024
5dc0183
⚙️ chore: DOCKER_IMAGE 변수 수정
jinddings Nov 5, 2024
41ee2bd
⚙️ chore:docker build 명령어 수정정
jinddings Nov 5, 2024
ed7b3dd
⚙️ chore docker 변수 설정
jinddings Nov 5, 2024
44a5627
⚙️ chor: deploy yml 수정
jinddings Nov 5, 2024
610bdff
⚙️ chor:docker image 이름 수정
jinddings Nov 5, 2024
e7dac7c
⚙️ choe : jobs 병합
jinddings Nov 5, 2024
7266940
⚙️ chre : docker image 이름 변경
jinddings Nov 5, 2024
c49c639
⚙️ core : yml 파일 수정
jinddings Nov 5, 2024
318dd2d
⚙️ chore: run 하는 docker image 이름 변경
jinddings Nov 5, 2024
c86ba97
⚙️ chore: run 하는 docker image 이름 변경
jinddings Nov 5, 2024
97e0847
⚙️ chore: typeORM 설정
uuuo3o Nov 5, 2024
f29a7be
⚙️ chore: DB 연결 설정 수정
sieunie Nov 5, 2024
6855aec
⚙️ chore: 기존 실행중이던 docke 정지 명령 수정
jinddings Nov 5, 2024
a365109
✨ feat: swagger 설정 추가
jinddings Nov 5, 2024
9767a28
⚙️ chore: eslint 규칙 추가
jinddings Nov 6, 2024
dc292f1
⚙️ chore axios install
jinddings Nov 6, 2024
54055bb
⚙️ chore: CI yml 수정
jinddings Nov 6, 2024
f1546bd
⚙️ chore: 의존성 cache path 추가
jinddings Nov 6, 2024
959e10d
✨ feat: module, controller, service, entity, repository 초기 설정 및 의존성 주…
jinddings Nov 6, 2024
8fb0b1f
✨ feat: 회원 가입 레포지토리 구현
jinddings Nov 6, 2024
08f0dec
⚙️ chore: axios 재설치
uuuo3o Nov 6, 2024
d169098
✨ feat: userRepository registerUser 메소드 구현 (#26)
jinddings Nov 6, 2024
643ad3c
Merge branch 'back/main' of https://github.com/boostcampwm-2024/web16…
jinddings Nov 6, 2024
a71bf2c
✨ feat: AuthService 회원가입 로직 구현(#26)
jinddings Nov 6, 2024
92c7549
⚙️ chore: AuthModule을 AppModule에 추가(#26)
jinddings Nov 6, 2024
bf295a6
✨ feat: AuthController 구현 및 AuthService에서 비밀번호 암호화 로직 추가(#26)
jinddings Nov 6, 2024
08312cd
⚙️ chore: merge conflict 해결
sieunie Nov 5, 2024
4390c3c
✨ feat: stock websocket gateway 구현 #6
sieunie Nov 5, 2024
3a777d6
✨ feat: 주가 그래프 웹소켓 구현 #6
sieunie Nov 5, 2024
ad2b3e6
✨ feat: 주가 지수 값 웹소켓 구현 #6
sieunie Nov 5, 2024
5ef98b0
✨ feat: 주가 지수 그래프 및 값 API 구현 #6
sieunie Nov 5, 2024
2796724
📝 docs: 주가 지수 API 명세 추가
sieunie Nov 5, 2024
bad5bb0
⚙️ chore: ws 라이브러리 설치
sieunie Nov 5, 2024
c9a16a1
♻️ refactor: cron 로직 service 단으로 이동
sieunie Nov 5, 2024
7117aac
♻️ refactor: dto 파일 분리
sieunie Nov 6, 2024
c219c6d
✨ feat: 주가 지수 소켓 통신으로 변경
sieunie Nov 6, 2024
335686b
♻️ refactor: return type dto로 변경
sieunie Nov 6, 2024
6aafebe
♻️ refactor: 주가 정보 관련 interface 생성 및 적용 #6
sieunie Nov 6, 2024
226ce86
✨ feat: 가입 요청 유저 정보에 대한 유효성 검사 추가 (#26)
jinddings Nov 6, 2024
60c03e1
🔧 fix: 타입 버그 수정
sieunie Nov 6, 2024
a5d34f5
⚙️ chore: CI.yml 파일 이름 및 내용 수정
jinddings Nov 6, 2024
a86bf21
✨ feat: access_token을 발급받는 로직 구현#12
uuuo3o Nov 6, 2024
414b03c
✨ feat: 오늘의 상/하위 종목 조회에 사용할 DTO 구현#12
uuuo3o Nov 6, 2024
2af0a7d
✨ feat: 한국투자 API 요청 및 결과값을 받아오는 로직 구현#12
uuuo3o Nov 6, 2024
f8c7046
✨ feat: 오늘의 상/하위 종목 리스트 API Controller 구현#12
uuuo3o Nov 6, 2024
ba8e2d6
⚙️ chore: TopFiveModule을 AppModule에 추가#12
uuuo3o Nov 6, 2024
eee8101
⚙️ chore:lint 실행시 발생하는 오류 수정
jinddings Nov 6, 2024
4b1ed0e
Merge branch 'back/main' of https://github.com/boostcampwm-2024/web16…
jinddings Nov 6, 2024
7736420
✨ feat: 상/하위 종목 5개만 반환할 수 있도록 수정#12
uuuo3o Nov 6, 2024
5003ca6
✨ feat: UserRepository loginUser 메소드 구현(#4)
jinddings Nov 6, 2024
e2a14e8
➕ add: module layer 추가 #6
sieunie Nov 6, 2024
93141c4
➕ add: 코스피200, KSQ150 지수 정보 추가 #6
sieunie Nov 6, 2024
9e72aff
⚙️ chore: 린트 오류 해결
sieunie Nov 6, 2024
8b956ed
✨ feat: JWT 토큰을 이용한 로그인 기능 구현(#4)
jinddings Nov 6, 2024
3c1ffcb
💡 comment: Console.error 주석 처리#12
uuuo3o Nov 6, 2024
e4ba28a
✨ feat: AuthGuard 를 이용한 토큰 인증 기능 구현(#4)
jinddings Nov 6, 2024
8b121d1
⚙️ chore: lint,test 에러 발생 수정
jinddings Nov 6, 2024
4375e5f
🔧 fix: 주석처리 했던 코드를 logger로 변경#12
uuuo3o Nov 6, 2024
9887ea6
� docs: 로그인 API 명세 추가
jinddings Nov 6, 2024
83d246a
Merge pull request #30 from boostcampwm-2024/feature/api/topfive-#12
uuuo3o Nov 7, 2024
cc860a5
Merge branch 'back/main' into feature/api/stockindex-#6
sieunie Nov 7, 2024
a190aa7
Merge pull request #32 from boostcampwm-2024/feature/api/stockindex-#6
sieunie Nov 7, 2024
e817f4b
Merge branch 'back/main' into feature/api/register-#26
jinddings Nov 7, 2024
e9f5950
Merge pull request #29 from boostcampwm-2024/feature/api/register-#26
jinddings Nov 7, 2024
81cc0ef
⚙️ chore: merge 오류 해결
sieunie Nov 7, 2024
abbc19b
⚙️ chore: merge 오류 해결
sieunie Nov 7, 2024
5c28839
Merge pull request #33 from boostcampwm-2024/feature/api/login-#4
jinddings Nov 7, 2024
81ce607
⚙️ chore: 디렉토리 파일 정리
sieunie Nov 7, 2024
38d0ed4
⚙️ chore: 환경변수 name 통합 및 stock 디렉토리 통합
sieunie Nov 7, 2024
45c31ae
⚙️ chore: CD를 위해 env 파일 작성하게 수정
jinddings Nov 7, 2024
a4a88af
⚙️ chore: stock index API 엔드포인트 변경
sieunie Nov 7, 2024
2900fcd
Merge branch 'back/main' of https://github.com/boostcampwm-2024/web16…
sieunie Nov 7, 2024
1d7608f
⚙️ chore: github ip를 ag에 추가 및 제거 하는 작업 추가
jinddings Nov 7, 2024
5c1346d
Merge branch 'back/main' of https://github.com/boostcampwm-2024/web16…
jinddings Nov 7, 2024
84bf494
⚙️ chore: 디렉토리 구조 확인
jinddings Nov 7, 2024
43c7bc3
Update deploy.yml
jinddings Nov 7, 2024
a0fbfe9
🔧 fix: Promise.all accessToken 관련 문제 해결
sieunie Nov 7, 2024
27360ea
♻️ refactor: 파일명 수정 및 interface 분리
sieunie Nov 7, 2024
7664122
♻️ refactor: enum 분리
sieunie Nov 7, 2024
97e0e83
⚙️ chore: 환경 변수 전달
jinddings Nov 7, 2024
477db55
⚙️ chore: env 파일 경로 수정
jinddings Nov 7, 2024
47b9277
⚙️ chore: 도커 리소스 정리 및 env 파일 생성
jinddings Nov 7, 2024
d7a1293
⚙️ chore: env 파일 경로 변경
jinddings Nov 7, 2024
275c3ec
🔧 fix: accessToken 발급 로직 통합
sieunie Nov 7, 2024
68eac63
Merge pull request #36 from boostcampwm-2024/feature/api/stockindex-#6
sieunie Nov 7, 2024
87834ba
🔧 fix: socket 관련 로직 수정
sieunie Nov 7, 2024
cf81c6e
♻️ refactor: 필요없는 import 삭제
sieunie Nov 7, 2024
c34f56e
🔧 fix: CORS 에러 수정
uuuo3o Nov 7, 2024
9f3ff1d
Merge pull request #38 from boostcampwm-2024/fix/CORS
jinddings Nov 7, 2024
33c45c7
🔧 fix: login API 메소드 GET -> POST 변경
jinddings Nov 7, 2024
89420d7
🔧 fix: 주가 지수 API response 형식 변경
sieunie Nov 7, 2024
8a36bb1
Merge pull request #37 from boostcampwm-2024/feature/api/stockindex-#6
sieunie Nov 7, 2024
3d36bce
♻️ refactor: fetch API axios로 모두 변경
sieunie Nov 7, 2024
bf91271
♻️ refactor: 환경변수 가지고 오는 방식 변경
uuuo3o Nov 7, 2024
bb3cdbe
♻️ refactor: stock index 관련 API 요청 로직 함수 분리
sieunie Nov 7, 2024
edcb779
♻️ refactor: 공통 함수 분리 및 명확한 이름으로 변경
uuuo3o Nov 7, 2024
379ffe6
💡 comment: service 로직 함수별 주석 추가
uuuo3o Nov 7, 2024
2e10d75
✅ test: 주가 지수 차트 조회 테스트 코드 작성
sieunie Nov 7, 2024
9d8ff33
✅ test: 주가 지수 값 조회 테스트 코드 작성
sieunie Nov 7, 2024
98b875c
Merge pull request #41 from boostcampwm-2024/refactor/api/topfive
uuuo3o Nov 7, 2024
096161f
Merge pull request #42 from boostcampwm-2024/feature/api/stockindex-#6
uuuo3o Nov 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/workflows/CI

This file was deleted.

64 changes: 64 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: [back/main, front/main]
pull_request:
branches: [main, back/main, dev]

jobs:
BE-test-and-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: ./BE/package-lock.json

- name: Install dependencies
working-directory: ./BE
run: npm ci

- name: Run tests
run: npm test
working-directory: ./BE
env:
CI: true

- name: Run linter
working-directory: ./BE
run: npm run lint

- name: Build application
working-directory: ./BE
run: npm run build

FE-test-and-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: ./BE/package-lock.json

- name: Install dependencies
working-directory: ./FE
run: npm ci

- name: Run linter
working-directory: ./FE
run: npm run lint

- name: Build application
working-directory: ./FE
run: npm run build
112 changes: 112 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: deploy

on:
push:
branches: [main, alpha]
pull_request:
branches: [main, alpha]

env:
DOCKER_IMAGE: ${{ vars.DOCKERHUB_USERNAME }}/juga-docker
DOCKER_TAG: ${{ github.sha }}

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: ./BE/package-lock.json

- name: Create .env file
run: |
touch ./BE/.env
echo "${{ secrets.ENV }}" > ./BE/.env

- name: Install dependencies
working-directory: ./BE
run: npm ci

- name: Run tests
working-directory: ./BE
run: npm test
env:
CI: true

- name: Run linter
working-directory: ./BE
run: npm run lint

- name: Build application
working-directory: ./BE
run: npm run build

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

- name: Build and Push Docker Image
working-directory: ./BE
env:
NCP_ACCESS_KEY: ${{ secrets.NCP_ACCESS_KEY }}
NCP_SECRET_KEY: ${{ secrets.NCP_SECRET_KEY }}
run: |
docker build -t ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }} .
docker tag ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }} ${{ env.DOCKER_IMAGE }}:latest

docker push ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }}
docker push ${{ env.DOCKER_IMAGE }}:latest

- name: Get Github Actions IP
id: ip
uses: haythem/[email protected]

- name: Setting NCP CLI & Credentials
run: |
cd ~
wget https://www.ncloud.com/api/support/download/5/65
unzip 65
mkdir ~/.ncloud
echo -e "[DEFAULT]\nncloud_access_key_id = ${{ secrets.NCP_ACCESS_KEY }}\nncloud_secret_access_key = ${{ secrets.NCP_SECRET_KEY }}\nncloud_api_url = ${{ secrets.NCP_API_URI }}" >> ~/.ncloud/configure

- name: Add Github Action Ip to Security group
run: |
cd ~
ls -la
chmod -R 777 ~/cli_linux
cd ~/cli_linux
./ncloud vserver addAccessControlGroupInboundRule --regionCode KR --vpcNo ${{ secrets.NCP_VPC_ID }} --accessControlGroupNo ${{ secrets.NCP_ACG_ID }} --accessControlGroupRuleList "protocolTypeCode='TCP', ipBlock='${{ steps.ip.outputs.ipv4 }}/32', portRange='${{ secrets.SSH_PORT }}'"

- name: Deploy to NCP Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.NCP_SERVER_HOST }}
username: ${{ secrets.NCP_SERVER_USERNAME }}
key: ${{ secrets.NCP_SERVER_SSH_KEY }}
port: 22
script: |
docker system prune -af
echo "${{ secrets.ENV }}" > .env

docker pull ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }}
docker stop juga-docker || true
docker rm juga-docker || true
docker run -d \
--name juga-docker \
-p 3000:3000 \
--env-file .env \
${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }}

- name: Remove Github Action Ip to Security group
run: |
chmod -R 777 ~/cli_linux
cd ~/cli_linux
./ncloud vserver removeAccessControlGroupInboundRule --regionCode KR --vpcNo ${{ secrets.NCP_VPC_ID }} --accessControlGroupNo ${{ secrets.NCP_ACG_ID }} --accessControlGroupRuleList "protocolTypeCode='TCP', ipBlock='${{ steps.ip.outputs.ipv4 }}/32', portRange='${{ secrets.SSH_PORT }}'"
4 changes: 4 additions & 0 deletions BE/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
Dockerfile
node_modules
dist
16 changes: 11 additions & 5 deletions BE/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ module.exports = {
},
ignorePatterns: ['.eslintrc.js', 'dist'],
rules: {
'@typescript-eslint/lines-between-class-members': ['error', 'always', {
exceptAfterSingleLine: true,
}],
'@typescript-eslint/lines-between-class-members': [
'error',
'always',
{
exceptAfterSingleLine: true,
},
],
'@typescript-eslint/no-throw-literal': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-unsafe-argument': 'error',
'import/prefer-default-export': 'off',
'class-methods-use-this': 'off'
'class-methods-use-this': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
},
};
};
8 changes: 8 additions & 0 deletions BE/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:20
RUN mkdir -p /var/app
WORKDIR /var/app
COPY . .
RUN npm install
RUN npm run build
EXPOSE 3000
CMD [ "node", "dist/main.js" ]
Loading
Loading