deployer icon indicating copy to clipboard operation
deployer copied to clipboard

Deployer deletes the current release If the 'release' and 'current' point to the same directory

Open theCapypara opened this issue 2 years ago • 3 comments

  • Deployer version: 6.8.0
  • Deployment OS: Ubuntu 20.4

We recently had a production deployment which failed because of a database timeout. We were able to just finish the last steps manually and symlink the new release.

Unbeknownst to us, we did not realize that by not also removing the release Symlink after the Deployment was finished, Deployer started removing the contents of the directory the link points to (and thus the current version) rendering the current production system unusable.

While this can probably considered a user error, I would personally also consider it a bug that Deployer does not check whether or not release and current point to the same directory.

I apologize if this is already addressed in new Deployer versions, I skimmed through the changelogs since 6.8.0 but didn't see it.

theCapypara avatar Apr 26 '22 08:04 theCapypara

Right now Deployer deletes release as well. https://github.com/deployphp/deployer/blob/a617327c5c86b9b17ec70cd1ab081610a9178f58/recipe/deploy/release.php#L86-L89

Probably we need to change it to only delete symlink, not release dir.

antonmedv avatar Apr 26 '22 10:04 antonmedv

But wouldn't that potentially leave broken releases and screw with the rollback logic (so Deployer would roll back to potentially broken releases)? I think it's generally reasonable to delete the old release, just not if, for some reason, it points to the same folder as current. So Deployer should probably just fail in that case or alternatively only delete the release folder if it's not also current.

theCapypara avatar Apr 26 '22 10:04 theCapypara

Nope. Rollback will be good. Deployer keeps track of good releases and will rollback to correct one.

In v7 use can see the list via https://deployer.org/docs/7.x/recipe/deploy/release#releases

dep releases

antonmedv avatar Apr 26 '22 11:04 antonmedv