The current iteration of the Lando install script has some issues that prevent it from executing properly. Firstly it is set to search for a reference DB dump named sanitized.sql, while the current dumps are gzipped, so the script never finds the dump. Secondly, the script defaults to assuming that it is being run from the host machine when running actions. This would execute as expected when run from the host's project directory (e.g. ./.lando/scripts/lando-install.sh), but when run via the Lando tooling (e.g. lando site-install) it is unable to run a db-import, both due to the missing alias name and the fact that the appserver service cannot directly talk to the database service.
This PR makes a couple of changes to split up the site install process and make sure that it can be run from the host machine or container/tooling properly:
Install scripts are split up into one to run in the database service (searching for the reference db and importing it if found), and one for the appserver service (installing composer packages, running drush site-install if no reference DB is found, and importing site config).
The Lando site-install tooling now individually runs the new scripts to install packages, attempt to import the DB (or initialize the site), and set up site config/admin creds.
A new Lando tooling reset-admin exists to simply reset admin credentials. This can be useful if needing to regularly re-import the reference DB during active development.
It's overall still a tad messy, and may have some confusing language in certain cases (e.g. with no reference DB, calling the site-install tooling will show a message asking the user to manually run site-install.sh, but the tooling will run it afterwards anyway), but it should function cleanly.
The current iteration of the Lando install script has some issues that prevent it from executing properly. Firstly it is set to search for a reference DB dump named
sanitized.sql
, while the current dumps are gzipped, so the script never finds the dump. Secondly, the script defaults to assuming that it is being run from the host machine when running actions. This would execute as expected when run from the host's project directory (e.g../.lando/scripts/lando-install.sh
), but when run via the Lando tooling (e.g.lando site-install
) it is unable to run a db-import, both due to the missing alias name and the fact that the appserver service cannot directly talk to the database service.This PR makes a couple of changes to split up the site install process and make sure that it can be run from the host machine or container/tooling properly:
drush site-install
if no reference DB is found, and importing site config).site-install
tooling now individually runs the new scripts to install packages, attempt to import the DB (or initialize the site), and set up site config/admin creds.reset-admin
exists to simply reset admin credentials. This can be useful if needing to regularly re-import the reference DB during active development.It's overall still a tad messy, and may have some confusing language in certain cases (e.g. with no reference DB, calling the
site-install
tooling will show a message asking the user to manually runsite-install.sh
, but the tooling will run it afterwards anyway), but it should function cleanly.