From 2b8a7cd2dabe84cea55451d8c70bb2a68de1c5a6 Mon Sep 17 00:00:00 2001 From: chucoding Date: Thu, 9 Oct 2025 17:58:27 +0900 Subject: [PATCH 1/2] =?UTF-8?q?chore=20:=20[TSK-41]=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=A0=9D=ED=8A=B8=EB=AA=85=20=EB=B3=80=EA=B2=BD(til-alarm=3D>r?= =?UTF-8?q?ecall-buddy)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/firebase-hosting-merge.yml | 2 +- README.md | 12 +++++------- app/package.json | 2 +- app/public/{til-alram.gif => recall-buddy.gif} | Bin app/src/api/github-api.ts | 2 +- app/src/pages/Onboarding.tsx | 2 +- app/src/pages/Settings.tsx | 2 +- app/vite.config.ts | 2 +- functions/package.json | 2 +- functions/src/github.ts | 2 +- packages/shared/package.json | 2 +- pnpm-lock.yaml | 4 ++-- 12 files changed, 16 insertions(+), 18 deletions(-) rename app/public/{til-alram.gif => recall-buddy.gif} (100%) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index cb6a7dc..2a4c6ce 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -5,7 +5,7 @@ name: Deploy to Firebase Hosting on merge on: push: branches: - - master + - main jobs: build_and_deploy: runs-on: ubuntu-latest diff --git a/README.md b/README.md index 0ac8335..72673f7 100644 --- a/README.md +++ b/README.md @@ -74,18 +74,16 @@ VITE_MESSAGING_SENDER_ID=... VITE_APP_ID=... VITE_MEASUREMENT_ID=... -# Functions 호출 설정 (env:setup 실행 시 자동 추가/보강) -VITE_FIREBASE_PROJECT_ID=til-alarm -VITE_FIREBASE_REGION=us-central1 -VITE_FUNCTIONS_URL_LOCAL=http://localhost:5001/til-alarm/us-central1 -VITE_FUNCTIONS_URL_PROD=https://us-central1-til-alarm.cloudfunctions.net +# Functions 호출 설정 (`pnpm proxy` 실행 시 자동 추가) +VITE_FIREBASE_PROJECT_ID= +VITE_FIREBASE_REGION= +VITE_FUNCTIONS_URL_LOCAL= +VITE_FUNCTIONS_URL_PROD= ``` ### Functions 환경변수 (functions/.env) ```bash -GITHUB_TOKEN=your_github_token_here CLOVA_API_KEY=your_clova_api_key -NCLOUD_API_KEY=your_ncloud_api_key ``` ## 🚀 배포 diff --git a/app/package.json b/app/package.json index 0b66e3f..c4e14a3 100644 --- a/app/package.json +++ b/app/package.json @@ -8,7 +8,7 @@ "build": "tsc && vite build" }, "dependencies": { - "@til-alarm/shared": "workspace:*", + "@recall-buddy/shared": "workspace:*", "axios": "^1.12.2", "firebase": "^10.4.0", "github-markdown-css": "^5.8.1", diff --git a/app/public/til-alram.gif b/app/public/recall-buddy.gif similarity index 100% rename from app/public/til-alram.gif rename to app/public/recall-buddy.gif diff --git a/app/src/api/github-api.ts b/app/src/api/github-api.ts index b340e54..20a9ce1 100644 --- a/app/src/api/github-api.ts +++ b/app/src/api/github-api.ts @@ -1,5 +1,5 @@ import { apiClient } from '../modules/axios'; -import type { Repository } from '@til-alarm/shared'; +import type { Repository } from '@recall-buddy/shared'; interface Commit { sha: string; diff --git a/app/src/pages/Onboarding.tsx b/app/src/pages/Onboarding.tsx index 38c27ca..fe44a67 100644 --- a/app/src/pages/Onboarding.tsx +++ b/app/src/pages/Onboarding.tsx @@ -4,7 +4,7 @@ import { signOut } from 'firebase/auth'; import { useIndexedDB } from 'react-indexed-db-hook'; import { auth, db } from '../firebase'; import { getRepositories, getBranches, Branch } from '../api/github-api'; -import { Repository } from '@til-alarm/shared'; +import { Repository } from '@recall-buddy/shared'; import './Onboarding.css'; interface OnboardingProps { diff --git a/app/src/pages/Settings.tsx b/app/src/pages/Settings.tsx index cb5f5f8..15dc960 100644 --- a/app/src/pages/Settings.tsx +++ b/app/src/pages/Settings.tsx @@ -4,7 +4,7 @@ import { reauthenticateWithPopup } from 'firebase/auth'; import { useIndexedDB } from 'react-indexed-db-hook'; import { auth, db, githubProvider } from '../firebase'; import { getRepositories, getBranches, Branch } from '../api/github-api'; -import { Repository } from '@til-alarm/shared'; +import { Repository } from '@recall-buddy/shared'; import TermsLinks from '../widgets/TermsLinks'; import './Settings.css'; diff --git a/app/vite.config.ts b/app/vite.config.ts index 0d5d66c..86a2115 100644 --- a/app/vite.config.ts +++ b/app/vite.config.ts @@ -38,7 +38,7 @@ export default defineConfig(({ mode }) => { open: true, proxy: { '/api': { - target: functionsUrl || 'http://localhost:5001/til-alarm/us-central1', + target: functionsUrl, changeOrigin: true, secure: false, // 로컬 개발 시 false rewrite: (path) => path.replace(/^\/api/, '') diff --git a/functions/package.json b/functions/package.json index 9a34fa0..2d1c89b 100644 --- a/functions/package.json +++ b/functions/package.json @@ -13,7 +13,7 @@ "deploy:hypercloax": "pnpm build && firebase deploy --only functions:hypercloaxApi,functions:chatCompletions,functions:registerDeviceToken,functions:removeDeviceToken,functions:registerSchedule" }, "dependencies": { - "@til-alarm/shared": "workspace:*", + "@recall-buddy/shared": "workspace:*", "firebase-admin": "^12.0.0", "firebase-functions": "^4.8.0" }, diff --git a/functions/src/github.ts b/functions/src/github.ts index 4f70377..1498a44 100644 --- a/functions/src/github.ts +++ b/functions/src/github.ts @@ -1,7 +1,7 @@ import { onRequest } from 'firebase-functions/v2/https'; import { getAuth } from 'firebase-admin/auth'; import { getFirestore } from 'firebase-admin/firestore'; -import { Repository } from '@til-alarm/shared'; +import { Repository } from '@recall-buddy/shared'; /** * Firebase ID Token 검증 및 사용자 정보 조회 diff --git a/packages/shared/package.json b/packages/shared/package.json index 698df42..fbb17aa 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,5 +1,5 @@ { - "name": "@til-alarm/shared", + "name": "@recall-buddy/shared", "version": "1.0.0", "private": true, "main": "./dist/index.js", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f4bace4..e5521fc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,7 +14,7 @@ importers: app: dependencies: - '@til-alarm/shared': + '@recall-buddy/shared': specifier: workspace:* version: link:../packages/shared axios: @@ -81,7 +81,7 @@ importers: functions: dependencies: - '@til-alarm/shared': + '@recall-buddy/shared': specifier: workspace:* version: link:../packages/shared firebase-admin: From d9f20e8f3218a6e6f42589dad3fbe84e80b2ca97 Mon Sep 17 00:00:00 2001 From: chucoding Date: Thu, 9 Oct 2025 18:13:00 +0900 Subject: [PATCH 2/2] =?UTF-8?q?chore=20:=20[TSK-48]=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=20=EB=B0=B0=ED=8F=AC=20=EB=A6=AC=EC=A0=84=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?(US=20=3D>=20seoul)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 76 +++++++++++++++++++++++++++++++++--- functions/src/github.ts | 10 ++--- functions/src/hyperclovax.ts | 2 +- functions/src/schedule.ts | 3 +- scripts/setup-proxy.js | 6 +-- 5 files changed, 82 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 72673f7..652b7b1 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ VITE_MESSAGING_SENDER_ID=... VITE_APP_ID=... VITE_MEASUREMENT_ID=... -# Functions 호출용 (env:setup가 자동 추가) -VITE_FIREBASE_PROJECT_ID=your-project-id -VITE_FIREBASE_REGION=us-central1 -VITE_FUNCTIONS_URL_LOCAL=http://localhost:5001/your-project-id/us-central1 -VITE_FUNCTIONS_URL_PROD=https://us-central1-your-project-id.cloudfunctions.net +# Functions 호출용 (`pnpm proxy`로 자동 추가) +VITE_FIREBASE_PROJECT_ID= +VITE_FIREBASE_REGION= +VITE_FUNCTIONS_URL_LOCAL= +VITE_FUNCTIONS_URL_PROD= ``` ### 2. 개발 서버 시작 @@ -86,6 +86,72 @@ VITE_FUNCTIONS_URL_PROD= CLOVA_API_KEY=your_clova_api_key ``` +## 🌏 리전 설정 + +이 프로젝트는 기본적으로 **Seoul (asia-northeast3)** 리전에 배포됩니다. + +### 사용 가능한 Firebase Functions 리전 +- `asia-northeast3` - Seoul (서울) ⭐ 기본값 +- `asia-northeast1` - Tokyo (도쿄) +- `us-central1` - Iowa (아이오와) +- `us-west1` - Oregon (오레곤) +- `europe-west1` - Belgium (벨기에) +- [전체 리전 목록](https://firebase.google.com/docs/functions/locations) + +### 리전 변경 방법 + +다른 리전으로 변경하려면 다음 파일들을 수정하세요: + +#### 1. Functions 코드 (모든 함수의 region 옵션 수정) + +**`functions/src/github.ts`** +```typescript +export const getCommits = onRequest( + { cors: true, region: 'your-region' }, // 변경 + async (req, res) => { ... } +); +// getFilename, getMarkdown, getRepositories, getBranches도 동일하게 수정 +``` + +**`functions/src/hyperclovax.ts`** +```typescript +export const chatCompletions = onRequest( + { cors: true, region: 'your-region' }, // 변경 + async (req, res) => { ... } +); +``` + +**`functions/src/schedule.ts`** +```typescript +export const sendDaily8amPush = onSchedule( + { + schedule: '0 23 * * *', + timeZone: 'Asia/Seoul', + region: 'your-region' // 변경 + }, + async () => { ... } +); +``` + +#### 2. Setup 스크립트 (환경변수 자동 생성용) + +**`scripts/setup-proxy.js`** +```javascript +const envVars = { + VITE_FIREBASE_PROJECT_ID: projectId, + VITE_FIREBASE_REGION: 'your-region', // 변경 + VITE_FUNCTIONS_URL_LOCAL: `http://localhost:5001/${projectId}/your-region`, // 변경 + VITE_FUNCTIONS_URL_PROD: `https://your-region-${projectId}.cloudfunctions.net` // 변경 +}; +``` + +#### 3. 환경변수 재생성 + +```bash +# setup 스크립트 재실행하여 app/.env 업데이트 +pnpm env:setup +``` + ## 🚀 배포 ### Functions 개별 배포 diff --git a/functions/src/github.ts b/functions/src/github.ts index 1498a44..99b9687 100644 --- a/functions/src/github.ts +++ b/functions/src/github.ts @@ -60,7 +60,7 @@ async function getUserData(req: any): Promise<{ // GitHub API 호출을 위한 HTTP Functions export const getCommits = onRequest( - { cors: true }, + { cors: true, region: 'asia-northeast3' }, async (req, res) => { try { const { since, until } = req.query; @@ -105,7 +105,7 @@ export const getCommits = onRequest( ); export const getFilename = onRequest( - { cors: true }, + { cors: true, region: 'asia-northeast3' }, async (req, res) => { try { const { commit_sha } = req.query; @@ -149,7 +149,7 @@ export const getFilename = onRequest( ); export const getMarkdown = onRequest( - { cors: true }, + { cors: true, region: 'asia-northeast3' }, async (req, res) => { try { const { filename } = req.query; @@ -198,7 +198,7 @@ export const getMarkdown = onRequest( * Settings 페이지에서 리포지토리 선택을 위해 사용 */ export const getRepositories = onRequest( - { cors: true }, + { cors: true, region: 'asia-northeast3' }, async (req, res) => { try { const authHeader = req.headers.authorization; @@ -266,7 +266,7 @@ export const getRepositories = onRequest( * Settings 페이지에서 브랜치 선택을 위해 사용 */ export const getBranches = onRequest( - { cors: true }, + { cors: true, region: 'asia-northeast3' }, async (req, res) => { try { const { owner, repo } = req.query; diff --git a/functions/src/hyperclovax.ts b/functions/src/hyperclovax.ts index c0c8573..f40e4b3 100644 --- a/functions/src/hyperclovax.ts +++ b/functions/src/hyperclovax.ts @@ -2,7 +2,7 @@ import { onRequest } from 'firebase-functions/v2/https'; // HyperCLOVA X API (HCX-007) export const chatCompletions = onRequest( - { cors: true }, + { cors: true, region: 'asia-northeast3' }, async (req, res) => { try { const { prompt, text } = req.body; diff --git a/functions/src/schedule.ts b/functions/src/schedule.ts index 83c1eeb..5edb8ef 100644 --- a/functions/src/schedule.ts +++ b/functions/src/schedule.ts @@ -5,7 +5,8 @@ import { getMessaging } from 'firebase-admin/messaging'; export const sendDaily8amPush = onSchedule( { schedule: '0 23 * * *', // KST 08:00 = UTC 23:00 (전날) - timeZone: 'Asia/Seoul' + timeZone: 'Asia/Seoul', + region: 'asia-northeast3' }, async () => { try { diff --git a/scripts/setup-proxy.js b/scripts/setup-proxy.js index cc5bf77..570f1a4 100644 --- a/scripts/setup-proxy.js +++ b/scripts/setup-proxy.js @@ -56,9 +56,9 @@ try { // 환경변수 내용 생성 (Functions용) const envVars = { VITE_FIREBASE_PROJECT_ID: projectId, - VITE_FIREBASE_REGION: 'us-central1', - VITE_FUNCTIONS_URL_LOCAL: `http://localhost:5001/${projectId}/us-central1`, - VITE_FUNCTIONS_URL_PROD: `https://us-central1-${projectId}.cloudfunctions.net` + VITE_FIREBASE_REGION: 'asia-northeast3', + VITE_FUNCTIONS_URL_LOCAL: `http://localhost:5001/${projectId}/asia-northeast3`, + VITE_FUNCTIONS_URL_PROD: `https://asia-northeast3-${projectId}.cloudfunctions.net` }; let envFileContent = '';