I had a staging environment that I could experiment with, and I’ve found a workaround to this composer cache problem for remote environments (this is on Digital Ocean droplets running Ubuntu 14.04 in this case, though it may also work with Ubuntu 16). The issue with this solution is that the production site does go down for 5-10 minutes, so it’s really not ideal. If anyone has any suggestions like specific ansible tags to run to make the process more efficient, or a way of doing this without having the site go down or rebuilding the site, I’d love it, as I know a number of us will have to deploy this new commit on live sites.
This procedure is based on johnpbloch’s tweets about the update to the package: “delete the old wordpress package. You might also need to run composer clearcache
to get rid of cached downloads/repos.”
Warning: This procedure will, at least temporarily, break your site. So don’t jump in without a parachute.
Step One: Run composer update
to get the latest commit of “johnpbloch/wordpress”: “4.7.3”. Commit the change to composer.lock to your repo, and deploy changes to your existing remote server.
You get the Error: This does not seem to be a WordPress install.
Pass --path=path/to/wordpress
or run wp core download
.
fatal: [104.131.175.130]: FAILED! => {“changed”: false, “cmd”: [“wp”, “core”, “is-installed”], “delta”: “0:00:00.282460”, “end”: “2017-03-19 23:31:10.666699”, “failed”: true, “failed_when_result”: true, “rc”: 1, “start”: “2017-03-19 23:31:10.384239”, “stderr”: “Error: This does not seem to be a WordPress install.\nPass --path=path/to/wordpress
or run wp core download
.”, “stdout”: “”, “stdout_lines”: , “warnings”: }
The website goes down, and if you look the /wp directory is empty except for the composer.json file. The dependency johnpbloch/wordpress-core fails to install.
Step Two: Remove “johnpbloch/wordpress”: “4.7.3” composer package entirely, run composer update
, commit the change and deploy the site to your remote server without the Wordpress package, which removes the old cached version of the package from the remote site.
Second deploy also will fail with the same error, as we’ve removed Wordpress.
Step Three: Add the “johnpbloch/wordpress”: “4.7.3” package back and run composer update
.
There should be three packages installed:
Updating dependencies (including require-dev)
- Installing johnpbloch/wordpress-core-installer (0.2.1)
Downloading: 100%
- Installing johnpbloch/wordpress-core (4.7.3)
Downloading: 100%
- Installing johnpbloch/wordpress (4.7.3)
Downloading: 100%
Step Four: Commit the change to composer.lock and deploy changes.
For me, this final deploy is successful and site is back up without data loss.
@swalkinshaw is that making more sense what might be causing this issue?