fix(deploy): many docker compose bug

This commit is contained in:
Ran
2026-02-12 08:23:25 +08:00
parent 35ce7d169d
commit 01cb6c85db
16 changed files with 228 additions and 90 deletions
+34 -2
View File
@@ -17,11 +17,43 @@ FROM alpine:latest
WORKDIR /app
RUN apk add --no-cache ca-certificates tzdata wget
RUN apk add --no-cache ca-certificates tzdata wget nerdctl cni-plugins iptables \
&& mkdir -p /opt/cni/bin \
&& (cp -a /usr/lib/cni/. /opt/cni/bin/ 2>/dev/null || true) \
&& (cp -a /usr/libexec/cni/. /opt/cni/bin/ 2>/dev/null || true) \
&& mkdir -p /etc/cni/net.d /var/lib/cni \
&& printf '%s\n' \
'{' \
' "cniVersion": "1.0.0",' \
' "name": "memoh-cni",' \
' "plugins": [' \
' {' \
' "type": "bridge",' \
' "bridge": "cni0",' \
' "isGateway": true,' \
' "ipMasq": true,' \
' "promiscMode": true,' \
' "ipam": {' \
' "type": "host-local",' \
' "ranges": [[' \
' { "subnet": "10.88.0.0/16" }' \
' ]],' \
' "routes": [' \
' { "dst": "0.0.0.0/0" }' \
' ]' \
' }' \
' },' \
' {' \
' "type": "portmap",' \
' "capabilities": { "portMappings": true }' \
' }' \
' ]' \
'}' > /etc/cni/net.d/10-memoh.conflist
COPY --from=builder /build/memoh-server /app/memoh-server
COPY --from=builder /build/spec /app/spec
RUN mkdir -p /var/lib/memoh/data
RUN mkdir -p /opt/memoh/data
EXPOSE 8080
+1 -1
View File
@@ -28,6 +28,6 @@ COPY docker/config/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1
CMD wget --no-verbose --tries=1 --spider http://localhost/health || exit 1
CMD ["nginx", "-g", "daemon off;"]
+5 -4
View File
@@ -4,7 +4,7 @@ level = "info"
format = "text"
[server]
addr = ":8080"
addr = "server:8080"
## Admin
[admin]
@@ -19,13 +19,13 @@ jwt_expires_in = "168h"
## Docker configuration
[containerd]
socket_path = "unix:///var/run/docker.sock"
socket_path = "/run/containerd/containerd.sock"
namespace = "default"
[mcp]
busybox_image = "memoh-mcp:latest"
busybox_image = "docker.io/library/memoh-mcp:latest"
snapshotter = "overlayfs"
data_root = "/var/lib/memoh/data"
data_root = "/opt/memoh/data"
data_mount = "/data"
## Postgres configuration
@@ -48,6 +48,7 @@ timeout_seconds = 10
[agent_gateway]
host = "agent"
port = 8081
server_addr = "server:8080"
[brave]
api_key = ""
+27 -27
View File
@@ -1,5 +1,6 @@
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
index index.html;
@@ -15,40 +16,39 @@ server {
try_files $uri $uri/ /index.html;
}
# API 代理
# Nginx 健康检查
location = /health {
access_log off;
add_header Content-Type text/plain;
return 200 "ok\n";
}
# 统一代理参数
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
# Swagger 文档(保留 /api 前缀)
location ~ ^/api/(docs(?:/.*)?|swagger\.json)$ {
proxy_pass http://memoh-server:8080;
}
# API 代理(其余 /api/* 去掉 /api 前缀转发)
location /api/ {
proxy_pass http://memoh-server:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# 超时设置
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# Agent Gateway 代理
location /agent/ {
proxy_pass http://memoh-agent:8081/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# 超时设置
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
}
# 静态资源缓存