Files
TK-FB-Project/api.hyungi.net/deploy.sh
Hyungi Ahn 4ac0605887 refactor: 네비게이션 헤더 최신 디자인으로 전면 개편 및 로그인 버그 수정
- fix: 로그인 API에서 user.role_name 필드 올바르게 사용 (auth.service.js)
- refactor: navbar 컴포넌트를 최신 dashboard-header 스타일로 전환
- refactor: 구버전 work-report-header 제거 (6개 페이지)
- refactor: load-navbar.js를 최신 헤더 구조에 맞게 업데이트
- style: 파란색 그라데이션 헤더, 실시간 시계, 향상된 프로필 메뉴
- docs: 2026-01-20 개발 로그 추가

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

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-20 08:40:19 +09:00

98 lines
3.0 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 색상 정의
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}========================================${NC}"
echo -e "${BLUE} API 서버 배포 스크립트${NC}"
echo -e "${BLUE}========================================${NC}"
echo ""
# 현재 디렉토리 확인
if [ ! -f "package.json" ]; then
echo -e "${RED}❌ 오류: package.json을 찾을 수 없습니다.${NC}"
echo -e "${RED} api.hyungi.net 디렉토리에서 실행해주세요.${NC}"
exit 1
fi
echo -e "${BLUE}📂 현재 디렉토리:${NC} $(pwd)"
echo ""
# 1. Git Pull
echo -e "${YELLOW}1⃣ Git Pull 시작...${NC}"
git pull
if [ $? -ne 0 ]; then
echo -e "${RED}❌ Git Pull 실패${NC}"
exit 1
fi
echo -e "${GREEN}✅ Git Pull 완료${NC}"
echo ""
# 2. NPM Install (package.json 변경 확인)
echo -e "${YELLOW}2⃣ 의존성 확인 중...${NC}"
if git diff HEAD@{1} HEAD --name-only | grep -q "package.json"; then
echo -e "${YELLOW}📦 package.json 변경 감지 - npm install 실행${NC}"
npm install
if [ $? -ne 0 ]; then
echo -e "${RED}❌ npm install 실패${NC}"
exit 1
fi
echo -e "${GREEN}✅ npm install 완료${NC}"
else
echo -e "${GREEN}✅ package.json 변경 없음 - 건너뜀${NC}"
fi
echo ""
# 3. 데이터베이스 마이그레이션
echo -e "${YELLOW}3⃣ 데이터베이스 마이그레이션 시작...${NC}"
echo -e "${YELLOW}⚠️ 주의: 마이그레이션 전 데이터베이스 백업을 권장합니다.${NC}"
echo ""
read -p "마이그레이션을 실행하시겠습니까? (y/n): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
npm run db:migrate
if [ $? -ne 0 ]; then
echo -e "${RED}❌ 마이그레이션 실패${NC}"
echo -e "${YELLOW}💡 롤백이 필요하면 다음 명령어를 실행하세요:${NC}"
echo -e "${YELLOW} npm run db:rollback${NC}"
exit 1
fi
echo -e "${GREEN}✅ 마이그레이션 완료${NC}"
else
echo -e "${YELLOW}⏭️ 마이그레이션 건너뜀${NC}"
fi
echo ""
# 4. PM2 재시작
echo -e "${YELLOW}4⃣ PM2 서버 재시작...${NC}"
if command -v pm2 &> /dev/null; then
pm2 reload ecosystem.config.js --env production
if [ $? -ne 0 ]; then
echo -e "${RED}❌ PM2 reload 실패${NC}"
exit 1
fi
echo -e "${GREEN}✅ PM2 reload 완료${NC}"
echo ""
# PM2 상태 확인
echo -e "${BLUE}📊 PM2 프로세스 상태:${NC}"
pm2 list
else
echo -e "${YELLOW}⚠️ PM2가 설치되지 않았습니다. 수동으로 서버를 재시작해주세요.${NC}"
fi
echo ""
echo -e "${GREEN}========================================${NC}"
echo -e "${GREEN} ✅ 배포 완료!${NC}"
echo -e "${GREEN}========================================${NC}"
echo ""
echo -e "${BLUE}📝 배포 후 확인사항:${NC}"
echo -e " 1. API 서버 응답 확인: curl http://localhost:20005/health"
echo -e " 2. 로그 확인: pm2 logs hyungi-api"
echo -e " 3. 에러 발생 시: pm2 logs hyungi-api --err"
echo ""