Files

19 lines
1.1 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 重建 cover-ai(8128)容器。
# 授权 KEY 不落明文文件:每次从 CardAuth 库(HEX)读取注入 env。
# 名称:米图设计 | 授权项目 id=10
set -e
KEY=$(ssh -i /root/.ssh/cardauth_vps -o StrictHostKeyChecking=no root@43.163.242.147 \
"docker exec cardauth-db sh -c 'mysql -uroot -p\$MYSQL_ROOT_PASSWORD card_auth -N -e \"SELECT HEX(api_key) FROM ca_projects WHERE id=10;\" 2>/dev/null'" | tail -1)
KEY=$(python3 -c "import sys;print(bytes.fromhex('$KEY').decode())" 2>/dev/null || python3 -c "import sys;print(bytes.fromhex(sys.argv[1]).decode())" "$KEY")
[ -n "$KEY" ] || { echo "读取授权KEY失败"; exit 1; }
docker rm -f cover-ai 2>/dev/null || true
docker run -d --name cover-ai --restart always --memory 384m \
-p 8128:3000 -v /vol1/1000/HD1/docker/cover-ai:/data \
-e PUBLIC_BASE=http://192.168.68.19:8128 \
-e AI_BASE=https://ai.88531.cn/v1 -e AI_MODEL=mimo-v2.6-flash \
-e VERSION=1.0.0 -e HUB_HOST=https://auth.88531.cn \
-e HUB_PROJECT_ID=10 -e HUB_API_KEY="$KEY" \
cover-ai:1.0
echo "cover-ai 已重建(hub keylen=${#KEY})"