lando / drupal

The Official Drupal Lando plugin
https://docs.lando.dev/drupal
GNU General Public License v3.0
16 stars 16 forks source link

Upgrading existing local sites in lando 3.20.x => 3.21.x beta or stable database fails to build site fails to load #125

Closed bronius-congruity closed 3 months ago

bronius-congruity commented 3 months ago

I think when 3.21 alpha/beta started coming out (excellent improvements, btw) a lot of us got snagged on the upgrade. Now several months later I am back at it and finally cracked what went wonky for me and what worked.

Wonky:

Existing Drupal site built with a lando 3.20.x recipe referencing "mariadb" would not lando rebuild successfully with upgraded lando 3.21.x. Using the same sort of recipe, I can start a new project (and db comes up, and healthcheck passes), but I can't seem to latch onto existing ones. Upon closer inspection, my database build failed with a write permission error:

lando logs -s database

Lando Log ``` database_1 | userperms 21:23:33.29 WARN ==> Only the root user can reset permissions! This is probably ok though... database_1 | loadkeys 21:23:33.39 WARN ==> Only the root user can load ssh keys! This is probably ok though... database_1 | lando 21:23:33.40 INFO ==> Lando handing off to: /launch.sh database_1 | lando 21:23:33.42 DEBUG ==> Running command with exec... database_1 | mariadb 21:23:33.51 database_1 | mariadb 21:23:33.54 Welcome to the Bitnami mariadb container database_1 | mariadb 21:23:33.55 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mariadb database_1 | mariadb 21:23:33.57 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mariadb/issues database_1 | mariadb 21:23:33.59 database_1 | mariadb 21:23:33.71 INFO ==> ** Starting MariaDB setup ** database_1 | mariadb 21:23:33.80 INFO ==> Validating settings in MYSQL_*/MARIADB_* env vars database_1 | mariadb 21:23:33.83 WARN ==> You set the environment variable ALLOW_EMPTY_PASSWORD=yes. For safety reasons, do not use this flag in a production environment. database_1 | mariadb 21:23:33.88 INFO ==> Initializing mariadb database database_1 | mariadb 21:23:33.91 DEBUG ==> Ensuring expected directories/files exist database_1 | mkdir: cannot create directory '/bitnami/mariadb/data': Permission denied ```

What worked

Warning: This will destroy your database and data. But follow all the steps, and you don't lose it.

Dump db to local (host) disk, rebuild (like destroy and rebuild), and then load db dump again:

lando drush sql-dump > ../some/path/db.sql
lando destroy -y
lando rebuild -y
lando drush sqlc < ../some/path/db.sql

Sharing here in hopes it helps someone else (or me in a few months down the road).