Compare commits

..

10 Commits

Author SHA1 Message Date
happybell80
67a6a3660c Add Gitea reverse proxy configuration for git.ro-being.com
Some checks failed
Deploy to Ubuntu Server / deploy (push) Has been cancelled
2025-07-14 00:11:12 +09:00
happybell80
f5ab712ea4 10508/ 2025-07-09 22:46:21 +09:00
happybell80
42ec74c348 feat: test_api 프록시 경로를 rb10508로 변경
- /rb8001/ → /rb10508/로 경로 변경
- 포트 8001 → 10508로 변경
- README.md 프록시 라우팅 정보 업데이트

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 21:10:40 +09:00
happybell80
0f18ab56d1 fix: API 프록시 포트를 8000으로 수정
- /api/ 경로를 localhost:18000 → localhost:8000으로 변경
- frontend 백엔드 실제 포트에 맞춰 nginx 설정 수정
- README.md 프록시 라우팅 정보 업데이트

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 19:54:46 +09:00
happybell80
2bdf37ca7e feat: GitHub Actions 최적화 및 문서화 개선
- webfactory/ssh-agent 제거하고 직접 SSH 키 설정으로 단순화
- 배포 단계별 로그 출력 추가 (이모지 포함)
- 워크플로우 상단에 상세 문서화 주석 추가
- 성공/실패 조건 및 주요 작업 명시

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 19:37:00 +09:00
happybell80
45efd03a93 fix: SSH agent cleanup 경고 해결 및 문서 개선
- SSH setup에 id 추가하여 참조 가능하게 설정
- 조건부 SSH agent cleanup 추가로 경고 제거
- README.md 파일 구조 설명 개선

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 19:34:19 +09:00
happybell80
6ba7e1bf0f chore: Docker Compose version 제거 및 문서 개선
- docker-compose.yml에서 deprecated version 필드 제거
- README.md 배포 플로우 설명 개선
- GitHub Actions 경고 메시지 해결

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 19:32:11 +09:00
happybell80
c9c3d1f3dd fix: cp 명령어 경로를 /usr/bin/cp로 수정 2025-07-09 19:27:40 +09:00
happybell80
985b997199 fix: sudo -n 옵션으로 non-interactive 모드 사용 2025-07-09 19:14:55 +09:00
happybell80
9aa89081ed fix: SSH TTY 옵션 추가로 sudo 문제 해결 2025-07-09 19:13:03 +09:00
4 changed files with 78 additions and 18 deletions

View File

@ -1,3 +1,23 @@
# Ubuntu 서버 nginx 설정 자동 배포 워크플로우
#
# 성공 조건:
# - Ubuntu 서버 SSH 접속 가능
# - admin 사용자 sudo NOPASSWD 설정 완료
# - nginx 서비스 실행 중
#
# 실패 조건:
# - SSH 키 인증 실패
# - sudo 권한 없음
# - nginx 설정 문법 오류
# - 시스템 서비스 오류
#
# 주요 작업:
# 1. SSH 키 설정
# 2. 소스 파일 전송 (~/robeing-nginx)
# 3. nginx 설정 적용 (/etc/nginx/sites-available/default)
# 4. nginx 서비스 reload
# 5. Docker 컨테이너 정리
name: Deploy to Ubuntu Server name: Deploy to Ubuntu Server
on: on:
@ -13,9 +33,10 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup SSH key - name: Setup SSH key
uses: webfactory/ssh-agent@v0.9.0 run: |
with: mkdir -p ~/.ssh
ssh-private-key: ${{ secrets.NAS_SSH_KEY_ADMIN }} echo "${{ secrets.NAS_SSH_KEY_ADMIN }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: Deploy files via SCP - name: Deploy files via SCP
env: env:
@ -23,7 +44,10 @@ jobs:
PORT: ${{ secrets.NAS_PORT }} PORT: ${{ secrets.NAS_PORT }}
USER: ${{ secrets.NAS_USER }} USER: ${{ secrets.NAS_USER }}
run: | run: |
# 기존 배포 파일 정리 및 디렉토리 준비
ssh -o StrictHostKeyChecking=no -p $PORT $USER@$HOST "rm -rf ~/robeing-nginx/* || true; mkdir -p ~/robeing-nginx" ssh -o StrictHostKeyChecking=no -p $PORT $USER@$HOST "rm -rf ~/robeing-nginx/* || true; mkdir -p ~/robeing-nginx"
# 소스 파일 전송 (.git 제외)
tar --exclude='.git' -czf - . | ssh -o StrictHostKeyChecking=no -p $PORT $USER@$HOST "cd ~/robeing-nginx && tar -xzf -" tar --exclude='.git' -czf - . | ssh -o StrictHostKeyChecking=no -p $PORT $USER@$HOST "cd ~/robeing-nginx && tar -xzf -"
- name: Apply nginx config via SSH - name: Apply nginx config via SSH
@ -32,10 +56,21 @@ jobs:
PORT: ${{ secrets.NAS_PORT }} PORT: ${{ secrets.NAS_PORT }}
USER: ${{ secrets.NAS_USER }} USER: ${{ secrets.NAS_USER }}
run: | run: |
ssh -o StrictHostKeyChecking=no -p $PORT $USER@$HOST << 'EOF' ssh -o StrictHostKeyChecking=no -o RequestTTY=no -p $PORT $USER@$HOST << 'EOF'
cd ~/robeing-nginx cd ~/robeing-nginx
sudo /bin/cp server-nginx-default /etc/nginx/sites-available/default
sudo /usr/sbin/nginx -t echo "📋 Applying nginx configuration..."
sudo /bin/systemctl reload nginx sudo -n /usr/bin/cp server-nginx-default /etc/nginx/sites-available/default
echo "🔍 Testing nginx configuration..."
sudo -n /usr/sbin/nginx -t
echo "🔄 Reloading nginx service..."
sudo -n /bin/systemctl reload nginx
echo "🧹 Cleaning up Docker containers..."
docker compose down || true docker compose down || true
echo "✅ Deployment completed successfully!"
EOF EOF

