When using zero-downtime deployments a lot of issues can arise.

If using Horizon, if you terminate it in the deploy script it happens before the new code is live missing changes.

restarting PHP-FPM happens before the site goes live

These are two examples of things that should happen AFTER zero downtime has been completed.

So I suggest a "Post deploy" like the current deployment, but it runs after the deployment has finished.

Zero downtime is currently not useable without it (unless we manually restart things after each deployment)

· · Edited
·

Could this perhaps be pointed out in the docs? I am sure a lot of people does not know this and it can lead to some bad problems as Samuel said (I have run into these myself before I knew I had to reload php-fpm manually)

1 total vote
· · Edited
·

Any updates on this? Personally I feel this is quite a big problem that can lead to a lot of problems if people arent aware or forget to restart fpm after a deployment.

1 total vote

Samuel Loft

Item author
·
·

I have given up hope, zero downtime is disabled on most of our projects now as it is unusable in it's current state.

no votes yet
·
·

This now all seems to be working for new sites. I don't even need to restart fpm anymore.

The nginx config has been changed

//before
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

//after
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;

I am currently going over old sites, and making this change

no votes yet
·
·

So basically pre, main and post deploy scripts have been added for a while now. Basically this should solve the problems you're experiencing.

Also note that reloading FPM isn't needed in these deploy scripts.

no votes yet
·
·

Thanks Dennis.

Out of interest is restarting FPM handled sutomatically without having to manage this manually in a script already?

no votes yet
·
·

You don't need to reload PHP FPM, if you do that, you'd still get 502 bad gateways for about a second and that would not be zero downtime deployment.

The reload isn't needed because the zero downtime feature creates a new folder based on time which tells opcache "these files are new" automatically, so no reload is needed.

no votes yet

Post deployment commands

7 total votes