It seemed to coincide with setting up wp-rocket, but that might just be a coincidence because it’s working on staging, and i’ve removed the stuff added for wp-rocket and it’s still doing this.
Also, have you provisioned the server (don’t confuse with deploying a site!)?
Adding or modifying sites requires a (re-)provisioning of the server (ansible-playbook run).
Right, is-installed will terminate itself with an exit code that indicates whether it is installed or not.
Invoke that composer command, then use echo $? to print the exit code.
Alright, during deploy the current symlink is changed.
Try the composer command again in directory /srv/www/squaremilechurches.com/releases/20210604153609.
The symptoms indicate that WordPress core (roots wordpress package) wasn’t installed by composer, hence the CLI doesn’t deem the core to be installed.
Interesting, now I get an error code: web@squaremile : /srv/www/squaremilechurches.com/releases/20210604153609 $ wp core is-installed --skip-plugins --skip-themes --require=/srv/www/squaremilechurches.com/shared/tmp_multisite_constants.php
But wp core is-installed --skip-plugins --skip-themes --require=/srv/www/squaremilechurches.com/shared/tmp_multisite_constants.php will still have a non-0 (e.g. 255) exit code?
When I ran composer install it didn’t install WP, presumably because it is already installed… Is it worth me trying to to downgrade WP which might force it to install it again?
You can also remove (better rename it!) the web/wp folder from that particular release and re-run composer install. This is where there WordPress core files are.
I tried renaming the wp folder to wp2 and then running composer install. It installed WP again, but then still returned a 255 message: web@squaremile : /srv/www/squaremilechurches.com/releases/20210604153609 $ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
I’ve figured what caused it to break - although no idea why it only affected staging and production. When I added wp-rocket I added two new env variables in /all/vault.yml. When it broke I removed all the other wp-rocket changes I made, but forgot about the env variables, i’ve just removed these and now it deploys again.
I’ve no idea why it broke the deploy - i’ve added those variables to other projects with no problems. I’ve also no idea why it only broke production…
At least I was able to get my release deployed now, i’ll try adding the variables again next week.
Thanks for your help. I’ll post back when I try to set the .env variables again next week, i’ll either need more help, or this might prove useful for someone else one day.
When I’m working with YAML files I find it’s useful to turn on “show invisible characters” (or whatever the IDE-appropriate setting is). YAML will sometimes produce bizarre results because you, say, used a tab instead of spaces–which you’ll never catch unless you look at what the exact characters are. Running YAML files through a validator can also be helpful.