feat: serverrun/serverdata 全服务栈(参考 PineSoundServer)
- serverrun/:start-all.sh 一键编排 + start-compute/start-emqx + envcopy/encrypt-certs - 服务编排:core(Dockerfile+compose)、compute-engine(build.sh+compose)、mysql、redis、mqtt(EMQX) - serverdata/:新增 compute-data/compute-logs/mysql-data/redis-data/emqx-data/emqx-log - 全服务仅 loopback 暴露,算力引擎 :3000 经 core 代理
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
# 构建算力引擎镜像(new-api 源码在 code/compute-engine,server-core 的兄弟仓库)
|
||||
set -euo pipefail
|
||||
|
||||
# 本脚本位于 server-core/serverrun/compute-engine/
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# 计算源仓库:server-core/serverrun/compute-engine → ../../.. → code/ → compute-engine
|
||||
SRC_DIR="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
||||
ENGINE_SRC="${ENGINE_SRC:-$SRC_DIR/compute-engine}"
|
||||
TAG="${COMPUTE_ENGINE_TAG:-opc-compute-engine:latest}"
|
||||
|
||||
if [ ! -f "$ENGINE_SRC/Dockerfile" ]; then
|
||||
echo "错误:未找到算力引擎源码 $ENGINE_SRC/Dockerfile" >&2
|
||||
echo "(clone: git clone http://code.infoepoch.cn/Pine/compute-engine.git $ENGINE_SRC)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "构建算力引擎镜像:$TAG(源码 $ENGINE_SRC)..."
|
||||
docker build -t "$TAG" "$ENGINE_SRC"
|
||||
echo "构建完成:$TAG"
|
||||
@@ -0,0 +1,27 @@
|
||||
# 算力调度服务(compute-engine / new-api)编排
|
||||
# 仅服务:OpenAI 兼容 /v1 中继 + 额度/令牌/流水;仅 loopback :3000,不对外暴露。
|
||||
# 镜像:本地构建(build.sh)或 calciumion/new-api:latest。
|
||||
|
||||
services:
|
||||
compute-engine:
|
||||
image: ${COMPUTE_ENGINE_IMAGE:-opc-compute-engine:latest}
|
||||
container_name: opc-compute-engine
|
||||
restart: always
|
||||
command: --log-dir /app/logs
|
||||
ports:
|
||||
- "127.0.0.1:3000:3000" # 仅 loopback,算力服务经内部 IP 调用
|
||||
environment:
|
||||
- SQLITE_PATH=/data/new-api.db # 或 MySQL: SQL_DSN=mysql+asyncmy://...
|
||||
- REDIS_CONN_STRING=redis://:redis_pass@redis:6379/0
|
||||
- SESSION_SECRET=${SESSION_SECRET:?请设置 SESSION_SECRET}
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ../../serverdata/compute-data:/data
|
||||
- ../../serverdata/compute-logs:/app/logs
|
||||
networks:
|
||||
- opc-network
|
||||
|
||||
networks:
|
||||
opc-network:
|
||||
name: opc-network
|
||||
external: true
|
||||
Reference in New Issue
Block a user