MOF, Dash và MCP trong một Pod.
Linux amd64 · kubectl · PostgreSQL bên ngoài · 1 Pod · 3 container
Mạng riêng · cần quyền CREATEDB · chưa hỗ trợ PostgreSQL chỉ chấp nhận TLS.
Nguồn image
Tải xuống mof.yaml
Docker Hub · MOF v2.0.15 · Dash v2.0.17 · MCP v2.0.3
Tải xuống mof.yaml ↓Xem tệp
# MOF v2.0.15 + Dash v2.0.17 + MCP v2.0.3
# Edit database address, user and password before applying. Keep this file private.
# Keep the Service names mof, mof-mcp and dash, all in one namespace: the components find each
# other by them (mof:8080, mof-mcp:8001). Renamed Services can't connect.
# Private-network PostgreSQL without TLS. TLS-only databases are not supported by this release.
apiVersion: v1
kind: Namespace
metadata:
name: mof
---
apiVersion: v1
kind: Secret
metadata:
name: mof-database
namespace: mof
type: Opaque
stringData:
password: "REPLACE_WITH_YOUR_DATABASE_PASSWORD"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mof-config
namespace: mof
data:
RK_POSTGRES_0_ADDR: "db.example.com:5432"
RK_POSTGRES_0_USER: "mof"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mof
namespace: mof
spec:
replicas: 1
# First-release template: stop the old Pod before starting the new version.
strategy:
type: Recreate
selector:
matchLabels:
app: mof
template:
metadata:
labels:
app: mof
# Prometheus discovery by annotation; see the monitoring guide for a PodMonitor
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
prometheus.io/path: /internal/v1/mof/metrics
spec:
enableServiceLinks: false
nodeSelector:
kubernetes.io/arch: amd64
terminationGracePeriodSeconds: 120
containers:
- name: mof
image: mofcloud/mof:v2.0.15
envFrom:
- configMapRef:
name: mof-config
env:
- name: RK_POSTGRES_0_PASS
valueFrom:
secretKeyRef:
name: mof-database
key: password
ports:
- name: api
containerPort: 8080
startupProbe:
httpGet:
path: /v1/mof/site-info
port: api
periodSeconds: 10
failureThreshold: 60
readinessProbe:
httpGet:
path: /v1/mof/site-info
port: api
periodSeconds: 10
timeoutSeconds: 5
resources:
requests:
cpu: "500m"
memory: "1Gi"
volumeMounts:
- name: offer-cache
mountPath: /usr/src/mof/offer-cache
volumes:
- name: offer-cache
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: mof
namespace: mof
spec:
selector:
app: mof
ports:
- name: api
port: 8080
targetPort: api
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mof-mcp
namespace: mof
spec:
replicas: 1
selector:
matchLabels:
app: mof-mcp
template:
metadata:
labels:
app: mof-mcp
spec:
enableServiceLinks: false
nodeSelector:
kubernetes.io/arch: amd64
containers:
- name: mof-mcp
image: mofcloud/mof-mcp:v2.0.3
ports:
- name: mcp
containerPort: 8001
readinessProbe:
exec:
command: ["node", "/app/build/healthcheck.js"]
periodSeconds: 10
timeoutSeconds: 5
resources:
requests:
cpu: "100m"
memory: "128Mi"
---
apiVersion: v1
kind: Service
metadata:
name: mof-mcp
namespace: mof
spec:
selector:
app: mof-mcp
ports:
- name: mcp
port: 8001
targetPort: mcp
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dash
namespace: mof
spec:
replicas: 1
selector:
matchLabels:
app: dash
template:
metadata:
labels:
app: dash
spec:
enableServiceLinks: false
nodeSelector:
kubernetes.io/arch: amd64
containers:
- name: dash
image: mofcloud/dash:v2.0.17
ports:
- name: web
containerPort: 80
readinessProbe:
httpGet:
path: /
port: web
periodSeconds: 10
resources:
requests:
cpu: "100m"
memory: "64Mi"
---
apiVersion: v1
kind: Service
metadata:
name: dash
namespace: mof
spec:
selector:
app: dash
ports:
- name: web
port: 80
targetPort: web
type: ClusterIP
Alibaba Cloud ACR · MOF v2.0.15 · Dash v2.0.17 · MCP v2.0.3
Tải xuống mof.yaml ↓Xem tệp
# MOF v2.0.15 + Dash v2.0.17 + MCP v2.0.3
# Edit database address, user and password before applying. Keep this file private.
# Keep the Service names mof, mof-mcp and dash, all in one namespace: the components find each
# other by them (mof:8080, mof-mcp:8001). Renamed Services can't connect.
# Private-network PostgreSQL without TLS. TLS-only databases are not supported by this release.
apiVersion: v1
kind: Namespace
metadata:
name: mof
---
apiVersion: v1
kind: Secret
metadata:
name: mof-database
namespace: mof
type: Opaque
stringData:
password: "REPLACE_WITH_YOUR_DATABASE_PASSWORD"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mof-config
namespace: mof
data:
RK_POSTGRES_0_ADDR: "db.example.com:5432"
RK_POSTGRES_0_USER: "mof"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mof
namespace: mof
spec:
replicas: 1
# First-release template: stop the old Pod before starting the new version.
strategy:
type: Recreate
selector:
matchLabels:
app: mof
template:
metadata:
labels:
app: mof
# Prometheus discovery by annotation; see the monitoring guide for a PodMonitor
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
prometheus.io/path: /internal/v1/mof/metrics
spec:
enableServiceLinks: false
nodeSelector:
kubernetes.io/arch: amd64
terminationGracePeriodSeconds: 120
containers:
- name: mof
image: registry.cn-hangzhou.aliyuncs.com/mofcloud/mof:v2.0.15
envFrom:
- configMapRef:
name: mof-config
env:
- name: RK_POSTGRES_0_PASS
valueFrom:
secretKeyRef:
name: mof-database
key: password
ports:
- name: api
containerPort: 8080
startupProbe:
httpGet:
path: /v1/mof/site-info
port: api
periodSeconds: 10
failureThreshold: 60
readinessProbe:
httpGet:
path: /v1/mof/site-info
port: api
periodSeconds: 10
timeoutSeconds: 5
resources:
requests:
cpu: "500m"
memory: "1Gi"
volumeMounts:
- name: offer-cache
mountPath: /usr/src/mof/offer-cache
volumes:
- name: offer-cache
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: mof
namespace: mof
spec:
selector:
app: mof
ports:
- name: api
port: 8080
targetPort: api
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mof-mcp
namespace: mof
spec:
replicas: 1
selector:
matchLabels:
app: mof-mcp
template:
metadata:
labels:
app: mof-mcp
spec:
enableServiceLinks: false
nodeSelector:
kubernetes.io/arch: amd64
containers:
- name: mof-mcp
image: registry.cn-hangzhou.aliyuncs.com/mofcloud/mof-mcp:v2.0.3
ports:
- name: mcp
containerPort: 8001
readinessProbe:
exec:
command: ["node", "/app/build/healthcheck.js"]
periodSeconds: 10
timeoutSeconds: 5
resources:
requests:
cpu: "100m"
memory: "128Mi"
---
apiVersion: v1
kind: Service
metadata:
name: mof-mcp
namespace: mof
spec:
selector:
app: mof-mcp
ports:
- name: mcp
port: 8001
targetPort: mcp
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dash
namespace: mof
spec:
replicas: 1
selector:
matchLabels:
app: dash
template:
metadata:
labels:
app: dash
spec:
enableServiceLinks: false
nodeSelector:
kubernetes.io/arch: amd64
containers:
- name: dash
image: registry.cn-hangzhou.aliyuncs.com/mofcloud/dash:v2.0.17
ports:
- name: web
containerPort: 80
readinessProbe:
httpGet:
path: /
port: web
periodSeconds: 10
resources:
requests:
cpu: "100m"
memory: "64Mi"
---
apiVersion: v1
kind: Service
metadata:
name: dash
namespace: mof
spec:
selector:
app: dash
ports:
- name: web
port: 80
targetPort: web
type: ClusterIP
GHCR · MOF v2.0.15 · Dash v2.0.17 · MCP v2.0.3
Tải xuống mof.yaml ↓Xem tệp
# MOF v2.0.15 + Dash v2.0.17 + MCP v2.0.3
# Edit database address, user and password before applying. Keep this file private.
# Keep the Service names mof, mof-mcp and dash, all in one namespace: the components find each
# other by them (mof:8080, mof-mcp:8001). Renamed Services can't connect.
# Private-network PostgreSQL without TLS. TLS-only databases are not supported by this release.
apiVersion: v1
kind: Namespace
metadata:
name: mof
---
apiVersion: v1
kind: Secret
metadata:
name: mof-database
namespace: mof
type: Opaque
stringData:
password: "REPLACE_WITH_YOUR_DATABASE_PASSWORD"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mof-config
namespace: mof
data:
RK_POSTGRES_0_ADDR: "db.example.com:5432"
RK_POSTGRES_0_USER: "mof"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mof
namespace: mof
spec:
replicas: 1
# First-release template: stop the old Pod before starting the new version.
strategy:
type: Recreate
selector:
matchLabels:
app: mof
template:
metadata:
labels:
app: mof
# Prometheus discovery by annotation; see the monitoring guide for a PodMonitor
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
prometheus.io/path: /internal/v1/mof/metrics
spec:
enableServiceLinks: false
nodeSelector:
kubernetes.io/arch: amd64
terminationGracePeriodSeconds: 120
containers:
- name: mof
image: ghcr.io/mofcloud/mof:v2.0.15
envFrom:
- configMapRef:
name: mof-config
env:
- name: RK_POSTGRES_0_PASS
valueFrom:
secretKeyRef:
name: mof-database
key: password
ports:
- name: api
containerPort: 8080
startupProbe:
httpGet:
path: /v1/mof/site-info
port: api
periodSeconds: 10
failureThreshold: 60
readinessProbe:
httpGet:
path: /v1/mof/site-info
port: api
periodSeconds: 10
timeoutSeconds: 5
resources:
requests:
cpu: "500m"
memory: "1Gi"
volumeMounts:
- name: offer-cache
mountPath: /usr/src/mof/offer-cache
volumes:
- name: offer-cache
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: mof
namespace: mof
spec:
selector:
app: mof
ports:
- name: api
port: 8080
targetPort: api
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mof-mcp
namespace: mof
spec:
replicas: 1
selector:
matchLabels:
app: mof-mcp
template:
metadata:
labels:
app: mof-mcp
spec:
enableServiceLinks: false
nodeSelector:
kubernetes.io/arch: amd64
containers:
- name: mof-mcp
image: ghcr.io/mofcloud/mof-mcp:v2.0.3
ports:
- name: mcp
containerPort: 8001
readinessProbe:
exec:
command: ["node", "/app/build/healthcheck.js"]
periodSeconds: 10
timeoutSeconds: 5
resources:
requests:
cpu: "100m"
memory: "128Mi"
---
apiVersion: v1
kind: Service
metadata:
name: mof-mcp
namespace: mof
spec:
selector:
app: mof-mcp
ports:
- name: mcp
port: 8001
targetPort: mcp
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dash
namespace: mof
spec:
replicas: 1
selector:
matchLabels:
app: dash
template:
metadata:
labels:
app: dash
spec:
enableServiceLinks: false
nodeSelector:
kubernetes.io/arch: amd64
containers:
- name: dash
image: ghcr.io/mofcloud/dash:v2.0.17
ports:
- name: web
containerPort: 80
readinessProbe:
httpGet:
path: /
port: web
periodSeconds: 10
resources:
requests:
cpu: "100m"
memory: "64Mi"
---
apiVersion: v1
kind: Service
metadata:
name: dash
namespace: mof
spec:
selector:
app: dash
ports:
- name: web
port: 80
targetPort: web
type: ClusterIP
Giữ nguyên tên Service mof, mof-mcp và dash, tất cả trong một namespace. Các thành phần tìm thấy nhau qua những tên này (mof:8080, mof-mcp:8001), nên không cần cấu hình gì thêm; Service bị đổi tên sẽ không kết nối được.
Kết nối cơ sở dữ liệu
Điền PostgreSQL sẵn có của bạn vào mof.yaml:
RK_POSTGRES_0_ADDR- Địa chỉ:cổng
RK_POSTGRES_0_USER- Tên người dùng
stringData.password- Mật khẩu cơ sở dữ liệu hiện có
Giữ mật khẩu trong dấu nháy và giữ tệp này ở chế độ riêng tư.
Triển khai
kubectl apply -f mof.yaml
kubectl -n mof rollout status deployment/mof --timeout=10m
kubectl -n mof rollout status deployment/mof-mcp deployment/dashKhi cả ba đã rollout xong, lấy mật khẩu Admin:
kubectl -n mof logs deployment/mof | grep "Admin password"Mở MOF
kubectl -n mof port-forward service/dash 8000:80Giữ terminal này chạy.
http://127.0.0.1:8000/adminCài giấy phép và tạo người dùng.
http://127.0.0.1:8000Đăng nhập bằng tài khoản MOF của bạn.
Cấu hình nâng cao
Tương thích TLS của PostgreSQL
MOF áp dụng cài đặt TLS cho Mof và AsyncJobMof, nhưng không cho cơ sở dữ liệu của provider. Template này yêu cầu mạng riêng tin cậy và không dùng được PostgreSQL chỉ chấp nhận TLS.
Tên miền, HTTPS và OAuth tùy chọn
Dùng Ingress controller sẵn có và trỏ tên miền của bạn tới đó. Đặt class, hostname và TLS Secret sẵn có trong namespace mof.
Tải xuống ingress.yaml ↓# Requires an installed Ingress controller and an existing TLS Secret.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: mof
namespace: mof
spec:
ingressClassName: nginx
tls:
- hosts: [mof.example.com]
secretName: mof-web-tls
rules:
- host: mof.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: dash
port:
number: 80
kubectl apply -f ingress.yaml
kubectl -n mof get ingressBật MCP trong Admin → Cài đặt → MCP. Endpoint: /v1/mof/remote-mcp. Token không cần OAuth; OAuth qua trình duyệt cần HTTPS, MOF_PUBLIC_URL và MOF_MCP_OAUTH_SECRET.
Health check và xử lý sự cố
kubectl -n mof get pods
kubectl -n mof logs deployment/mof --tail=100
kubectl -n mof logs deployment/mof-mcp --tail=60
kubectl -n mof logs deployment/dash --tail=60
kubectl -n mof exec deployment/mof -- wget -q -O - http://mof-mcp:8001/healthKết quả mong đợi: mof, mof-mcp và dash ở trạng thái Running và Ready; MCP ready: true. Nếu khởi động thất bại, kiểm tra việc pull image, kiến trúc node và quyền truy cập cơ sở dữ liệu.
Tham số template
RK_POSTGRES_0_ADDRhostname:port của PostgreSQL bên ngoài, truy cập được từ Pod.RK_POSTGRES_0_USERRole cơ sở dữ liệu sẵn có, có quyền tạo cơ sở dữ liệu MOF và provider.mof-database / passwordMật khẩu cơ sở dữ liệu lưu trong Secret; chỉ được inject vào MOF.Services mof / mof-mcp / dashMỗi thành phần một Deployment và một Service. Chúng tìm thấy nhau qua tên Service; không cần đặt gì.replicas / strategy1 / Recreate. Nâng cấp sẽ gián đoạn dịch vụ trong thời gian ngắn; HA nhiều replica nằm ngoài phạm vi template này.resources.requestsMức dự trữ khi lập lịch, không phải giới hạn bộ nhớ. Điều chỉnh MOF theo khối lượng hóa đơn và theo dõi mức sử dụng thực tế.offer-cache / emptyDirBộ nhớ đệm giá công khai, có thể dựng lại. Bị mất khi Pod được thay; dữ liệu hóa đơn vẫn ở trong PostgreSQL.ingressClassName / host / tlsKhớp với controller đã cài, tên miền công khai và TLS Secret của bạn. Tùy chọn khi kiểm tra bằng port-forward cục bộ.Cập nhật, dữ liệu và mở rộng
Sao lưu PostgreSQL, cập nhật phiên bản image và apply mof.yaml. Khởi động lại sau khi thay đổi ConfigMap hoặc Secret. Nâng cấp kiểu Recreate sẽ gián đoạn dịch vụ.
kubectl -n mof rollout restart deployment/mof
kubectl -n mof rollout status deployment/mof --timeout=10mChỉ một replica; Kubernetes Job theo yêu cầu chưa được triển khai. Dữ liệu ứng dụng nằm trong PostgreSQL bên ngoài; bộ nhớ đệm giá có thể dựng lại.