最初版本
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
"""Diagnose remote 7777 stuck: guest-new + messages API + chatwoot health."""
|
||||
import os
|
||||
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)
|
||||
|
||||
script = r"""
|
||||
set -e
|
||||
echo '=== docker ps ==='
|
||||
sudo docker ps --filter name=guest-chat --format 'table {{.Names}}\t{{.Status}}'
|
||||
|
||||
echo '=== chatwoot rails :3000 ==='
|
||||
curl -s -o /dev/null -w 'rails root: %{http_code}\n' http://127.0.0.1:3000/ 2>/dev/null || echo rails curl failed
|
||||
sudo docker exec guest-chat bash -c 'curl -s -o /dev/null -w "internal rails: %{http_code}\n" http://127.0.0.1:3000/' 2>/dev/null || true
|
||||
|
||||
echo '=== guest-chat/new ==='
|
||||
rm -f /tmp/gc.jar /tmp/g.html
|
||||
curl -s -c /tmp/gc.jar http://127.0.0.1:7777/guest-customer-service -o /tmp/g.html
|
||||
csrf=$(python3 -c "import re; print(re.search(r'\"csrf_token\":\s*\"([^\"]+)\"', open('/tmp/g.html').read()).group(1))")
|
||||
NEW=$(curl -s -b /tmp/gc.jar -X POST http://127.0.0.1:7777/guest-chat/new -H 'Content-Type: application/json' -H "X-CSRF-Token: $csrf" -d '{}')
|
||||
echo "$NEW" | head -c 400
|
||||
echo
|
||||
wt=$(python3 -c "import json,sys; d=json.loads(open('/dev/stdin').read()); print(d.get('widget_token',''))" <<< "$NEW")
|
||||
echo widget_token_len=${#wt}
|
||||
|
||||
echo '=== messages via flask proxy ==='
|
||||
curl -s -o /dev/null -w 'proxy messages: %{http_code}\n' "http://127.0.0.1:7777/api/v1/widget/messages?website_token=j1UAjqBgZMWQ8WfczgJSymQx&cw_conversation=$wt"
|
||||
curl -s "http://127.0.0.1:7777/api/v1/widget/messages?website_token=j1UAjqBgZMWQ8WfczgJSymQx&cw_conversation=$wt" | head -c 500
|
||||
echo
|
||||
|
||||
echo '=== messages direct chatwoot ==='
|
||||
curl -s -o /dev/null -w 'direct messages: %{http_code}\n' "http://127.0.0.1:3000/api/v1/widget/messages?website_token=j1UAjqBgZMWQ8WfczgJSymQx&cw_conversation=$wt" 2>/dev/null || echo direct failed
|
||||
|
||||
echo '=== FRONTEND_URL ==='
|
||||
sudo docker exec guest-chat printenv FRONTEND_URL 2>/dev/null || true
|
||||
sudo docker exec guest-chat printenv CHATWOOT_GUEST_BASE_URL 2>/dev/null || true
|
||||
|
||||
echo '=== recent logs ==='
|
||||
sudo docker logs guest-chat --tail 25 2>&1
|
||||
"""
|
||||
|
||||
_, o, e = c.exec_command(script, timeout=120)
|
||||
print(o.read().decode())
|
||||
err = e.read().decode()
|
||||
if err:
|
||||
print("ERR:", err[:800])
|
||||
c.close()
|
||||
Reference in New Issue
Block a user