Files
AutonetSellCar/deploy_ru_server2.sh
AutonetSellCar Deploy 2c99f6a2b1 Add deployment scripts and troubleshooting docs
- deploy_ru_server2.sh: Russian language deployment script for server2
- update_db_ru.py: Database migration for Russian columns
- TROUBLESHOOTING.md: Common issues and solutions

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 18:57:16 +09:00

91 lines
2.9 KiB
Bash

#!/bin/bash
# 서버2에서 러시아어 지원 배포 스크립트
echo "=== 1. DB 컬럼 추가 및 번역 업데이트 ==="
# Docker 컨테이너 내부에서 DB 업데이트
docker exec -i autonet-backend python3 << 'EOF'
import sqlite3
conn = sqlite3.connect("/app/autonet.db")
cursor = conn.cursor()
# 1. 컬럼 추가 (이미 있으면 무시)
try:
cursor.execute("ALTER TABLE hero_banners ADD COLUMN title_ru VARCHAR(100)")
print("Added title_ru column")
except:
print("title_ru column already exists")
try:
cursor.execute("ALTER TABLE hero_banners ADD COLUMN subtitle_ru VARCHAR(200)")
print("Added subtitle_ru column")
except:
print("subtitle_ru column already exists")
conn.commit()
# 2. 러시아어 번역 추가
translations = {
"모하비 더 마스터": ("Mohave The Master", "Мохаве Мастер", "Мохаве Мастер"),
"신형 K5(DL3)": ("New K5 (DL3)", "Шинэ K5 (DL3)", "Новый K5 (DL3)"),
"더 뉴그랜드스타렉스": ("The New Grand Starex", "Шинэ Гранд Старекс", "Новый Гранд Старекс"),
"더 뉴Santa Fe": ("The New Santa Fe", "Шинэ Санта Фе", "Новый Санта Фе"),
"더 뉴 K7": ("The New K7", "Шинэ K7", "Новый K7"),
}
cursor.execute("SELECT id, title_ko FROM hero_banners")
for row in cursor.fetchall():
banner_id, title_ko = row
if title_ko in translations:
en, mn, ru = translations[title_ko]
cursor.execute(
"UPDATE hero_banners SET title_en=?, title_mn=?, title_ru=? WHERE id=?",
(en, mn, ru, banner_id)
)
print(f"Updated banner {banner_id}: {title_ko} -> RU: {ru}")
conn.commit()
# 3. 확인
cursor.execute("SELECT id, title_ko, title_en, title_mn, title_ru FROM hero_banners")
print("\n=== Current Banner Data ===")
for row in cursor.fetchall():
print(row)
print("\nDB Update Done!")
EOF
echo ""
echo "=== 2. Backend 컨테이너 재빌드 ==="
cd /opt/autonet/production
docker stop autonet-backend || true
docker rm autonet-backend || true
docker build -t autonet-backend-prod ./backend
docker run -d --name autonet-backend \
-p 8000:8000 \
-v /opt/autonet/production/backend/uploads:/app/uploads \
-v /opt/autonet/production/backend/autonet.db:/app/autonet.db \
autonet-backend-prod
echo ""
echo "=== 3. Frontend 컨테이너 재빌드 ==="
docker stop autonet-frontend || true
docker rm autonet-frontend || true
docker build -t autonet-frontend-prod \
--build-arg NEXT_PUBLIC_API_URL=http://192.168.0.202:8000 \
./frontend
docker run -d --name autonet-frontend \
-p 3000:3000 \
-e NEXT_PUBLIC_API_URL=http://192.168.0.202:8000 \
autonet-frontend-prod
echo ""
echo "=== 4. 결과 확인 ==="
sleep 5
echo "Testing Russian API..."
curl -s 'http://localhost:8000/api/hero-banners/?lang=ru' | head -200
echo ""
echo "=== 배포 완료 ==="
docker ps