# AutonetSellCar Production Values (Single Source of Truth) **이 파일의 값들은 절대 변경하지 마세요!** **DO NOT MODIFY THESE VALUES!** --- ## Server Information | 서버 | IP | 역할 | |------|-----|------| | Server1 | 192.168.0.201 | PostgreSQL Primary | | Server2 | 192.168.0.202 | Production (Frontend + Backend) | | Server3 | 192.168.0.203 | Grantech.kr | | Server4 | 192.168.0.204 | Development | --- ## Database Configuration | 항목 | 값 | 비고 | |------|-----|------| | **DB_NAME** | `autonet` | ~~mongolcar~~ 절대 아님! | | **DB_USER** | `admin` | | | **DB_PASSWORD** | `roskfl@1122` | `@` 포함, URL 인코딩 필요 | | **DB_HOST** | `192.168.0.201` | Server1 | | **DB_PORT** | `5432` | PostgreSQL 기본 포트 | ### Database URL Format ``` postgresql://admin:roskfl%401122@192.168.0.201:5432/autonet ^^^^^^^^ @가 %40으로 인코딩됨 ``` ### config.py에서 quote_plus() 필수 ```python from urllib.parse import quote_plus encoded_password = quote_plus(self.DB_PASSWORD) # roskfl@1122 → roskfl%401122 ``` --- ## Docker Container Configuration ### Backend Container ```bash docker run -d \ --name autonet-backend \ --restart unless-stopped \ -p 8000:8000 \ -e USE_SQLITE=False \ -e DB_HOST=192.168.0.201 \ -e DB_PORT=5432 \ -e DB_NAME=autonet \ -e DB_USER=admin \ -e "DB_PASSWORD=roskfl@1122" \ -v /opt/autonet/production/backend/uploads:/app/uploads \ production-backend ``` **주의사항:** - `DB_NAME=autonet` (절대 mongolcar 아님!) - `-v /opt/autonet/production/backend/uploads:/app/uploads` (절대 `/home/damon/mongolcar/...` 아님!) - `DB_PASSWORD`에 `@` 포함됨 - 따옴표로 감싸기 ### Frontend Container ```bash # 빌드 전 .env.production 확인! echo 'NEXT_PUBLIC_API_URL=https://autonetsellcar.com' > /opt/autonet/production/frontend/.env.production # 빌드 (반드시 --no-cache) docker build --no-cache -t production-frontend . # 실행 docker run -d \ --name autonet-frontend \ --restart unless-stopped \ -p 3000:3000 \ production-frontend ``` **주의사항:** - `NEXT_PUBLIC_API_URL=https://autonetsellcar.com` (절대 `http://192.168.0.202:8000` 아님!) - HTTPS 필수 (Mixed Content 방지) --- ## File Paths | 용도 | 올바른 경로 | 잘못된 경로 | |------|-------------|-------------| | **Uploads** | `/opt/autonet/production/backend/uploads` | `/home/damon/mongolcar/data/uploads` | | **Backend 소스** | `/opt/autonet/production/backend` | - | | **Frontend 소스** | `/opt/autonet/production/frontend` | - | --- ## Environment Variables ### Backend (.env) ```env USE_SQLITE=False DB_HOST=192.168.0.201 DB_PORT=5432 DB_NAME=autonet DB_USER=admin DB_PASSWORD=roskfl@1122 ``` ### Frontend (.env.production) ```env NEXT_PUBLIC_API_URL=https://autonetsellcar.com ``` --- ## Verification Commands ### 1. DB 연결 확인 ```bash ssh server2 "docker exec autonet-backend python -c \"from app.config import get_settings; print('DB_NAME:', get_settings().DB_NAME)\"" # 예상 출력: DB_NAME: autonet ``` ### 2. API 데이터 확인 ```bash curl -s https://autonetsellcar.com/api/hero-banners/ | jq 'length' # 예상 출력: 8 이상 (0이면 문제!) ``` ### 3. 이미지 확인 ```bash curl -I https://autonetsellcar.com/uploads/cars/1/image_0.jpg # 예상 출력: HTTP/2 200 ``` ### 4. Frontend API URL 확인 ```bash ssh server2 "docker exec autonet-frontend grep -o 'autonetsellcar.com' /app/.next/static/chunks/app/**/*.js | head -1" # 예상 출력: autonetsellcar.com (localhost나 192.168.0.202가 아님!) ``` --- ## Quick Reference Card ``` ┌─────────────────────────────────────────────────────────────┐ │ PRODUCTION VALUES │ ├─────────────────────────────────────────────────────────────┤ │ DB_NAME: autonet (NOT mongolcar!) │ │ DB_PASSWORD: roskfl@1122 (@ needs URL encoding) │ │ API_URL: https://autonetsellcar.com (NOT http://...) │ │ UPLOADS: /opt/autonet/production/backend/uploads │ └─────────────────────────────────────────────────────────────┘ ``` --- ## Change History | 날짜 | 변경 내용 | |------|----------| | 2026-01-02 | 문서 최초 생성 (반복 배포 오류 방지 목적) | --- **이 문서의 값과 다르면 무조건 틀린 것입니다!**