I have a multisite install that is working correctly locally. I was pushing this out to staging and now I am running into a roadblock. I provisioned the server and deployed the files. After deployment I get this.
non-zero return code
fatal: [summitgeeks.com]: FAILED! => {"changed": false, "cmd": ["wp", "core", "is-installed", "--skip-plugins", "--skip-themes", "--require=/srv/www/summitgeeks.test/shared/tmp_multisite_constants.php"], "delta": "0:00:00.272327", "end": "2022-03-09 21:27:32.879235", "failed_when_result": true, "rc": 255, "start": "2022-03-09 21:27:32.606908", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
I ssh into the remote server to run the install as instructed. But when I try to get here /srv/www//current/ there is no current directory. I see logs, releases, and shared. If I go into releases I can see the one I just did. But if I run the install there it doesnt seem to work. Is there something that I am missing. Let me know if you need additional info and as always thank you for the help.
Update: I just setup a fresh install and configured multisite locally.
1.) trellis provision staging - this was successful
2.) trellis deploy staging - error output below
When I ssh into the server there is no current directory.
I went into releases to run
wp core multisite-install
Is anyone else running into this? Any help would be greatly appreciated.
vipul
March 10, 2022, 5:35am
3
Hello @mwalcott
there is 2 issues in your code as per details
you must have to check your SMTP credit, port are running fine
can you check your Wp have setup have multiple site config
define( 'WP_ALLOW_MULTISITE', true );
I am checking that now. But do you have any idea why the current directory is not being created?
For 2 are you referring to this? If so yes this is setup. Multisite works fine locally
vipul
March 10, 2022, 5:45am
6
Hello @mwalcott
yes bcoz of SMTP, that block to everything. need to provider correct crews.
vipul
March 10, 2022, 5:46am
7
Yes that fine. there is no issues wp config.
So in the past you didnt need to update mail setting to get the staging server running. Anyway I updated that and still run into the same issue.
Citvej
March 10, 2022, 2:57pm
9
I was successful after following this comment/tutorial:
opened 12:52PM - 29 Oct 18 UTC
## Bug report
- [x] I've read the [guidelines for Contributing to Roots Proje… cts](https://github.com/roots/guidelines/blob/master/CONTRIBUTING.md)
- [ ] This is a feature request
- [x] This is a bug report
- [ ] This request isn't a duplicate of an [existing issue](https://github.com/roots/trellis/issues) _(unsure, could be related to #805)_
- [x] I've read the [docs](https://roots.io/trellis/docs) and followed them (if applicable)
- [x] This is not a personal support request that should be posted on the [Roots Discourse](https://discourse.roots.io/c/trellis) forums
---
**What is the current behavior?**
When using a multisite configuration, the deployment fails during the ansible task `WordPress Installed?`.
This is in turn caused by the `wp core is-installed` command exiting with non zero status because of a `ConstantAlreadyDefinedException`.
This is related to roots/bedrock#380 and roots/docs#168.
**What is the expected or desired behavior?**
The deployment completes without error.
The `wp core is-installed` command exits with 0.
---
**Please provide steps to reproduce, including full log output:**
1. Configure the multisite installation as suggested by [the docs](https://roots.io/trellis/docs/multisite/), using [roots/wp-config](https://github.com/roots/wp-config).
Note that the `MULTISITE` and `SUBDOMAIN_INSTALL` redefinition is now prevented, by design, with the usage of the new configuration model.
2. Run the deployment script:
```
$: ./bin/deploy.sh staging ***
TASK [deploy : WordPress Installed?] ***********************************************************************************************
System info:
Ansible 2.6.4; Linux
Trellis version (per changelog): "Allow customizing Nginx `worker_connections`"
---------------------------------------------------
non-zero return code
fatal: [***.***.***.***]: FAILED! => {"changed": false, "cmd": ["wp", "core", "is-installed", "--skip-plugins", "--skip-themes", "--require=/srv/www/***/shared/tmp_multisite_constants.php"], "delta": "0:00:00.367497", "end": "2018-10-26 17:40:16.192522", "failed_when_result": true, "rc": 255, "start": "2018-10-26 17:40:15.825025", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
```
3. Logging into the target host and executing the command manually with the `--debug` flag yields the following output:
```
$: wp core is-installed --skip-plugins --skip-themes --require=/srv/www/***/shared/tmp_multisite_constants.php --debug
Debug (bootstrap): Required file from config: /srv/www/***/shared/tmp_multisite_constants.php (0.01s)
Debug (bootstrap): No readable global config found (0.051s)
Debug (bootstrap): Using project config: /srv/www/***/releases/20181026173903/wp-cli.yml (0.051s)
Debug (bootstrap): argv: /usr/bin/wp core is-installed --skip-plugins --skip-themes --require=/srv/www/***/shared/tmp_multisite_constants.php --debug (0.051s)
Debug (bootstrap): ABSPATH defined: /srv/www/***/releases/20181026173903/web/wp/ (0.051s)
Debug (bootstrap): Begin WordPress load (0.052s)
Debug (bootstrap): wp-config.php path: /srv/www/***/releases/20181026173903/web/wp-config.php (0.052s)
PHP Fatal error: Uncaught Roots\WPConfig\Exceptions\ConstantAlreadyDefinedException: Aborted trying to redefine constant 'MULTISITE'. `define('MULTISITE', ...)` has already been occurred elsewhere. in /srv/www/***/releases/20181026173903/vendor/roots/wp-config/src/Config.php:106
Stack trace:
#0 /srv/www/***/releases/20181026173903/vendor/roots/wp-config/src/Config.php(26): Roots\WPConfig\Config::defined('MULTISITE')
#1 /srv/www/***/releases/20181026173903/config/application.php(119): Roots\WPConfig\Config::define('MULTISITE', true)
#2 phar:///usr/bin/wp/php/WP_CLI/Runner.php(1145) : eval()'d code(7): require_once('/srv/www/***...')
#3 phar:///usr/bin/wp/php/WP_CLI/Runner.php(1145): eval()
#4 phar:///usr/bin/wp/php/WP_CLI/Runner.php(1107): WP_CLI\Runner->load_wordpress()
#5 phar:///usr/bin/wp/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#6 phar:///usr/bin/wp/php/bootstrap.php(75): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\B in /srv/www/***/releases/20181026173903/vendor/roots/wp-config/src/Config.php on line 106
```
---
This is caused by the explicit and one-time requirement of the file `roles/deploy/files/tmp_multisite_constants.php`, which defines constant that may be re-defined later by the application config.
---
**Possible solutions:**
Either of the following:
- rethink the usage of `tmp_multisite_constants.php` (the purpose of which is unclear to me at the moment) so that it avoids constant definitions. This is arguably the most desirable approach, but I'm not able to assess exactly what this would entail and how to proceed, because I don't even know why this file is being required in the first place during the affected Ansible task.
Furthermore, I'm not sure using `Roots\WPConfig\Config` inside this file is feasible, because the autoloader has not been loaded yet, and I'm not clear when `apply` should then happen. Maybe this suggests a design oversight in the new configuration model.
Also, IMO sneaking in a bunch of constants in such a non-transparent way is not a very sensible thing to do in general.
- Add an `if defined` block to the multisite configuration docs. This would also require to explain accordingly the presence and purpose of `tmp_multisite_constants.php`, which as previously mentioned I am unable to do. IMO it also grants a kind of "wtf" moment to trellis users, which makes this solution undesirable.
- revert roots/docs#168; this is arguably a worse approach, because people may end up using the new configuration model regardless of what the docs suggests, since that model is encouraged in the first place by Bedrock docs, and keeping any usage of the bare `define` function would make docs inconsistent.
Basically you have to install without multisite, then enable multisite in second step and in third step you add more configuration.
I basically created 3 branches, for each step one, so I don’t always have to modify variables for staging and production.
1 Like