diff --git a/.github/workflows/deploy-nest-dev.yml b/.github/workflows/deploy-nest-dev.yml new file mode 100644 index 00000000..59bcaa6a --- /dev/null +++ b/.github/workflows/deploy-nest-dev.yml @@ -0,0 +1,32 @@ +name: Deployment Nestjs server (Dev) + +on: + push: + branches: [development] + +jobs: + build-and-deploy: + name: Build and Deploy to EC2 + runs-on: [self-hosted, nest-dev] + + steps: + - name: Checkout source code + uses: actions/checkout@v3 + - name: install dependencies + run: | + corepack enable + yarn install + + - name: Run Docker Compose + env: + DATABASE_HOST_DEV: ${{ secrets.DATABASE_HOST_DEV }} + DATABASE_USERNAME_DEV: ${{ secrets.DATABASE_USERNAME_DEV }} + DATABASE_PASSWORD_DEV: ${{ secrets.DATABASE_PASSWORD_DEV }} + DATABASE_ROOT_PASSWORD_DEV: ${{ secrets.DATABASE_ROOT_PASSWORD_DEV }} + REDIS_HOST_DEV: ${{ secrets.REDIS_HOST_DEV }} + + run: | + yarn types:build + docker system prune -f + docker compose -f ./compose.server.dev.yaml down || true + docker compose -f ./compose.server.dev.yaml up -d --build diff --git a/.github/workflows/deploy-nest-prod.yml b/.github/workflows/deploy-nest-prod.yml new file mode 100644 index 00000000..b709def4 --- /dev/null +++ b/.github/workflows/deploy-nest-prod.yml @@ -0,0 +1,32 @@ +name: Deployment Nestjs server (Prod) + +on: + push: + branches: [main] + +jobs: + build-and-deploy: + name: Build and Deploy to EC2 + runs-on: [self-hosted, nest-prod] + + steps: + - name: Checkout source code + uses: actions/checkout@v3 + - name: install dependencies + run: | + corepack enable + yarn install + + - name: Run Docker Compose + env: + DATABASE_HOST_PROD: ${{ secrets.DATABASE_HOST_PROD }} + DATABASE_USERNAME_PROD: ${{ secrets.DATABASE_USERNAME_PROD }} + DATABASE_PASSWORD_PROD: ${{ secrets.DATABASE_PASSWORD_PROD }} + DATABASE_ROOT_PASSWORD_PROD: ${{ secrets.DATABASE_ROOT_PASSWORD_PROD }} + REDIS_HOST_PROD: ${{ secrets.REDIS_HOST_PROD }} + + run: | + yarn types:build + docker system prune -f + docker compose -f ./compose.server.prod.yaml down || true + docker compose -f ./compose.server.prod.yaml up -d --build diff --git a/.github/workflows/pr-review.yml b/.github/workflows/pr-review.yml new file mode 100644 index 00000000..5e0073e9 --- /dev/null +++ b/.github/workflows/pr-review.yml @@ -0,0 +1,41 @@ +name: Claude PR Review +on: + pull_request: + types: [opened, synchronize] + branches: [development] + +jobs: + review: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + track_progress: true + prompt: | + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} + + Please review this pull request with a focus on: + - Code quality and best practices + - Potential bugs or issues + - Security implications + - Performance considerations + + NOTE: The PR branch is already checked out in the current working directory. + NOTE: write your review in Korean. + + Use `gh pr comment` for top-level feedback. + Use `mcp__github_inline_comment__create_inline_comment` to highlight specific code issues. + Only post GitHub comments - don't submit review text as messages. + + claude_args: | + --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" diff --git a/apps/kokomen-native/src/screens/interviews/interviewMain.tsx b/apps/kokomen-native/src/screens/interviews/interviewMain.tsx index 3968ac03..b5a09902 100644 --- a/apps/kokomen-native/src/screens/interviews/interviewMain.tsx +++ b/apps/kokomen-native/src/screens/interviews/interviewMain.tsx @@ -111,6 +111,7 @@ export default function InterviewMainScreen() { source={{ uri: `${process.env.EXPO_PUBLIC_CLIENT_URL}/interviews`, }} + userAgent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36" javaScriptEnabled={true} originWhitelist={["*"]} injectedJavaScriptBeforeContentLoaded={runFirst} diff --git a/apps/kokomen-native/src/screens/my/dashboard.tsx b/apps/kokomen-native/src/screens/my/dashboard.tsx index 38842977..39a8f849 100644 --- a/apps/kokomen-native/src/screens/my/dashboard.tsx +++ b/apps/kokomen-native/src/screens/my/dashboard.tsx @@ -27,6 +27,7 @@ export default function DashboardScreen() { { + useFactory: (): Redis => { const redis = new Redis({ - host: configService.get("REDIS_HOST", "127.0.0.1"), - port: configService.get("REDIS_PORT", 6379), - password: configService.get("REDIS_PASSWORD", ""), + host: process.env.REDIS_HOST, + port: process.env.REDIS_PORT + ? parseInt(process.env.REDIS_PORT, 10) + : 6379, + password: process.env.REDIS_PASSWORD || "", enableReadyCheck: false, lazyConnect: false, @@ -45,7 +46,7 @@ import Redis from "ioredis"; return redis; }, - inject: [ConfigService] + inject: [] } ], exports: ["REDIS_CLIENT"] diff --git a/compose.server.dev.yaml b/compose.server.dev.yaml new file mode 100644 index 00000000..0f9d6dd0 --- /dev/null +++ b/compose.server.dev.yaml @@ -0,0 +1,36 @@ +services: + kokomen-nest-server-dev: + build: + context: . + dockerfile: ./apps/kokomen-server/Dockerfile + environment: + TZ: Asia/Seoul + NODE_ENV: development + DATABASE_HOST: ${DATABASE_HOST_DEV} + DATABASE_PORT: 3306 + DATABASE_USERNAME: ${DATABASE_USERNAME_DEV} + DATABASE_PASSWORD: ${DATABASE_PASSWORD_DEV} + DATABASE_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD_DEV} + DATABASE_DATABASE: kokomen-dev + REDIS_HOST: ${REDIS_HOST_DEV} + REDIS_PORT: 6379 + PORT: 3000 + container_name: kokomen-nest-server-dev + restart: on-failure:3 + ports: + - "3000:3000" + - "3001:3001" + + nginx: + image: nginx:alpine + container_name: kokomen-nest-nginx-dev + ports: + - "80:80" + - "443:443" + volumes: + - ./apps/kokomen-server/nginx/dev/nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - kokomen-nest-server-dev + restart: unless-stopped + environment: + TZ: Asia/Seoul diff --git a/compose.server.local.yaml b/compose.server.local.yaml new file mode 100644 index 00000000..5d02e0fa --- /dev/null +++ b/compose.server.local.yaml @@ -0,0 +1,54 @@ +services: + kokomen-nest-server-dev: + build: + context: . + dockerfile: ./apps/kokomen-server/Dockerfile + args: + TZ: Asia/Seoul + NODE_ENV: development + DATABASE_HOST: kokomen-interview-local-mysql + DATABASE_PORT: 3306 + DATABASE_USERNAME: kokomen + DATABASE_PASSWORD: kokomen + DATABASE_ROOT_PASSWORD: root + DATABASE_DATABASE: kokomen-local + REDIS_HOST: kokomen-local-redis + REDIS_PORT: 6379 + PORT: 3000 + container_name: kokomen-nest-server-dev + restart: on-failure:3 + ports: + - "3000:3000" + - "3001:3001" + environment: + NODE_ENV: development + DATABASE_HOST: kokomen-interview-local-mysql + DATABASE_PORT: 3306 + DATABASE_USERNAME: root + DATABASE_PASSWORD: root + DATABASE_DATABASE: kokomen-local + REDIS_HOST: kokomen-local-redis + REDIS_PORT: 6379 + PORT: 3000 + networks: + - kokomen-network + + nginx: + image: nginx:alpine + container_name: kokomen-nest-nginx-dev + ports: + - "80:80" + - "443:443" + volumes: + - ./apps/kokomen-server/nginx/dev/nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - kokomen-nest-server-dev + restart: unless-stopped + environment: + TZ: Asia/Seoul + networks: + - kokomen-network +networks: + kokomen-network: + external: true + name: local-kokomen-net diff --git a/compose.server.prod.yaml b/compose.server.prod.yaml new file mode 100644 index 00000000..cd6c61a7 --- /dev/null +++ b/compose.server.prod.yaml @@ -0,0 +1,36 @@ +services: + kokomen-nest-server-prod: + build: + context: . + dockerfile: ./apps/kokomen-server/Dockerfile + container_name: kokomen-nest-server-dev + ports: + - "3000:3000" + - "3001:3001" + environment: + TZ: Asia/Seoul + NODE_ENV: development + DATABASE_HOST: ${DATABASE_HOST_PROD} + DATABASE_PORT: 3306 + DATABASE_USERNAME: ${DATABASE_USERNAME_PROD} + DATABASE_PASSWORD: ${DATABASE_PASSWORD_PROD} + DATABASE_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD_PROD} + DATABASE_DATABASE: kokomen + REDIS_HOST: ${REDIS_HOST_PROD} + REDIS_PORT: 6379 + PORT: 3000 + restart: on-failure:3 + + nginx: + image: nginx:alpine + container_name: kokomen-nest-nginx-dev + ports: + - "80:80" + - "443:443" + volumes: + - ./apps/kokomen-server/nginx/prod/nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - kokomen-nest-server-dev + restart: unless-stopped + environment: + TZ: Asia/Seoul diff --git a/package.json b/package.json index 1f8e7e57..d0565f07 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,12 @@ "typescript": "^5.8.3" }, "scripts": { + "client": "yarn workspace @kokomen/client", "client:dev": "yarn workspace @kokomen/client dev", "client:test": "yarn workspace @kokomen/client test", "server:dev": "yarn workspace @kokomen/server dev", + "server:build": "yarn workspace @kokomen/server build", + "server:start": "yarn workspace @kokomen/server start", "webview:dev": "yarn workspace @kokomen/webview dev", "webview:build": "yarn workspace @kokomen/webview build", "webview:test": "yarn workspace @kokomen/webview test",