diff --git a/.github/workflows/deploy_client.yml b/.github/workflows/deploy_client.yml new file mode 100644 index 00000000..e5eef871 --- /dev/null +++ b/.github/workflows/deploy_client.yml @@ -0,0 +1,32 @@ +name: Client Deployment + +on: + push: + branches: + - main + paths: + - "client/**" + workflow_dispatch: # 수동 실행을 허용하는 이벤트 + +jobs: + deployment: + runs-on: ubuntu-latest + steps: + # public 서버로 ssh 접속 + - name: ssh connection + uses: appleboy/ssh-action@v1.1.0 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH_KEY }} + port: ${{ secrets.PORT }} + script: | + export NVM_DIR=~/.nvm + source ~/.nvm/nvm.sh + + cd /var/web05-Denamu + git pull origin main + cd client/ + + npm ci + npm run build \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy_server.yml similarity index 99% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy_server.yml index 266e479e..b5296191 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy_server.yml @@ -1,4 +1,4 @@ -name: Deployment +name: Server Deployment on: push: diff --git a/client/src/api/instance.ts b/client/src/api/instance.ts index 77b3ed81..9c7dc19e 100644 --- a/client/src/api/instance.ts +++ b/client/src/api/instance.ts @@ -6,7 +6,7 @@ export const api = axios.create({ }); export const axiosInstance = axios.create({ - baseURL: "https://api.denamu.site", + baseURL: "https://denamu.site", timeout: 10000, withCredentials: true, }); diff --git a/client/src/components/about/HeroSection.tsx b/client/src/components/about/HeroSection.tsx index 2973f622..de2f6a1c 100644 --- a/client/src/components/about/HeroSection.tsx +++ b/client/src/components/about/HeroSection.tsx @@ -17,7 +17,7 @@ export const HeroSection = () => {
Denamu English Logo @@ -36,7 +36,7 @@ export const HeroSection = () => {
Service Preview diff --git a/client/src/components/common/Card/PostCardContent.tsx b/client/src/components/common/Card/PostCardContent.tsx index a8f429b9..4fa133a3 100644 --- a/client/src/components/common/Card/PostCardContent.tsx +++ b/client/src/components/common/Card/PostCardContent.tsx @@ -11,7 +11,7 @@ interface PostCardContentProps { export const PostCardContent = ({ post }: PostCardContentProps) => { const authorInitial = post.author?.charAt(0)?.toUpperCase() || "?"; - const data = `https://api.denamu.site/files/${post.blogPlatform}-icon.svg`; + const data = `https://denamu.site/files/${post.blogPlatform}-icon.svg`; return (
diff --git a/client/src/hooks/queries/useTrendingPosts.ts b/client/src/hooks/queries/useTrendingPosts.ts index d1a6c0e7..2ca583e8 100644 --- a/client/src/hooks/queries/useTrendingPosts.ts +++ b/client/src/hooks/queries/useTrendingPosts.ts @@ -13,7 +13,7 @@ export const useTrendingPosts = () => { }); useEffect(() => { - const eventSource = new EventSource("https://api.denamu.site/api/feed/trend/sse"); + const eventSource = new EventSource("https://denamu.site/api/feed/trend/sse"); eventSource.onmessage = (event) => { try { diff --git a/client/src/store/useChatStore.ts b/client/src/store/useChatStore.ts index efe8b4d6..ba1319b0 100644 --- a/client/src/store/useChatStore.ts +++ b/client/src/store/useChatStore.ts @@ -3,7 +3,7 @@ import { create } from "zustand"; import { ChatType } from "@/types/chat"; -const CHAT_SERVER_URL = "https://api.denamu.site"; +const CHAT_SERVER_URL = "https://denamu.site"; interface ChatStore { chatHistory: ChatType[]; diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..d109bc5a --- /dev/null +++ b/nginx.conf @@ -0,0 +1,39 @@ +server { + listen 80 default_server; + server_name _; + + # 정적 파일 서빙 - FE 빌드 파일 + location / { + root /var/web05-Denamu/client/dist; + index index.html; # 기본 파일 설정 + try_files $uri /index.html; # SPA 지원 + } + + # 정적 파일 서빙 + location /files { + alias /var/web05-Denamu/static/; + try_files $uri $uri/ =404; # 파일이 없으면 404 반환 + } + + # API 요청을 NestJS로 프록시 + location /api { + proxy_pass http://127.0.0.1:8080; # NestJS 서버 + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } + + # WebSocket 요청 프록시 + location /chat { + proxy_pass http://127.0.0.1:8080; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + } +} \ No newline at end of file diff --git a/server/src/common/email/mail_content.ts b/server/src/common/email/mail_content.ts index 67dcf9d7..41be0335 100644 --- a/server/src/common/email/mail_content.ts +++ b/server/src/common/email/mail_content.ts @@ -10,7 +10,7 @@ export function createMailContent(
- Denamu Logo + Denamu Logo
${