Compare commits
No commits in common. "67a6a3660cbf3660aab8ae747586a58cbce2f32f" and "d82e8419af50c9deafe90e546e9a918d3c7426a1" have entirely different histories.
67a6a3660c
...
d82e8419af
49
.github/workflows/deploy.yml
vendored
49
.github/workflows/deploy.yml
vendored
@ -1,23 +1,3 @@
|
|||||||
# 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:
|
||||||
@ -33,10 +13,9 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup SSH key
|
- name: Setup SSH key
|
||||||
run: |
|
uses: webfactory/ssh-agent@v0.9.0
|
||||||
mkdir -p ~/.ssh
|
with:
|
||||||
echo "${{ secrets.NAS_SSH_KEY_ADMIN }}" > ~/.ssh/id_rsa
|
ssh-private-key: ${{ secrets.NAS_SSH_KEY_ADMIN }}
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
|
|
||||||
- name: Deploy files via SCP
|
- name: Deploy files via SCP
|
||||||
env:
|
env:
|
||||||
@ -44,10 +23,7 @@ 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
|
||||||
@ -56,21 +32,10 @@ jobs:
|
|||||||
PORT: ${{ secrets.NAS_PORT }}
|
PORT: ${{ secrets.NAS_PORT }}
|
||||||
USER: ${{ secrets.NAS_USER }}
|
USER: ${{ secrets.NAS_USER }}
|
||||||
run: |
|
run: |
|
||||||
ssh -o StrictHostKeyChecking=no -o RequestTTY=no -p $PORT $USER@$HOST << 'EOF'
|
ssh -o StrictHostKeyChecking=no -p $PORT $USER@$HOST << 'EOF'
|
||||||
cd ~/robeing-nginx
|
cd ~/robeing-nginx
|
||||||
|
sudo /bin/cp server-nginx-default /etc/nginx/sites-available/default
|
||||||
echo "📋 Applying nginx configuration..."
|
sudo /usr/sbin/nginx -t
|
||||||
sudo -n /usr/bin/cp server-nginx-default /etc/nginx/sites-available/default
|
sudo /bin/systemctl reload nginx
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
10
README.md
10
README.md
@ -7,9 +7,8 @@ Ubuntu 서버용 Nginx 리버스 프록시 배포 저장소입니다.
|
|||||||
```
|
```
|
||||||
nginx-deploy/
|
nginx-deploy/
|
||||||
├── .github/workflows/deploy.yml # GitHub Actions 배포 스크립트
|
├── .github/workflows/deploy.yml # GitHub Actions 배포 스크립트
|
||||||
├── default.conf # Docker nginx 설정 (legacy)
|
├── default.conf # Nginx 설정 파일
|
||||||
├── server-nginx-default # 서버 nginx 설정 파일
|
├── docker-compose.yml # Docker Compose 정의
|
||||||
├── docker-compose.yml # Docker Compose 정의 (cleanup용)
|
|
||||||
└── README.md # 이 파일
|
└── README.md # 이 파일
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -19,7 +18,6 @@ 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 컨테이너 정리** (기존 컨테이너 중지)
|
|
||||||
|
|
||||||
## 서버 설정
|
## 서버 설정
|
||||||
|
|
||||||
@ -40,8 +38,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:8000 (frontend/backend)
|
- `https://ro-being.com/api/` → 192.168.219.45:18000 (frontend/backend)
|
||||||
- `https://ro-being.com/rb10508/` → 192.168.219.45:10508 (test_api)
|
- `https://ro-being.com/rb8001/` → 192.168.219.45:8001 (api_base)
|
||||||
|
|
||||||
## SSL 설정
|
## SSL 설정
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:alpine
|
image: nginx:alpine
|
||||||
|
|||||||
@ -130,16 +130,16 @@ server {
|
|||||||
|
|
||||||
# API endpoints
|
# API endpoints
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://localhost:8000;
|
proxy_pass http://localhost:18000;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
# RB10508 API endpoints
|
# RB8001 API endpoints
|
||||||
location /rb10508/ {
|
location /rb8001/ {
|
||||||
proxy_pass http://localhost:10508/;
|
proxy_pass http://localhost:8001;
|
||||||
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,28 +191,3 @@ 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user