32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
import paramiko
|
|
|
|
HOST = "10.10.0.10"
|
|
USER = "localadministrator"
|
|
PASS = "Bbt9115xty9176!"
|
|
APP = "ira4bw4nhbvm87o7s3fgqu6v"
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, username=USER, password=PASS, timeout=20, allow_agent=False, look_for_keys=False)
|
|
|
|
cmds = [
|
|
f"docker exec coolify-db psql -U coolify -d coolify -c "
|
|
f"\"SELECT uuid,status,commit,created_at FROM application_deployment_queues "
|
|
f"WHERE application_id=(SELECT id FROM applications WHERE uuid='{APP}') "
|
|
f"ORDER BY id DESC LIMIT 5;\"",
|
|
f"ls -la /data/coolify/applications/{APP}/ 2>/dev/null | head -20",
|
|
f"find /data/coolify -name '*{APP}*' -type d 2>/dev/null | head -5",
|
|
"docker ps -a --format '{{.Names}} {{.Status}}' | grep -i exposed || true",
|
|
f"TOKEN=$(cat /home/localadministrator/.coolify-token | tail -1); "
|
|
f"curl -sS 'http://127.0.0.1:8000/api/v1/applications/{APP}' -H \"Authorization: Bearer $TOKEN\" | python3 -m json.tool 2>/dev/null | head -60",
|
|
]
|
|
|
|
for cmd in cmds:
|
|
print("$", cmd[:140])
|
|
_, o, e = c.exec_command(cmd, timeout=60)
|
|
out = (o.read() + e.read()).decode(errors="replace")
|
|
print(out[-8000:])
|
|
print()
|
|
|
|
c.close() |