I use Azure DevOps to release a new VM into a VMSS.
When I release the update, Azure swaps the images while the PHP-FPM process is still booting up. This results in 502 Bad Gateway errors for approximately 30 seconds. The PHP-FPM boot process takes roughly a minute to complete.
What I think is happening is that Azure identifies that Nginx is responding and assumes that the VM is fully booted; however, NGINX throws 502 errors because PHP-FPM hasn't completed it's boot process, and it cannot yet find the PHP-FPM socket.
Azure CLI command that is used to release the image: az vmss update
Is there a method to either:
Add a timeout delay before azure swaps the VM? Check to see if NGINX is throwing a 502 error and delay until it isn't?