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>
82 lines
2.9 KiB
Plaintext
82 lines
2.9 KiB
Plaintext
# =============================================================================
|
|
# PostgreSQL 效能優化配置
|
|
# WOOO TECH - Momo Pro System
|
|
# 針對 8GB RAM 伺服器優化
|
|
# =============================================================================
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# 連線設定
|
|
# -----------------------------------------------------------------------------
|
|
listen_addresses = '*'
|
|
max_connections = 100
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# 記憶體配置 (針對 8GB RAM 優化)
|
|
# -----------------------------------------------------------------------------
|
|
# shared_buffers: 建議設為總 RAM 的 25% (8GB * 0.25 = 2GB)
|
|
shared_buffers = 2GB
|
|
|
|
# work_mem: 每個排序/Hash 操作的記憶體 (大型查詢需要更多)
|
|
# 計算: (RAM - shared_buffers) / (max_connections * 2)
|
|
work_mem = 64MB
|
|
|
|
# maintenance_work_mem: VACUUM, CREATE INDEX 等維護操作使用
|
|
maintenance_work_mem = 512MB
|
|
|
|
# effective_cache_size: 告訴 planner 系統總共有多少快取可用
|
|
# 建議設為總 RAM 的 75%
|
|
effective_cache_size = 6GB
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# 磁碟 I/O 配置
|
|
# -----------------------------------------------------------------------------
|
|
# 使用 SSD 時建議調高
|
|
random_page_cost = 1.1
|
|
effective_io_concurrency = 200
|
|
|
|
# 預讀設定 (對於大表 Seq Scan 很重要)
|
|
seq_page_cost = 1.0
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# WAL (Write-Ahead Log) 配置
|
|
# -----------------------------------------------------------------------------
|
|
wal_buffers = 64MB
|
|
checkpoint_completion_target = 0.9
|
|
max_wal_size = 2GB
|
|
min_wal_size = 1GB
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# 查詢計劃器配置
|
|
# -----------------------------------------------------------------------------
|
|
# 鼓勵使用索引
|
|
enable_seqscan = on
|
|
enable_indexscan = on
|
|
enable_bitmapscan = on
|
|
|
|
# 並行查詢 (利用多核心)
|
|
max_parallel_workers_per_gather = 2
|
|
max_parallel_workers = 4
|
|
max_worker_processes = 8
|
|
parallel_tuple_cost = 0.01
|
|
parallel_setup_cost = 1000
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# 自動 VACUUM 配置
|
|
# -----------------------------------------------------------------------------
|
|
autovacuum = on
|
|
autovacuum_vacuum_scale_factor = 0.1
|
|
autovacuum_analyze_scale_factor = 0.05
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# 日誌配置
|
|
# -----------------------------------------------------------------------------
|
|
log_min_duration_statement = 1000
|
|
log_checkpoints = on
|
|
log_lock_waits = on
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# 統計收集
|
|
# -----------------------------------------------------------------------------
|
|
track_activities = on
|
|
track_counts = on
|