最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to deploy atomically on Nginx+Php-fpm without losing requests? - Stack Overflow

programmeradmin1浏览0评论

During deployment I need to update a source code of my web PHP application (more files), but I don't want to lose ANY http requests. Old pending requests could be handled by new source code (let's not worry about compatibility).

I don't think a reload (USR2 signal) of the php-fpm service is sufficient (it's not possible to atomically swap the source code because opcache.revalidate_freq), it probably has to do:

  1. php-fpm stop
  2. source code update (mv command)
  3. php-fpm start,

but in that case nginx doesn't wait for php-fpm to start and starts returning 503 to visitors.

Does anyone know a simple way how to deploy atomically and process 100% of requests?

I have a solution that might work (another server in nginx upstream waiting for php-fpm to start..., configure graceful php-fpm stop...) but it seems complicated.

发布评论

评论列表(0)

  1. 暂无评论