zioinfo-mail/scripts/setup/cicd_status.py
DESKTOP-TKLFCPR\ython 28d3ba4836 refactor(cleanup): commit folder reorganization - scripts/, _archive/, docs/ restructure
- Move backend/frontend/messenger/ old paths to _archive/
- Reorganize scripts into scripts/deploy, check, push, setup, misc
- Move docs (pptx, docx) to docs/
- Add .claude agents and skills for fullstack/folder-cleanup harness
- workspace/ projects remain intact

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 19:43:09 +09:00

41 lines
1.6 KiB
Python

"""CI/CD 배포 현황 확인"""
import paramiko, sys, json, time
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('101.79.17.164', username='root', password='1q2w3e!Q', timeout=15)
def run(label, cmd, timeout=30):
_, o, e = client.exec_command(cmd, timeout=timeout)
out = o.read().decode('utf-8', errors='replace').strip()
status = 'active' in out.lower() or 'running' in out.lower()
return out, status
checks = [
('홈페이지 (zioinfo)', 'systemctl is-active zioinfo'),
('GUARDiA ITSM (guardia)', 'systemctl is-active guardia'),
('Manager (guardia-manager)', 'systemctl is-active guardia-manager 2>/dev/null || echo inactive'),
('Gitea', 'systemctl is-active gitea'),
('deploy-webhook', 'systemctl is-active zioinfo-deploy'),
]
print('=== 서비스 상태 ===')
for label, cmd in checks:
out, ok = run(label, cmd)
mark = 'OK' if ok else 'NG'
print(f' [{mark}] {label}: {out}')
# 최근 배포 로그
print('\n=== 최근 배포 로그 (10줄) ===')
_, o, _ = client.exec_command('tail -10 /var/log/zioinfo/deploy.log 2>/dev/null', timeout=10)
print(o.read().decode('utf-8', errors='replace').strip())
# 각 시스템 최신 git 커밋
print('\n=== 서버 코드 현황 ===')
for label, path in [('홈페이지', '/opt/zioinfo/src'), ('ITSM', '/opt/guardia/app')]:
_, o, _ = client.exec_command(f'git -C {path} log --oneline -2 2>/dev/null', timeout=10)
print(f' {label}: {o.read().decode("utf-8", errors="replace").strip()[:80]}')
client.close()