-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
145 lines (139 loc) · 5.76 KB
/
Copy pathdocker-compose.yml
File metadata and controls
145 lines (139 loc) · 5.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# =============================================================================
# Negentropy Docker Compose — 一键启动全套服务
# =============================================================================
# Usage:
# docker compose up -d 启动所有服务
# docker compose logs -f 查看日志
# docker compose ps 查看服务状态
# docker compose down 停止所有服务
# docker compose down -v 停止并清除数据卷
#
# 前置条件:
# 1. 复制 .env.docker 为 .env.docker.local 并填写 API 密钥
# (.local 已被 .gitignore 忽略,经 env_file 叠加加载并覆盖 .env.docker 同名项)
# 2. Docker Engine >= 24.0 且 Docker Compose >= 2.24(env_file required 语法要求)
# =============================================================================
services:
# ── PostgreSQL + pgvector ──────────────────────────────────────────────────
postgres:
image: pgvector/pgvector:pg17
container_name: negentropy-postgres
environment:
POSTGRES_USER: aigc
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: negentropy
ports:
# 主机端口可经 NE_POSTGRES_HOST_PORT 覆盖(默认 5432,规避本机 PG 或同端口容器冲突);
# 容器间通信仍走 service 名 postgres:5432,backend 的 NE_DB_URL 无需改动。
# 注意:本变量为 Compose 插值变量,须设于 shell 环境或根目录 .env(非 .env.docker*)。
- "${NE_POSTGRES_HOST_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/postgres/init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U aigc -d negentropy"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
restart: unless-stopped
# ── Perceives — MCP Server(Web/PDF 内容提取) ─────────────────────────────
perceives:
image: threefishai/negentropy-perceives:${NEGENTROPY_IMAGE_TAG:-latest}
build:
context: .
dockerfile: docker/perceives/Dockerfile
container_name: negentropy-perceives
ports:
- "2992:2992"
environment:
NEGENTROPY_PERCEIVES_HTTP_HOST: "0.0.0.0"
NEGENTROPY_PERCEIVES_HTTP_PORT: "2992"
env_file:
- path: .env.docker
required: false
- path: .env.docker.local
required: false
healthcheck:
# FastMCP 无根路由(GET / 返回 404),以 MCP 端点 /mcp 的状态码探活:
# GET 缺 MCP Accept 头时返回 406,即可证明 ASGI 服务已就绪
test: ["CMD-SHELL", "case $(curl -s -o /dev/null -w '%{http_code}' http://localhost:2992/mcp) in 200|307|405|406) exit 0;; *) exit 1;; esac"]
interval: 10s
timeout: 5s
retries: 30
start_period: 30s
restart: unless-stopped
# ── Backend — Google ADK Web Server(核心 Agent 平台) ──────────────────────
backend:
image: threefishai/negentropy-backend:${NEGENTROPY_IMAGE_TAG:-latest}
build:
context: .
dockerfile: docker/backend/Dockerfile
container_name: negentropy-backend
ports:
- "3292:3292"
environment:
# Docker 内部网络:postgres 服务名替代 localhost
NE_DB_URL: "postgresql+asyncpg://aigc:@postgres:5432/negentropy"
# SSO 回调地址保持 localhost(浏览器端访问)
NE_AUTH_GOOGLE_REDIRECT_URI: "http://localhost:3292/auth/google/callback"
env_file:
- path: .env.docker
required: false
- path: .env.docker.local
required: false
depends_on:
postgres:
condition: service_healthy
perceives:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:3292/"]
interval: 10s
timeout: 5s
retries: 30
start_period: 60s
restart: unless-stopped
# ── UI — Next.js 主聊天前端 ────────────────────────────────────────────────
ui:
image: threefishai/negentropy-ui:${NEGENTROPY_IMAGE_TAG:-latest}
build:
context: .
dockerfile: docker/frontend/Dockerfile
args:
TARGET_SERVICE: negentropy-ui
container_name: negentropy-ui
ports:
- "3192:3192"
environment:
# 服务端 BFF 代理目标(Docker 内部网络)
AGUI_BASE_URL: "http://backend:3292"
# 容器绑定到所有接口(healthcheck 需要)
PORT: "3192"
HOSTNAME: "0.0.0.0"
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:3192/"]
interval: 15s
timeout: 5s
retries: 10
start_period: 30s
restart: unless-stopped
# ── Wiki — 纯静态知识库站点(独立部署,零后端/DB 依赖)─────────────────────
wiki:
image: threefishai/negentropy-wiki:${NEGENTROPY_IMAGE_TAG:-latest}
build:
context: .
dockerfile: docker/wiki/Dockerfile
container_name: negentropy-wiki
ports:
- "3092:80"
# 内容来自镜像内烘焙的静态产物(content/ 由主站 publish 经 CI 提交);
# 纯静态托管,无运行时 API/DB 依赖,故不 depends_on backend/ui。
restart: unless-stopped
# ── 持久化数据卷 ────────────────────────────────────────────────────────────
volumes:
postgres_data: