lando / pantheon

The Official Lando Pantheon plugin.
https://docs.lando.dev/pantheon
GNU General Public License v3.0
12 stars 18 forks source link

Cannot pull database with lando pull #153

Closed wisefool closed 6 months ago

wisefool commented 1 year ago

v3.6.4

This is the .lando.yml file after lando init

name: <clientsite>
recipe: pantheon
config:
    framework: wordpress
    site: <clientsite>
    id: xxx-xxxx-xxx-xxx
    database: 'mariadb:10.1'

Running lando pull -d=dev -f=none -c=none starts the db pull and runs into an error repeatedly, even after lando destroy lando start

Pulling your database... This miiiiight take a minute
[warning] This environment is in read-only Git mode. If you want to make changes to the codebase of this site (e.g.
updating modules or plugins), you will need to toggle into read/write SFTP mode first.
ERROR 2013 (HY000) at line 528: Lost connection to MySQL server during query   ]
75.3MiB 0:00:29 [2.56MiB/s] [                         <=>                      ]
[notice] Command: <clientsite>.dev -- wp db export [Exit: 0]
ERROR 2005 (HY000): Unknown MySQL server host 'database' (-2)
0.00 B 0:00:01 [0.00 B/s] [<=>                                                 ]
mysqldump: Got errno 32 on write

Something I've noticed is that if I lando info the local db before I pull the external db port gets a number. After this error lando info shows the external port is changed to 'true'.

Before:

service: 'database',
    urls: [],
    type: 'mariadb',
    healthy: true,
    internal_connection: { host: 'database', port: '3306' },
    external_connection: { host: '127.0.0.1', port: '51608' },
    healthcheck: 'mysql -uroot --silent --execute "SHOW DATABASES;"',
    creds: { database: 'pantheon', password: 'pantheon', user: 'pantheon' },
    config: { database: '/Users/<wisefool>/.lando/config/pantheon/mysql.cnf' },
    version: '10.4',
    meUser: 'www-data',
    hasCerts: false,

After:

service: 'database',
    urls: [],
    type: 'mariadb',
    healthy: true,
    internal_connection: { host: 'database', port: '3306' },
    external_connection: { host: '127.0.0.1', port: true },
    healthcheck: 'mysql -uroot --silent --execute "SHOW DATABASES;"',
    creds: { database: 'pantheon', password: 'pantheon', user: 'pantheon' },
    config: { database: '/Users/<wisefool>/.lando/config/pantheon/mysql.cnf' },
    version: '10.4',
    meUser: 'www-data',
    hasCerts: false,

The external port changing by itself is also blocking my attempts to import a db manually. Every time I try to run an import using Sequel Ace the connection drops and the local site stops running (db connectivity error).

Screen Shot 2022-12-14 at 6 46 00 AM

Using lando info before and after shows the same thing; the external port changes to 'true'.

videohead commented 1 year ago

I experienced the same issue. For information, here's the lando documentation on connecting to a pantheon database : https://docs.lando.dev/pantheon/connecting-database.html

ben-hamelin commented 1 year ago

Maybe related? Have you tried re-authenticating with terminus? https://github.com/lando/pantheon/issues/60

wisefool commented 1 year ago

Maybe related? Have you tried re-authenticating with terminus? #60

Yes, I have with no change.

Regardless the external port changes to true if I do any interaction with the database. It is not just when I attempt to pull from Pantheon.

When I try to import a local .sql file using Sequel Ace or Sequel Pro it does the same thing. And if I try importing using lando db-info I get the following:

$lando db-import <filename>.sql
Error response from daemon: Container efb4eeea8368155bd45fe8125ba3bed249d1a113ffb9b92020fb6147454c456d is not running
Starting <database_container> ... done
Preparing to import /app/<filename>.sql into database 'pantheon' on service 
'database' as user root...

Emptying pantheon... 
NOTE: See the --no-wipe flag to avoid this step!
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/bitnami/mariadb/tmp/mysql.sock' (111)
Importing /app/<filename>.sql...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/bitnami/mariadb/tmp/mysql.sock' (111)
Import failed.
Killing <database_container> ... done
Going to remove <database_container>
Removing <database_container> ... done

Not sure why the error on 2nd line; this was after running lando destroy then lando start, and I can get a broken home page in the browser to appear, so the container is already running.

Sorry it took so long to come back (darn holidays).

xaqrox commented 1 year ago

I'm seeing this as well. In one case I had specified mariadb:10.4 in both pantheon.yml and .lando.yml. This made the site use the bitnami/mariadb image instead of mariadb. Removing the specification (the whole type: mariadb:10.4) from .lando.yml switched back to the mariadb image, which then behaved as expected. I know the bitnami images are bad on ARM, and I'm on an M2 mac, so I assume that has something to do with it...?

My specs:

Lando 3.18.0 Docker 4.16.2 MacOS Ventura 13.4 on M2 Pro chip

ethangeorgi commented 6 months ago

Assuming this issue has been resolved by now, and closing. If the issue persists, please provide more information.