"""deploy_server.py git pull URL 수정 (@ → %40, ! → %21)""" import paramiko, sys 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'\n[{label}]') _, o, e = client.exec_command(cmd, timeout=timeout) out = o.read().decode('utf-8', 'replace').strip() if out: print(out[:600]) return out # 현재 deploy_server.py에서 Gitea URL 패턴 확인 run('현재 URL 패턴', "grep -n 'localhost:3000\|gitea\|git pull\|git clone' /opt/zioinfo/deploy_server.py | head -20") # URL 수정: localhost:3000 → 127.0.0.1:9003, @Admin → %40Admin, ! → %21 run('URL 수정', r""" sed -i \ 's|http://localhost:3000/|http://127.0.0.1:9003/|g' \ /opt/zioinfo/deploy_server.py sed -i \ 's|http://zio:Zio@Admin2026!@|http://zio:Zio%40Admin2026%21@|g' \ /opt/zioinfo/deploy_server.py sed -i \ 's|zio:Zio@Admin2026!@127.0.0.1|zio:Zio%40Admin2026%21@127.0.0.1|g' \ /opt/zioinfo/deploy_server.py echo "수정 완료" """) # 수정 결과 확인 run('수정 후 URL 패턴', "grep -n 'gitea\|git pull\|git clone\|9003\|3000' /opt/zioinfo/deploy_server.py | head -20") # 서비스 재시작 run('서비스 재시작', 'systemctl restart zioinfo-deploy && sleep 2 && systemctl is-active zioinfo-deploy') # 테스트: guardia-itsm 배포 트리거 run('배포 트리거 테스트', """ curl -sf -X POST http://localhost:9999 \ -H 'Content-Type: application/json' \ -H 'X-Gitea-Event: push' \ -d '{"repository":{"name":"guardia-itsm"},"ref":"refs/heads/main"}' \ 2>/dev/null && echo "queued" """) import time time.sleep(5) run('배포 로그 확인', 'tail -15 /var/log/zioinfo/deploy.log 2>/dev/null') client.close() print('\n=== URL 수정 완료 ===')