fix(gunicorn): preload 後重置 SQLAlchemy 連線池
Some checks failed
CD Pipeline / deploy (push) Failing after 9m32s

This commit is contained in:
OoO
2026-04-30 00:07:10 +08:00
parent 5a61c020e3
commit 8bc0fd7ff6
3 changed files with 73 additions and 4 deletions

View File

@@ -64,5 +64,5 @@ ENV FLASK_APP=app.py
# 暴露端口(容器內 app 綁 80docker-compose / k8s 對外映射依環境而定)
EXPOSE 80
# 啟動應用production 用 gunicorn4 workers + 300s timeout + 啟用 access/error log
CMD ["gunicorn", "--bind", "0.0.0.0:80", "--workers", "4", "--timeout", "300", "--access-logfile", "-", "--error-logfile", "-", "--preload", "app:app"]
# 啟動應用production 用 gunicornpreload + post_fork DB pool reset 見 gunicorn.conf.py
CMD ["gunicorn", "--config", "gunicorn.conf.py", "app:app"]