40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
import csv
|
|
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, "/Users/hy/Documents/hy/deploy-platform")
|
|
|
|
from deploy.tencent_tat.hyapp_tat_deploy import build_tat_client, run_tat_shell
|
|
|
|
|
|
with open(
|
|
"/Users/hy/Documents/环境/haiyi腾讯云临时服务器秘钥.csv",
|
|
encoding="utf-8-sig",
|
|
newline="",
|
|
) as handle:
|
|
credential = next(csv.DictReader(handle))
|
|
|
|
os.environ["TENCENTCLOUD_SECRET_ID"] = credential["SecretId"].strip()
|
|
os.environ["TENCENTCLOUD_SECRET_KEY"] = credential["SecretKey"].strip()
|
|
os.environ["TENCENTCLOUD_REGION"] = "me-saudi-arabia"
|
|
|
|
client = build_tat_client({"region": "me-saudi-arabia"})
|
|
script = r'''set -euo pipefail
|
|
hostname
|
|
docker system df
|
|
du -sh /opt/deploy/sources/hyapp-server /var/lib/docker 2>/dev/null || true
|
|
docker images --format '{{.Repository}}:{{.Tag}} {{.ID}} {{.Size}} {{.CreatedSince}}' | grep 'hyapp/admin-server' | head -n 10 || true
|
|
'''
|
|
|
|
result = run_tat_shell(
|
|
client,
|
|
instance_id="ins-ntmpcd3a",
|
|
script=script,
|
|
command_name="codex-admin-server-disk-precheck",
|
|
timeout_seconds=60,
|
|
poll_seconds=2,
|
|
)
|
|
print(result.get("status"))
|
|
print(result.get("output", ""))
|