You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
As of Drupal 8.0.0-beta16, the strategy we have been using to initialize the configuration directories is now producing an inconvenience for local site development.
drupal_install_config_directories() writes a random configuration directory location into settings.php. A random config directory is inconvenient for Pantheon, because it is easier to protect a constant directory path in our nginx rules. We therefore defeat the random configuration directory setup for Pantheon sites by pre-populating $config_directories[CONFIG_STAGING_DIRECTORY], which Drupal will use in preference to a generated location when provided.
This technique still works just fine on the Pantheon platform, but it has the potential to fail to install if the user tries to take their site code and install it locally. Starting in beta16, if $config_directories[CONFIG_STAGING_DIRECTORY] is prepopulated, then Drupal will attempt to reference the database early in the installation process (prior to displaying the "select language" dialog), and if the database is not yet configured, then the install will fail with an error, and it cannot be restarted.
Workarounds include:
Install with Drush.
Configure your database prior to running the installer.
Remove $config_directories from settings.php before running the installer.
Skip installation, and use the database from the Pantheon site.
The Drupal 8 instructions for re-installing a site are: (1) empty your database, and (2) copy default.settings.php over settings.php. This will also work for site code that was checked out from Pantheon for local installation, but of course, if you remove $config_directories from settings.php, it might cause problems for importing the staging config files in the git repository. (As an aside, importing configuration from a different Drupal installation is not convenient in Drupal 8, as D8 presumes that the database and configuration will always migrate together.) See drush-ops/drush#1625 and drush-ops/drush#1372.)
Overall, this is probably just a documentation issue. The workarounds are reasonable for most use cases, CI tests being the notable exception.
The text was updated successfully, but these errors were encountered:
So, I think that all of the ordinary use cases will work out just fine for folks; in the case of CI, if the tests are not running on a Pantheon-hosted site, they will install with Drush, and if they are running on a Pantheon site, they will work (because the database will be configured before installation).
I think that the one think that might be needed here is a troubleshooting document for users who encounter the error below:
Error
The website encountered an unexpected error. Please try again later.
Drupal\Core\Database\ConnectionNotDefinedException: The specified database connection is not defined: default in Drupal\Core\Database\Database::openConnection() (line 366 of core/lib/Drupal/Core/Database/Database.php).
Drupal\Core\Database\Database::openConnection('default', 'default')
Drupal\Core\Database\Database::getConnection()
Drupal\Core\Config\BootstrapConfigStorageFactory::getDatabaseStorage()
Drupal\Core\Config\BootstrapConfigStorageFactory::get()
install_begin_request(Object, Array)
install_drupal(Object)
The easiest workaround is to remove $config_directories from setting.php, install Drupal, and then put $config_directories back to its old value after installation is complete.
For the record, I just ran into the "ConnectionNotDefinedException" issue as described above when trying to set up D8 locally with a local copy of my Pantheon DB.
My fix was to configure the local.settings.php as cited here:
As of Drupal 8.0.0-beta16, the strategy we have been using to initialize the configuration directories is now producing an inconvenience for local site development.
drupal_install_config_directories()
writes a random configuration directory location into settings.php. A random config directory is inconvenient for Pantheon, because it is easier to protect a constant directory path in our nginx rules. We therefore defeat the random configuration directory setup for Pantheon sites by pre-populating$config_directories[CONFIG_STAGING_DIRECTORY]
, which Drupal will use in preference to a generated location when provided.This technique still works just fine on the Pantheon platform, but it has the potential to fail to install if the user tries to take their site code and install it locally. Starting in beta16, if
$config_directories[CONFIG_STAGING_DIRECTORY]
is prepopulated, then Drupal will attempt to reference the database early in the installation process (prior to displaying the "select language" dialog), and if the database is not yet configured, then the install will fail with an error, and it cannot be restarted.Workarounds include:
$config_directories
from settings.php before running the installer.The Drupal 8 instructions for re-installing a site are: (1) empty your database, and (2) copy default.settings.php over settings.php. This will also work for site code that was checked out from Pantheon for local installation, but of course, if you remove $config_directories from settings.php, it might cause problems for importing the staging config files in the git repository. (As an aside, importing configuration from a different Drupal installation is not convenient in Drupal 8, as D8 presumes that the database and configuration will always migrate together.) See drush-ops/drush#1625 and drush-ops/drush#1372.)
Overall, this is probably just a documentation issue. The workarounds are reasonable for most use cases, CI tests being the notable exception.
The text was updated successfully, but these errors were encountered: