Atomic deploys with DeployHQ

I use DeployHQ to automatically deploy WordPress projects on Github to whatever server they need up on. DeployHQ is pretty good, but the deploys aren’t atomic. This means that, if a given deploy takes a minute and a half to perform its filesystem operations, your web server could be serving inconsistent application state for up to a minute and a half, potentially causing fatals and who knows what.

To perform a more atomic deploy, use DeployHQ to deploy your project to a deploy directory, and then run a post-deploy copy command to move your files where they need to be.

2016-03-24 at 6.24 AM.png

As you can see, I’m trialling ServerPilot for managing servers. More on that later, possibly.


Zac February 28, 2018 Reply

Hey Daniel, this is a great work around for atomic deploys. One issue with using cp though, it doesn’t delete files. I solved this for one of our projects by using rsync, somthing like this;

rsync -avz –delete “/srv/www/…/deploy/” “/srv/www/…/current/”

Might be helpful to someone.

Robert Lyall November 13, 2018 Reply

Just a quick heads up. DeployHQ now has “proper” support for atomic deployments.

Leave a Reply