heroku-wp
heroku-wp copied to clipboard
Vagrant: Rebuild rm -rf not working as expected
This could be in relation to the new https://github.com/xyu/heroku-wp/tree/fix/use-bento-box branch.
It seems that on the rebuild process there are certain directories that can't be removed, presumably because of hidden files. However the problem is that the fresh files from the working directory don't get copied to the vagrant box because of this error.
Reproducing error
$ vagrant ssh
$ cd /app
$ rm -rf tmp
And the error shows:
rm: cannot remove 'tmp/public.old/wp-admin': Directory not empty
rm: cannot remove 'tmp/public.old/wp-content': Directory not empty
rm: cannot remove 'tmp/public.old/wp-includes': Directory not empty
My understanding is that we should be able to delete these directories on the target machine so that it's a fresh build. If app_slug_compile.sh is trying to do the same then we would have problems in running resync right?
To explain the impact of this issue. Once a change is made in my /public/wp-content/themes the process rebuilds back on Vagrant, but the page won't load after it is complete. Here is the nginx error log:

When checking the public.built folder within the vagrant box I find:
- wp-content/themes empty
- wp-includes empty
- wp-admin empty
Hope this helps debug what is going on.
The only solution I have found is vagrant destroy and vagrant up. A long way round for a theme change!
@toddheslin I found a workaround (but not a fix): https://github.com/xyu/heroku-wp/issues/90#issuecomment-281527359.
(I am on the default nginx-php branch, not use-bento-box)
Running rm -rf tmp/public... works fine from the host, but not the guest for me. It's something with Vagrant syncing the /app directory between the host and guest.