zioinfo-mail/setup_gitea2.py
DESKTOP-TKLFCPR\ython 777e027553 refactor(structure): move app -> workspace/guardia-messenger
Permission denied on git mv, used robocopy instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 23:53:57 +09:00

54 lines
2.2 KiB
Python

"""Gitea 저장소 생성 확인 + push 수행"""
import paramiko, sys, subprocess, os
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):
print(f' [{label}]')
_, o, e = client.exec_command(cmd, timeout=timeout)
out = o.read().decode('utf-8', errors='replace').strip()
if out: print(f' {out[:300]}')
return out
# 현재 Gitea 저장소 목록
run('저장소 목록', """
curl -sf 'http://zio:Zio%40Admin2026%21@localhost:3000/api/v1/repos/search?limit=20' 2>/dev/null | \
python3 -c "import sys,json; [print(r['full_name']) for r in json.load(sys.stdin).get('data',[])]"
""")
# 신규 저장소 생성 (로컬에서 서버로 직접)
NEW_REPOS = [
("guardia-manager", "GUARDiA 통합 관리자 포털"),
("guardia-messenger","GUARDiA Messenger 모바일 앱"),
("guardia-docs", "GUARDiA 프로젝트 문서"),
]
for name, desc in NEW_REPOS:
run(f'create {name}', f"""
curl -sf -X POST 'http://localhost:3000/api/v1/user/repos' \
-H 'Content-Type: application/json' \
-u 'zio:Zio@Admin2026!' \
-d '{{"name":"{name}","description":"{desc}","private":false,"auto_init":false}}' 2>/dev/null | \
python3 -c "import sys,json; d=json.load(sys.stdin); print('created:', d.get('full_name'))" 2>/dev/null || echo 'may exist'
""")
# Nginx 크기 제한 재확인
run('Nginx 크기 제한', "grep client_max_body_size /etc/nginx/nginx.conf | head -3")
client.close()
# 로컬에서 서버로 직접 SSH push 대신 서버에서 clone 방식으로 진행
print('\n[서버에서 직접 push 방식으로 변경]')
# 각 독립 repo 크기 확인
for r in ["zioinfo-web","guardia-itsm","guardia-manager","guardia-messenger","guardia-docs"]:
path = f"C:/GUARDiA/repos/{r}"
if os.path.exists(path):
result = subprocess.run(['git', '-C', path, 'count-objects', '-vH'],
capture_output=True, text=True)
for line in result.stdout.splitlines():
if 'size-pack' in line:
print(f" {r}: {line.strip()}")