When deploying an app, old versions of the app are not being deleted.



When deploying an app, old versions of the app are not being deleted.  The Zend Deployment Daemon log (/usr/local/zend/var/log/zdd.log) contains error messages indicating that the old directorycannot be removed and that the directory does not exist.  From a shell, the directory does exist and can be removed manually.  The following is an example of the error message.

[ZDD 12.09.2014 08:43:15 p1823/t140691806824224 ERROR] Failed executing rm -rf /usr/local/zend/var/apps/http/__default__/0/testapp/1.0.0_2. Code 256 No such file or directory
[ZDD 12.09.2014 08:43:15 p1823/t140691806824224 ERROR] Cannot remove application dir /usr/local/zend/var/apps/http/__default__/0/testapp/1.0.0_2.


Zend Server 6

Zend Server 7



Check the permissions and ownership of the directory that cannot be removed.  Verify that nothing changed the permission or ownership of the files after deployment.

If the app needs to have permissions or ownership changes to function properly, ensure that the files can still be deleted by the user "zend".

Attempt to remove the old app directory as user "zend".  The error output will give more specific warnings about which directories are causing permission problems.

# sudo -u zend rm -rf /usr/local/zend/var/app/<old_app_dir>


If the permissions or ownership of the files are changed after deployment, it may not be possible for the Zend Deployment Daemon (ZDD) to remove all the files.  When an app is updated, only the current version and previous version are saved.  Any other versions should be removed.  The same concept applies during a rollback, though the latest version should be removed. If the process does not have sufficient permissions to remove all files, the error messages will be displayed.

The behavior can be reproduced with the following steps.

  1. Deploy application
  2. Update applicaiton
  3. Chown subdirectory of first deployment to "apache"
  4. Update the application again