29 lines
612 B
Markdown
29 lines
612 B
Markdown
|
|
# FastAPI 메인 서버 (Production)
|
|
|
|
운영 환경 최소 구성: FastAPI + Redis (+ 선택: Nginx TLS proxy)
|
|
|
|
## 배포 예시
|
|
|
|
```bash
|
|
cp .env.prod.example .env.prod
|
|
docker compose -f docker-compose.prod.yml build
|
|
docker compose -f docker-compose.prod.yml up -d --scale fastapi=2
|
|
curl -f https://api.example.com/health
|
|
```
|
|
|
|
## Gunicorn 설정
|
|
|
|
```ini
|
|
workers = 4
|
|
worker_class = "uvicorn.workers.UvicornWorker"
|
|
max_requests = 5000
|
|
max_requests_jitter = 500
|
|
```
|
|
|
|
### 보안 체크리스트
|
|
|
|
* Redis 외부 차단 + `requirepass`
|
|
* `/health` 에는 내부 상태 노출 금지
|
|
* HTTPS termination (Nginx / LB)
|