Files
ai-customer-service/guest-cs-stack/_wait_verify.py
T
2026-08-15 14:51:51 +08:00

23 lines
758 B
Python

import os, time
import paramiko
pw = os.environ["DEPLOY_PASSWORD"]
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("20.191.152.26", username="wakka", password=pw, timeout=30)
for i in range(6):
cmd = r"""
sudo docker ps --filter name=guest-chat --format '{{.Status}}'
curl -s -o /dev/null -w 'guest: %{http_code}\n' http://127.0.0.1:7777/guest-customer-service
curl -s 'http://127.0.0.1:7777/cw/widget?website_token=j1UAjqBgZMWQ8WfczgJSymQx' \
-H 'Host: 20.191.152.26:7777' | grep -o 'CABLE_ORIGIN = "[^"]*"' | head -1
sudo docker logs guest-chat --tail 15 2>&1
"""
print(f"=== attempt {i+1} ===")
_, o, _ = c.exec_command(cmd, timeout=60)
print(o.read().decode())
time.sleep(10)
c.close()