douyinWEB/scripts/_diag_s3_creds2.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 22:42:40 -05:00

55 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
import json
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
REMOTE = r"""
cat /etc/seaweedfs/douyinweb-s3.json
cd /opt/douyinWEB/backend
.venv/bin/python - <<'PY'
import json
import boto3
from botocore.client import Config
from botocore.exceptions import ClientError
with open('/etc/seaweedfs/douyinweb-s3.json') as f:
cfg = json.load(f)
print('seaweed identities:', json.dumps(cfg.get('identities', []), indent=2)[:500])
secrets = [
('api_env', '7a9b4d3c9f12bbe404aa2e506ad8e0a4b2ac'),
('default_cfg', 'douyinweb_s3_2026'),
]
for name, secret in secrets:
client = boto3.client(
's3',
endpoint_url='http://127.0.0.1:8333',
aws_access_key_id='douyin',
aws_secret_access_key=secret,
region_name='us-east-1',
config=Config(signature_version='s3v4', s3={'addressing_style': 'path'}),
)
try:
resp = client.list_objects_v2(Bucket='douyin-covers', Prefix='covers/', MaxKeys=3)
n = len(resp.get('Contents') or [])
print(name, 'OK objects', n)
for it in (resp.get('Contents') or [])[:2]:
print(' ', it['Key'], it['Size'])
except ClientError as e:
print(name, 'FAIL', e.response['Error']['Code'], e.response['Error'].get('Message','')[:80])
PY
"""
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
_i, o, e = c.exec_command(REMOTE, timeout=120)
print(o.read().decode("utf-8", "replace"))
err = e.read().decode("utf-8", "replace").strip()
if err:
print("ERR", err[:2000])
c.close()