feat: Go模块路径迁移 + Docker生产部署适配 + ethend Docker兼容
- 所有Go模块路径从 github.com/yourname/cyrene-ai 迁移到 git.yeij.top/AskaEth/Cyrene - 5个Go Dockerfile添加 GOPROXY=https://goproxy.cn,direct 解决国内构建问题 - ai-core go.mod 添加 pkg/plugins replace 指令 - Caddyfile 简化为 http:// 通配 + handle 保留 /api 前缀 - ethend Dockerfile 适配 (npm install + 仅 COPY package.json) - ethend 新增 RUNNING_IN_DOCKER 环境变量,健康检查改用Docker服务名 - ethend 数据库状态检查支持Docker hostname (postgres/redis/qdrant/minio) - process-manager 新增 CONTAINER_SVC_MAP + Docker模式自动检测 - 统一 docker-compose.dev.db.yml 卷名 (pg_data/redis_data/qdrant_data/minio_data) - docker-compose.yml ethend服务挂载docker.sock + 端口变量化 - 清理 .env 统一后的残留文件与提示信息 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+22
-13
@@ -278,7 +278,7 @@ app.get('/api/dashboard', async (_req, res) => {
|
||||
// 数据库状态(通过 TCP 端口检查 Docker 容器是否在运行)
|
||||
let dbStatus = { checked: false };
|
||||
try {
|
||||
const port5432Alive = await isPortOpen(5432);
|
||||
const port5432Alive = await isPortOpen(5432, IS_DOCKER ? 'postgres' : undefined);
|
||||
dbStatus = { checked: true, postgresAlive: port5432Alive };
|
||||
} catch { /* 忽略 */ }
|
||||
|
||||
@@ -1588,28 +1588,37 @@ app.get('/api/proxy/:id/health', async (req, res) => {
|
||||
// ---- 数据库状态检查 ----
|
||||
import net from 'net';
|
||||
|
||||
function isPortOpen(port) {
|
||||
const IS_DOCKER = process.env.RUNNING_IN_DOCKER === 'true';
|
||||
|
||||
function isPortOpen(port, host) {
|
||||
return new Promise((resolve) => {
|
||||
const sock = new net.Socket();
|
||||
sock.setTimeout(2000);
|
||||
sock.on('connect', () => { sock.destroy(); resolve(true); });
|
||||
sock.on('error', () => { sock.destroy(); resolve(false); });
|
||||
sock.on('timeout', () => { sock.destroy(); resolve(false); });
|
||||
sock.connect(port, '127.0.0.1');
|
||||
sock.connect(port, host || '127.0.0.1');
|
||||
});
|
||||
}
|
||||
|
||||
app.get('/api/database/status', async (_req, res) => {
|
||||
const DB_PORTS = [
|
||||
{ port: 5432, name: 'PostgreSQL' },
|
||||
{ port: 6379, name: 'Redis' },
|
||||
{ port: 6334, name: 'Qdrant gRPC' },
|
||||
{ port: 9000, name: 'MinIO API' },
|
||||
{ port: 4222, name: 'NATS' },
|
||||
];
|
||||
const DB_PORTS = IS_DOCKER
|
||||
? [
|
||||
{ port: 5432, name: 'PostgreSQL', host: 'postgres' },
|
||||
{ port: 6379, name: 'Redis', host: 'redis' },
|
||||
{ port: 6334, name: 'Qdrant gRPC', host: 'qdrant' },
|
||||
{ port: 9000, name: 'MinIO API', host: 'minio' },
|
||||
]
|
||||
: [
|
||||
{ port: 5432, name: 'PostgreSQL' },
|
||||
{ port: 6379, name: 'Redis' },
|
||||
{ port: 6334, name: 'Qdrant gRPC' },
|
||||
{ port: 9000, name: 'MinIO API' },
|
||||
{ port: 4222, name: 'NATS' },
|
||||
];
|
||||
|
||||
const results = await Promise.all(DB_PORTS.map(async ({ port, name }) => {
|
||||
const alive = await isPortOpen(port);
|
||||
const results = await Promise.all(DB_PORTS.map(async ({ port, name, host }) => {
|
||||
const alive = await isPortOpen(port, host);
|
||||
return { port, name, alive };
|
||||
}));
|
||||
|
||||
@@ -1657,7 +1666,7 @@ const DB_PORT = 5432;
|
||||
// GET /api/db/status
|
||||
app.get('/api/db/status', async (_req, res) => {
|
||||
try {
|
||||
const online = await isPortOpen(DB_PORT);
|
||||
const online = await isPortOpen(DB_PORT, IS_DOCKER ? 'postgres' : undefined);
|
||||
res.json({ online, port: DB_PORT, checked_at: new Date().toISOString() });
|
||||
} catch {
|
||||
res.json({ online: false, port: DB_PORT, checked_at: new Date().toISOString() });
|
||||
|
||||
Reference in New Issue
Block a user