Skip to content

Issue/199/redis multi instance #200

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

Open
wants to merge 39 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
2819ce9
add: new tables for lab tf on schema.prisma
aariprom Feb 26, 2025
e3033f4
fix: fixed schema
aariprom Feb 27, 2025
a07d58f
fix: better schema for papers and profs
aariprom Feb 27, 2025
0fafe1f
fix: fixed schema && added: more strict logic for data migration
aariprom Feb 28, 2025
ae55318
fix: fixed some logics and validated datas
aariprom Feb 28, 2025
a83f952
Issue/179/login issue app when cookie (#182)
LarryKwon Mar 3, 2025
d7eaee6
refactor: migration squashed && add: paper_professor_department table
aariprom Mar 6, 2025
763d3d4
fix: revert unnecessary changes
aariprom Mar 6, 2025
03d0e5e
Merge branch 'main' into dev
LarryKwon Mar 20, 2025
0b8c411
Issue/186/api doc (#188)
LarryKwon Apr 15, 2025
4d1fb52
Issue/192/lint formatting monorepo (#193)
LarryKwon Apr 18, 2025
8040760
Merge branch 'release' into dev
LarryKwon Apr 18, 2025
65c263d
resolve conflict error
LarryKwon Apr 18, 2025
a2dfa8f
lint config
LarryKwon Apr 18, 2025
65303c6
lint config
LarryKwon Apr 18, 2025
43b987e
restore the ci script
LarryKwon Apr 18, 2025
04b280b
resolve all lint error
LarryKwon Apr 18, 2025
fcfef50
remove format add lint fix
LarryKwon Apr 18, 2025
dfedc4e
remove format add lint fix
LarryKwon Apr 18, 2025
0667777
add env.example
LarryKwon Apr 18, 2025
a77352c
add build:all script
LarryKwon Apr 18, 2025
1394dca
resolve build error
LarryKwon Apr 18, 2025
2e8a6a6
add docker for webhook
LarryKwon Apr 18, 2025
e5a2f4b
remove docker for webhook, because it doesn't work
LarryKwon Apr 18, 2025
45466d9
move webhook to root
LarryKwon Apr 18, 2025
8d90f77
resolve path error on webhook
LarryKwon Apr 18, 2025
9dcdb25
resolve path error on webhook
LarryKwon Apr 18, 2025
a6aeba6
resolve path error on webhook
LarryKwon Apr 18, 2025
92dd578
resolve path error on webhook
LarryKwon Apr 18, 2025
6dd9b38
feat: complete implement swagger docs and add header based authentica…
LarryKwon Apr 19, 2025
35861e1
fix: resolve dependency issue when build
LarryKwon Apr 19, 2025
8c046ee
fix: resolve quote error
LarryKwon Apr 19, 2025
d54486e
add: move tsx to dependencies
LarryKwon Apr 19, 2025
2fa4438
add: docker-compose redis MQ
LarryKwon Apr 20, 2025
9fe4ad1
Add below
LarryKwon Apr 20, 2025
c78a055
add docker compose file of rabbitmq
LarryKwon Apr 26, 2025
7178df6
add: read env file
LarryKwon Apr 26, 2025
aa4782a
add rabbit mq init sh
LarryKwon Apr 26, 2025
5eb97d3
remove cache from session/info
LarryKwon Apr 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .docker/redis/redis-docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.8'

services:
redis-MQ:
image: redis:7.2-alpine
container_name: redis
ports:
- '6379:6379'
volumes:
- ./redis.conf:/usr/local/etc/redis/redis.conf
- ./redis-data:/data
command: ['redis-server', '/usr/local/etc/redis/redis.conf']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 리뷰 코멘트

  1. 버전: version: '3.8'이 사용되었는데, 이는 Docker Compose v3.x의 버전입니다. 현재 후방 호환성을 위해 더 오래된 버전이 필요할 수 있습니다.

  2. 서비스 이름: redis-MQ라는 서비스 이름은 다소 혼동을 줄 수 있습니다. Redis는 메시지 큐로 사용되지만, 사용자에게 이를 명확히 하기 위해 간단하게 redis로 변경하는 것이 좋습니다.

  3. 컨테이너 이름: container_name: redis는 데이터베이스가 많은 환경에서 네임 충돌을 초래할 가능성이 있습니다. container_name을 고유하게 설정해주는 것이 좋습니다.

  4. 포트 설정: 포트를 노출할 때 보안 고려가 필요합니다. 만약 사용하지 않는 환경이라면 포트를 막는 것이 좋습니다.

  5. 볼륨 경로: ./redis.conf./redis-data는 상대 경로입니다. 이 경로가 정확한지 확인해야 하며, 운영 환경에서 이로 인해 발생할 수 있는 문제가 없는지 검토해야 합니다.

  6. 커맨드: command에 사용된 경로 /usr/local/etc/redis/redis.conf가 컨테이너 내에서 정확한 경로인지 확인이 필요합니다. 만약 잘못되면 Redis가 시작되지 않을 수 있습니다.

  7. Redis 설정 파일: redis.conf에서 추가적인 설정이 필요할 수 있습니다. 예를 들어, 보안과 관련된 설정(비밀번호 설정 등)이 필요할 수 있습니다.

다시 말해, 주요 문제는 서비스 이름과 경로 확인에 있으며, 더욱 안전한 설정을 적용하는 것이 필요합니다.

12 changes: 12 additions & 0 deletions .docker/redis/redis-mq-docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.8'

services:
redis-MQ:
image: redis:7.2-alpine
container_name: redis-mq
ports:
- '6379:6379'
volumes:
- ./redis.conf:/usr/local/etc/redis/redis.conf
- ./redis-data:/data
command: ['redis-server', '/usr/local/etc/redis/redis.conf']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 패치 리뷰

  1. Redis 설정 파일: ./redis.conf 파일이 포함되어 있는 것으로 보이지만, 이 파일의 내용도 확인해야 합니다. 잘못된 설정이 있을 경우 실행 시 문제가 발생할 수 있습니다.

  2. 데이터 보존: ./redis-data 볼륨이 매핑되어 있는 것은 좋지만, 빈 디렉토리일 경우 Redis가 실행 중 데이터가 없거나 구성 잘못으로 인한 에러가 발생할 수 있습니다.

  3. 컨테이너 이름: container_nameredis-MQ로 명시되어 있으나, 일반적으로 컨테이너 이름은 소문자와 하이픈으로 구성하는 것이 좋습니다. redis-mq로 일관성 있게 사용하는 것이 더 바람직합니다.

  4. 포트 매핑: 6379:6379의 포트 매핑은 기본적으로 잘 설정되어 있으나, 다른 프로세스가 이미 해당 포트를 사용하고 있을 경우 충돌이 발생할 수 있습니다. 해당 포트 사용 여부를 사전에 확인하는 것이 좋습니다.

  5. 파일 경로: 상대 경로를 사용하고 있는데, 해당 경로가 존재하지 않거나 권한 문제가 발생하면 애플리케이션이 정상 작동하지 않을 수 있습니다. 실행 전에 파일 경로와 권한을 확인해야 합니다.

  6. 알파인 이미지: alpine 이미지를 사용하여 이미지 크기를 줄이고 성능을 개선하는 것은 긍정적입니다. 단, 필요한 패키지가 누락될 수 있으므로 애플리케이션에서 사용하는 모든 의존성이 잘 작동하는지 확인해야 합니다.

이러한 이유들로 인해 현재 이 코드는 병합되기에 위험 요소가 존재합니다.

4 changes: 3 additions & 1 deletion apps/server/.dockerignore → .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.git
*Dockerfile*
../../node_modules
node_modules
dist
apps/server/volumes
volumes
apps/server/test
28 changes: 14 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:
branches: [main, dev, release]

env:
NODE_VERSION: 18
NODE_VERSION: 20

jobs:
format:
name: Format
lint-fix:
name: Lint-fix
runs-on: ubuntu-latest

steps:
Expand All @@ -21,11 +21,11 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache: 'yarn'
- name: Install dependencies
run: npm ci --force
- name: Check format
run: npm run format:check
run: yarn install
- name: lint Fix
run: yarn run lint:fix

lint:
name: Lint
Expand All @@ -38,11 +38,11 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache: 'yarn'
- name: Install dependencies
run: npm ci --force
run: yarn install
- name: Check lint
run: npm run lint:check
run: yarn run lint:check

build:
name: Build
Expand All @@ -55,12 +55,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache: 'yarn'
- name: Install dependencies
run: npm ci --force
run: yarn install
- name: Copy env file
run: cp ./env/.env.example ./env/.env.local
- name: Generate PrismaClient
run: npm run client:generate
run: yarn run client:generate
- name: Build
run: npm run build
run: yarn run build:all
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ lerna-debug.log*

apps/server/volumes
volumes
.clinic

# redis
.docker/redis/redis-data

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드 수정사항은 몇 가지 문제를 안고 있습니다. 첫째, .docker/redis/redis-data 라인을 추가했으나, 이 경로가 실제로 올바른 경로인지 확인이 필요합니다. 둘째, 수정 후에도 아무 줄도 추가되지 않은 채로 파일 끝에 개행 문자가 없는 상태입니다. 이는 코드의 일관성을 해치고, 특히 여러 플랫폼에서 파일을 사용할 때 문제가 될 수 있습니다. 마지막으로, 주석이 없기 때문에 이 추가 사항의 목적이나 사용 이유를 명확하게 전달하지 못합니다. 간단한 주석을 추가하여 추후 유지보수를 쉽게 할 수 있도록 하는 것이 좋습니다. 이러한 사항들을 해결한 후에야 이 코드를 병합하는 것이 바람직합니다.

5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
yarn lint-staged
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/dist
deployment/**/*.yaml
.github/**/*.yml
**/*.md
12 changes: 11 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,15 @@
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"plugins": ["prettier-plugin-tailwindcss"]
"arrowParens": "always",
"endOfLine": "auto",
"overrides": [
{
"files": ["*.json", ".prettierrc", ".eslintrc", ".stylelintrc"],
"options": {
"trailingComma": "none"
}
}
],
"plugins": []
}
Binary file removed __pycache__/server_webhook.cpython-312.pyc
Binary file not shown.
60 changes: 0 additions & 60 deletions apps/load-test/eslint.config.mjs

This file was deleted.

17 changes: 8 additions & 9 deletions apps/load-test/get-lecture-test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import http from 'k6/http';
import { check, sleep } from 'k6';
import { check, sleep } from 'k6'
import http from 'k6/http'

export const options = {
stages: [
Expand All @@ -11,18 +11,17 @@ export const options = {
http_req_duration: ['p(95)<1000'], // 95%의 요청이 1초 이내에 응답해야 함
http_req_failed: ['rate<0.01'], // 실패율이 1% 미만이어야 함
},
};
}

export default function () {
const url =
'https://api.otl.dev.sparcs.org/api/lectures?year=2024&semester=3&keyword=&type=HSE&department=ALL&level=ALL&order=old_code&order=class_no&limit=300&isFull=True';
const res = http.get(url);
export default function test() {
const url = 'https://api.otl.dev.sparcs.org/api/lectures?year=2024&semester=3&keyword=&type=HSE&department=ALL&level=ALL&order=old_code&order=class_no&limit=300&isFull=True'
const res = http.get(url)

check(res, {
'status is 200': (r) => r.status === 200,
'response time < 500ms': (r) => r.timings.duration < 500,
'is response json': (r) => r.headers['Content-Type'] && r.headers['Content-Type'].includes('application/json'),
});
})

sleep(0.5); // 요청 간격을 0.5초로 설정
sleep(0.5) // 요청 간격을 0.5초로 설정
}
74 changes: 0 additions & 74 deletions apps/load-test/package.json

This file was deleted.

2 changes: 1 addition & 1 deletion apps/load-test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"declaration": true,
Expand Down
12 changes: 0 additions & 12 deletions apps/scholar-sync/env/.env.example

This file was deleted.

60 changes: 0 additions & 60 deletions apps/scholar-sync/eslint.config.mjs

This file was deleted.

Loading