View File

@ -7,8 +7,9 @@ Ubuntu 서버용 Nginx 리버스 프록시 배포 저장소입니다.
``` ```
nginx-deploy/ nginx-deploy/
├── .github/workflows/deploy.yml # GitHub Actions 배포 스크립트 ├── .github/workflows/deploy.yml # GitHub Actions 배포 스크립트
├── default.conf # Nginx 설정 파일 ├── default.conf # Docker nginx 설정 (legacy)
├── docker-compose.yml # Docker Compose 정의 ├── server-nginx-default # 서버 nginx 설정 파일
├── docker-compose.yml # Docker Compose 정의 (cleanup용)
└── README.md # 이 파일 └── README.md # 이 파일
``` ```
@ -18,6 +19,7 @@ nginx-deploy/
2. **GitHub Actions** 자동 실행 2. **GitHub Actions** 자동 실행
3. **파일 전송** (Ubuntu 서버 ~/robeing-nginx) 3. **파일 전송** (Ubuntu 서버 ~/robeing-nginx)
4. **nginx 설정 적용** (서버 nginx 자동 reload) 4. **nginx 설정 적용** (서버 nginx 자동 reload)
5. **Docker 컨테이너 정리** (기존 컨테이너 중지)
## 서버 설정 ## 서버 설정
@ -38,8 +40,8 @@ NAS_SSH_KEY_ADMIN: SSH 개인키
## 프록시 라우팅 ## 프록시 라우팅
- `https://ro-being.com/` → 192.168.219.45:5173 (메인 프론트엔드) - `https://ro-being.com/` → 192.168.219.45:5173 (메인 프론트엔드)
- `https://ro-being.com/api/` → 192.168.219.45:18000 (frontend/backend) - `https://ro-being.com/api/` → 192.168.219.45:8000 (frontend/backend)
- `https://ro-being.com/rb8001/` → 192.168.219.45:8001 (api_base) - `https://ro-being.com/rb10508/` → 192.168.219.45:10508 (test_api)
## SSL 설정 ## SSL 설정

View File

@ -1,5 +1,3 @@
version: "3.8"
services: services:
nginx: nginx:
image: nginx:alpine image: nginx:alpine

View File

@ -130,16 +130,16 @@ server {
# API endpoints # API endpoints
location /api/ { location /api/ {
proxy_pass http://localhost:18000; proxy_pass http://localhost:8000;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
} }
# RB8001 API endpoints # RB10508 API endpoints
location /rb8001/ { location /rb10508/ {
proxy_pass http://localhost:8001; proxy_pass http://localhost:10508/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -191,3 +191,28 @@ server {
} }
# Gitea server configuration
server {
listen 80;
server_name git.ro-being.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name git.ro-being.com;
ssl_certificate /etc/letsencrypt/live/ro-being.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ro-being.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://localhost:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}