c61f10560f
- Express.js 기반 관리자 페이지 (사이트/크롤링/AdSense/도메인 관리) - PostgreSQL 16 + Docker Compose (Traefik 연동) - 크롤러: axios + cheerio 기반 HTML 파싱 - 스케줄러: node-cron 기반 자동 크롤링 - 공개 사이트: slug/도메인 기반 DB에서 렌더링 HTML 서빙 - 도메인: admin.startover.co.kr Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
68 lines
2.3 KiB
PowerShell
68 lines
2.3 KiB
PowerShell
# ==========================================
|
|
# Crawl Manager 서버 배포 스크립트 (PowerShell)
|
|
# ==========================================
|
|
# 사용법: .\deploy.ps1
|
|
# 또는: .\deploy.ps1 -ServerHost "1.2.3.4" -ServerUser "root"
|
|
# ==========================================
|
|
|
|
param(
|
|
[string]$ServerUser = "root",
|
|
[string]$ServerHost = "your-server-ip",
|
|
[int]$ServerPort = 22,
|
|
[string]$RemoteDir = "/home/crawl-manager"
|
|
)
|
|
|
|
$ProjectDir = $PSScriptRoot
|
|
|
|
Write-Host ""
|
|
Write-Host "==========================================" -ForegroundColor Cyan
|
|
Write-Host " Crawl Manager 배포 시작" -ForegroundColor Cyan
|
|
Write-Host "==========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# 1. 서버 디렉토리 생성
|
|
Write-Host "[1/4] 서버 디렉토리 준비..." -ForegroundColor Yellow
|
|
ssh -p $ServerPort "$ServerUser@$ServerHost" "mkdir -p $RemoteDir/postgres_data $RemoteDir/app_data"
|
|
|
|
# 2. 파일 전송
|
|
Write-Host "[2/4] 파일 전송 중..." -ForegroundColor Yellow
|
|
$filesToCopy = @(
|
|
"src", "views", "public"
|
|
)
|
|
$singleFiles = @(
|
|
"package.json", "Dockerfile", "docker-compose.yml",
|
|
".env.production", ".dockerignore"
|
|
)
|
|
|
|
foreach ($dir in $filesToCopy) {
|
|
Write-Host " - $dir/" -ForegroundColor Gray
|
|
scp -P $ServerPort -r "$ProjectDir/$dir" "$ServerUser@${ServerHost}:$RemoteDir/"
|
|
}
|
|
|
|
foreach ($file in $singleFiles) {
|
|
$filePath = "$ProjectDir/$file"
|
|
if (Test-Path $filePath) {
|
|
Write-Host " - $file" -ForegroundColor Gray
|
|
scp -P $ServerPort "$filePath" "$ServerUser@${ServerHost}:$RemoteDir/"
|
|
}
|
|
}
|
|
|
|
# 3. Docker 빌드 & 실행
|
|
Write-Host "[3/4] Docker 빌드 및 실행..." -ForegroundColor Yellow
|
|
ssh -p $ServerPort "$ServerUser@$ServerHost" @"
|
|
cd $RemoteDir
|
|
docker compose down
|
|
docker compose build --no-cache
|
|
docker compose up -d
|
|
"@
|
|
|
|
# 4. 상태 확인
|
|
Write-Host "[4/4] 상태 확인..." -ForegroundColor Yellow
|
|
ssh -p $ServerPort "$ServerUser@$ServerHost" "cd $RemoteDir && docker compose ps && echo '' && docker compose logs --tail=20 crawl-manager"
|
|
|
|
Write-Host ""
|
|
Write-Host "==========================================" -ForegroundColor Green
|
|
Write-Host " 배포 완료!" -ForegroundColor Green
|
|
Write-Host " 관리자: https://admin.startover.co.kr/admin" -ForegroundColor Green
|
|
Write-Host "==========================================" -ForegroundColor Green
|