Some checks failed
CD Pipeline / deploy (push) Failing after 59s
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml) - 部署模式: rsync Python 檔案至 188 → docker restart (volume mount) - Dockerfile/requirements 變動時自動重建 Docker image - 部署通知: Telegram (開始/成功/失敗) - 健康檢查: https://mo.wooo.work/health (最多 5 次重試) - 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
101 lines
2.7 KiB
YAML
101 lines
2.7 KiB
YAML
# =============================================================================
|
|
# WOOO TECH - Momo Pro System
|
|
# 優化版 momo-scheduler Deployment
|
|
# 優化重點: 資源配置、健康檢查、爬蟲任務穩定性
|
|
# =============================================================================
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: momo-scheduler
|
|
namespace: momo
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate # Scheduler 不需要滾動更新,避免重複排程
|
|
selector:
|
|
matchLabels:
|
|
app: momo-scheduler
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: momo-scheduler
|
|
spec:
|
|
# 優雅終止時間 - 給予爬蟲任務完成時間
|
|
terminationGracePeriodSeconds: 60
|
|
|
|
# Init Container - 複製 Google Drive 認證
|
|
initContainers:
|
|
- name: copy-google-credentials
|
|
image: busybox:1.36
|
|
command: ['sh', '-c', 'cp /secrets/* /config/ && chmod 644 /config/*']
|
|
volumeMounts:
|
|
- name: google-drive-secrets
|
|
mountPath: /secrets
|
|
readOnly: true
|
|
- name: momo-config-volume
|
|
mountPath: /config
|
|
|
|
containers:
|
|
- name: scheduler
|
|
image: momo-pro-system:local
|
|
imagePullPolicy: Never
|
|
command: ["python", "run_scheduler.py"]
|
|
|
|
# 環境變數
|
|
envFrom:
|
|
- configMapRef:
|
|
name: momo-config
|
|
- secretRef:
|
|
name: momo-secrets
|
|
|
|
# 資源配置 (爬蟲任務需要較多記憶體)
|
|
resources:
|
|
requests:
|
|
memory: 256Mi
|
|
cpu: 100m
|
|
limits:
|
|
memory: 1Gi
|
|
cpu: 500m
|
|
|
|
# 存活探測 - 使用 exec 檢查進程
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- "pgrep -f 'python run_scheduler.py' || exit 1"
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 60
|
|
timeoutSeconds: 10
|
|
failureThreshold: 3
|
|
successThreshold: 1
|
|
|
|
# 就緒探測 - Scheduler 啟動即就緒
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- "pgrep -f 'python run_scheduler.py' || exit 1"
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 30
|
|
timeoutSeconds: 10
|
|
failureThreshold: 3
|
|
successThreshold: 1
|
|
|
|
volumeMounts:
|
|
- name: momo-data
|
|
mountPath: /app/data
|
|
- name: momo-config-volume
|
|
mountPath: /app/config
|
|
|
|
volumes:
|
|
- name: momo-data
|
|
persistentVolumeClaim:
|
|
claimName: momo-data-pvc
|
|
- name: google-drive-secrets
|
|
secret:
|
|
secretName: google-drive-credentials
|
|
- name: momo-config-volume
|
|
emptyDir: {}
|