-
Notifications
You must be signed in to change notification settings - Fork 16
Description
We have a situation where a Drupal 8 project needs to use Drupal Console,
The --target
option can also be used like Drush @alias
, so the syntax on cli commands can be exactly the same, and we can leverage {{alias}}
in the hook section of .terra.yml
scripts.
The problem is that although the same syntax on the cli can be used, the actual targets themselves must be redefined in a separate file in ~/.console/sites/
folder because Drupal Console will not read ~/.drush/*.aliases.drushrc.php
. See the relevant console documentation for the format of the files in ~/.console/sites/
folder.
You end up with these errors:
$ drupal cache:rebuild all @terra.appname.environment --no-interaction
[PDOException]
SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known
[PDOException]
PDO::__construct(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known
The terra architecture leverages a separate Drush container instead of logging directly into one of the app images to run Drush commands. So my thinking is that we would need to build a similar support straight into terra to provide an optional Drupal Console container and build in support into terra for creating Drupal Console "targets" when we create Drupal aliases. The missing step is to auto-generate the targets inside ~/.console/sites/terra.{appname}.yml
when we generate ~/.drush/terra.{appname}.aliases.drushrc.php
.
Is this a sound way to approach this problem? I'm not quite sure how we could offer an optional image for the docker-compose.yml file though. Maybe we just need to leave the Drupal Console container as part of the .terra.yml
file, and let each drupal 8 project build their own? Seems kind of dirty though, we'll still need a way to determine inside terra whether or not to create the site targets file, which I also dont have a good idea how to do that.
Looking forward to your insights @jonpugh