During deployment I need to change php-fpm source code (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:
- php-fpm stop
- source code update (mv command)
- 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.