The local situation:
trellis 1.21.0
trellis-cli 1.11.1
ansible core 2.16.0
python 3.12.0
The production (and staging) situation:
wp-cli: 2.8.0
php 8.1.26
I have several sites configured in trellis, each have staging and production in the same configuration. But only one site fail on deploy on production.
Thank you for your response but it seem to be different.
As described in first solution I tried to change my config file using getenv() instead of env() but nothing changed as other websites could be deployed while using env().
Also, no errors reported in those files:
/var/log/php8.1-fpm.log
/var/log/auth.log
even in
/var/log/kern.log
/var/log/nginx/error.log
/srv/www/example.com/logs/error.log
I re-provisionned the server but nothing is changing. Other websites on that trellis server are ok but not that one. Always falling here:
For some quick and dirty debugging (deploy to staging Trellis in all of these approaches, as those are invasive):
Empty the plugin folder (e.g. my renaming it/replacing with an empty directory) and re-invoke wp core is-installed – does it work now?
Use a default theme for that site.
Sprinkle some echo 'test'; exit; into the different Bedrock site and WordPress core files and see whether they appear when invoking wp core is-installed.
Enable debugging and step through each and every line while wp core is-installed is running.
The wp core is-installed command is very simple and uses is_blog_installed() as first check:
The weirdest thing is when I deploy to staging, I’m syncing db and files from production with the Sync script @ben made and everything goes right.
I’m stuck, if someone know something, he should tell it!
The issue (and subsequent fix) could be caused either by a configuration issue (stored in database) or some cached (acorn) in uploads directory that was also transferred during sync.
Nothing transferred by the sync process create issue. When I deploy to staging it’s a success even syncing datas (files and DB) from the production server.
The servers configurations are exactly the same (PHP, WP-CLI, MariaDB… ) and provisioning the servers are ok too…
The Sync Script is working with the “current” folder. Not in the “release folder” the Trellis deploy playbook create.
Problem is happening on deploy at this task: [deploy : Invoke 'wp core is-installed' command] in the “release folder”
When you invoke wp core is-installed inside the affected release folder, what exit code do you get (echo $? for printing the exist code of last command)?
Any PHP related messages printed to terminal? (Edit: PHP CLI config is separate from PHP-FPM server config, so error reporting should be already enabled).
So there is no .env file in that release, hence the Bedrock site cannot run.
Copy an existing .env from current/ / a working release directory,
and try the wp core is-installed command in the directory of affected release again, does it work then?
I was curious so I checked the production server and the .env file does exist in the latest release. I viewed the file and everything looks correct within it for production.
Where it was similar to the initial topic issue? If it’s not you should, create an other topic to get the ability to mark it solved when it will be done. That help other to don’t read two topic in one and save time. And by the way, my thread
If a new deploy is suddenly failing, the first thing I’d check is what changed between releases. What’s different in your git repo between the failing release and the last working release?
You can reference GIT_SHA from the .env file in your release directory to get the specific git reference that was used to deploy