platformsh / legacy-cli

This is the legacy version of Platform.sh's command-line interface. The new version is at: https://github.com/platformsh/cli
https://docs.platform.sh/administration/cli.html
MIT License
221 stars 120 forks source link

Unable to connect to database locally #1076

Open Boosmith opened 3 years ago

Boosmith commented 3 years ago

I am getting this problem, starting from a blank project and using the Drupal8 Platform.sh template. Could be related to to https://github.com/lando/lando/issues/3111

ERROR 2003 (HY000): Can't connect to MySQL server on 'db' (111 "Connection refused")

and fromlando pull -r database -m web/sites/default/files

Verifying your current project...
Verified project id: lp3e7dpy7tvvw
Verifying master is an active environment...
Verified the master environment is active
Verifying your ssh keys work are deployed to the project...
ERROR 2003 (HY000): Can't connect to MySQL server on 'db' (111 "Connection refused")
Destroying all current tables in database if needed... 
Importing data from the database relationship into the main schema...
ERROR 2003 (HY000): Can't connect to MySQL server on 'db' (111 "Connection refused")

Also

lando pull -r database -m web/sites/default/files               
Verifying you are authenticated against platform.sh...
+------------+--------------------------------------+
| Property   | Value                                |
+------------+--------------------------------------+
| id         | 713c64c0-cb09-476c-816a-5be711cb66e6 |
| first_name | London Borough of                    |
| last_name  | Waltham Forest                       |
| username   | lbwf                                 |
| email      | web.site@walthamforest.gov.uk        |
+------------+--------------------------------------+
Verifying your current project...
Verified project id: lp3e7dpy7tvvw
Verifying master is an active environment...
Verified the master environment is active
Verifying your ssh keys work are deployed to the project...
ERROR 2003 (HY000): Can't connect to MySQL server on 'db' (111 "Connection refused")
Destroying all current tables in database if needed... 
Importing data from the database relationship into the main schema...
ERROR 2003 (HY000): Can't connect to MySQL server on 'db' (111 "Connection refused")

This is from the logs

Andrews-MacBook-Pro-2 :: Sites/platformsh/temp-test1 ‹master*› % lando drush sql-drop 
Attaching to temptest1_db_1
db_1     | 
db_1     | 
db_1     | 
db_1     |                          STARTING UP                            
db_1     | 
db_1     |          ██       █████  ███    ██ ██████   ██████             
db_1     |          ██      ██   ██ ████   ██ ██   ██ ██    ██            
db_1     |          ██      ███████ ██ ██  ██ ██   ██ ██    ██            
db_1     |          ██      ██   ██ ██  ██ ██ ██   ██ ██    ██            
db_1     |          ███████ ██   ██ ██   ████ ██████   ██████             
db_1     | 
db_1     |        The best local development tool in the galaxy!                     
db_1     | 
db_1     | 
db_1     | ===============================================================
db_1     | 
db_1     | 
db_1     | userperms 10:18:15.04 INFO  ==> Symlinked users .gitconfig.
db_1     | userperms 10:18:15.05 INFO  ==> Symlinked users known_hosts
db_1     | userperms 10:18:15.05 INFO  ==> This is a debian container
db_1     | userperms 10:18:15.05 INFO  ==> user-perms.sh kicking off as user uid=0(root) gid=0(root) groups=0(root)
db_1     | userperms 10:18:15.06 DEBUG ==> Lando ENVVARS set at
db_1     | userperms 10:18:15.06 DEBUG ==> 
db_1     | userperms 10:18:15.06 DEBUG ==> ========================================
db_1     | userperms 10:18:15.06 DEBUG ==> LANDO_WEBROOT_USER      : app
db_1     | userperms 10:18:15.06 DEBUG ==> LANDO_WEBROOT_GROUP     : app
db_1     | userperms 10:18:15.06 DEBUG ==> LANDO_WEBROOT_UID       : 1000
db_1     | userperms 10:18:15.07 DEBUG ==> LANDO_WEBROOT_GID       : 1000
db_1     | userperms 10:18:15.07 DEBUG ==> LANDO_HOST_UID          : 501
db_1     | userperms 10:18:15.07 DEBUG ==> LANDO_HOST_GID          : 20
db_1     | userperms 10:18:15.07 DEBUG ==> ========================================
db_1     | userperms 10:18:15.07 DEBUG ==> 
db_1     | userperms 10:18:15.07 INFO  ==> Making sure correct user:group (app:app) exists...
db_1     | userperms 10:18:15.10 INFO  ==> Remapping ownership to handle docker volume sharing...
db_1     | userperms 10:18:15.10 INFO  ==> Resetting app:app from 1000:1000 to 501:20
db_1     | userperms 10:18:15.16 INFO  ==> app:app is now running as uid=501(app) gid=20(dialout) groups=20(dialout),1000(app)!
db_1     | userperms 10:18:15.17 INFO  ==> And here. we. go.
db_1     | userperms 10:18:15.17 INFO  ==> Doing the permission sweep.
db_1     | loadkeys 10:18:15.24 INFO  ==> Scanning /lando/keys for keys...
db_1     | loadkeys 10:18:15.25 INFO  ==> Scanning /var/www/.ssh for keys...
db_1     | loadkeys 10:18:15.26 INFO  ==> Scanning /user/.ssh for keys...
db_1     | loadkeys 10:18:15.27 INFO  ==> Found keys /user/.ssh/acquia_rsa /user/.ssh/acquia_wf /user/.ssh/andy@n17digital.com.rsa /user/.ssh/atellio_rsa /user/.ssh/bitbucket_rsa /user/.ssh/code_enigma_rsa /user/.ssh/config /user/.ssh/config.bak /user/.ssh/git.codeenigma.com_rsa /user/.ssh/github_boosmith /user/.ssh/github_rsa /user/.ssh/id_rsa /user/.ssh/id_rsa.bkp /user/.ssh/id_rsa.pub.bkp /user/.ssh/known_hosts.old /user/.ssh/n17digital_rsa
db_1     | loadkeys 10:18:15.28 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/acquia_rsa...
db_1     | loadkeys 10:18:15.30 DEBUG ==> Checking whether /user/.ssh/acquia_rsa is a private key...
db_1     | loadkeys 10:18:15.31 DEBUG ==> Checking whether /user/.ssh/acquia_rsa is formatted correctly...
db_1     | loadkeys 10:18:15.32 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/acquia_wf...
db_1     | loadkeys 10:18:15.33 DEBUG ==> Checking whether /user/.ssh/acquia_wf is a private key...
db_1     | loadkeys 10:18:15.34 DEBUG ==> Checking whether /user/.ssh/acquia_wf is formatted correctly...
db_1     | loadkeys 10:18:15.35 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/andy@n17digital.com.rsa...
db_1     | loadkeys 10:18:15.36 DEBUG ==> Checking whether /user/.ssh/andy@n17digital.com.rsa is a private key...
db_1     | loadkeys 10:18:15.36 DEBUG ==> Checking whether /user/.ssh/andy@n17digital.com.rsa is formatted correctly...
db_1     | loadkeys 10:18:15.40 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/atellio_rsa...
db_1     | loadkeys 10:18:15.40 DEBUG ==> Checking whether /user/.ssh/atellio_rsa is a private key...
db_1     | loadkeys 10:18:15.41 DEBUG ==> Checking whether /user/.ssh/atellio_rsa is formatted correctly...
db_1     | loadkeys 10:18:15.43 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/bitbucket_rsa...
db_1     | loadkeys 10:18:15.45 DEBUG ==> Checking whether /user/.ssh/bitbucket_rsa is a private key...
db_1     | loadkeys 10:18:15.45 DEBUG ==> Checking whether /user/.ssh/bitbucket_rsa is formatted correctly...
db_1     | loadkeys 10:18:15.47 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/code_enigma_rsa...
db_1     | loadkeys 10:18:15.49 DEBUG ==> Checking whether /user/.ssh/code_enigma_rsa is a private key...
db_1     | loadkeys 10:18:15.50 DEBUG ==> Checking whether /user/.ssh/code_enigma_rsa is formatted correctly...
db_1     | loadkeys 10:18:15.51 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/config...
db_1     | loadkeys 10:18:15.52 DEBUG ==> Checking whether /user/.ssh/config is a private key...
db_1     | loadkeys 10:18:15.53 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/config.bak...
db_1     | loadkeys 10:18:15.56 DEBUG ==> Checking whether /user/.ssh/config.bak is a private key...
db_1     | loadkeys 10:18:15.56 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/git.codeenigma.com_rsa...
db_1     | loadkeys 10:18:15.57 DEBUG ==> Checking whether /user/.ssh/git.codeenigma.com_rsa is a private key...
db_1     | loadkeys 10:18:15.58 DEBUG ==> Checking whether /user/.ssh/git.codeenigma.com_rsa is formatted correctly...
db_1     | loadkeys 10:18:15.60 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/github_boosmith...
db_1     | loadkeys 10:18:15.63 DEBUG ==> Checking whether /user/.ssh/github_boosmith is a private key...
db_1     | loadkeys 10:18:15.64 DEBUG ==> Checking whether /user/.ssh/github_boosmith is formatted correctly...
db_1     | loadkeys 10:18:15.65 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/github_rsa...
db_1     | loadkeys 10:18:15.66 DEBUG ==> Checking whether /user/.ssh/github_rsa is a private key...
db_1     | loadkeys 10:18:15.68 DEBUG ==> Checking whether /user/.ssh/github_rsa is formatted correctly...
db_1     | loadkeys 10:18:15.69 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/id_rsa...
db_1     | loadkeys 10:18:15.71 DEBUG ==> Checking whether /user/.ssh/id_rsa is a private key...
db_1     | loadkeys 10:18:15.72 DEBUG ==> Checking whether /user/.ssh/id_rsa is formatted correctly...
db_1     | loadkeys 10:18:15.73 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/id_rsa.bkp...
db_1     | loadkeys 10:18:15.76 DEBUG ==> Checking whether /user/.ssh/id_rsa.bkp is a private key...
db_1     | loadkeys 10:18:15.77 DEBUG ==> Checking whether /user/.ssh/id_rsa.bkp is formatted correctly...
db_1     | loadkeys 10:18:15.78 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/id_rsa.pub.bkp...
db_1     | loadkeys 10:18:15.80 DEBUG ==> Checking whether /user/.ssh/id_rsa.pub.bkp is a private key...
db_1     | loadkeys 10:18:15.80 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/known_hosts.old...
db_1     | loadkeys 10:18:15.82 DEBUG ==> Checking whether /user/.ssh/known_hosts.old is a private key...
db_1     | loadkeys 10:18:15.82 DEBUG ==> Ensuring permissions and ownership of /user/.ssh/n17digital_rsa...
db_1     | loadkeys 10:18:15.83 DEBUG ==> Checking whether /user/.ssh/n17digital_rsa is a private key...
db_1     | loadkeys 10:18:15.85 DEBUG ==> Checking whether /user/.ssh/n17digital_rsa is formatted correctly...
db_1     | loadkeys 10:18:15.86 INFO  ==> Using the following keys: /user/.ssh/acquia_rsa /user/.ssh/acquia_wf /user/.ssh/andy@n17digital.com.rsa /user/.ssh/bitbucket_rsa /user/.ssh/code_enigma_rsa /user/.ssh/git.codeenigma.com_rsa /user/.ssh/github_boosmith /user/.ssh/github_rsa /user/.ssh/id_rsa /user/.ssh/id_rsa.bkp /user/.ssh/n17digital_rsa
db_1     | platformsh-prepare 10:18:15.88 INFO  ==> Ensuring needed files are unmounted...
db_1     | /dev/vda1 on /etc/hosts type ext4 (rw,relatime)
db_1     | platformsh-prepare 10:18:15.89 INFO  ==> unmounted /etc/hosts
db_1     | /dev/vda1 on /etc/resolv.conf type ext4 (rw,relatime)
db_1     | platformsh-prepare 10:18:15.91 INFO  ==> unmounted /etc/resolv.conf
db_1     | platformsh-prepare 10:18:15.91 INFO  ==> Ensuring needed directories exist...
db_1     | platformsh-prepare 10:18:15.94 DEBUG ==> Waiting for /run/shared/agent.sock to be ready...
db_1     | 2021-08-24 10:18:17,301 platformsh.agent DEBUG Running: /etc/platform/boot
db_1     | 2021-08-24 10:18:18,012 root INFO Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
db_1     | 2021-08-24 10:18:18,038 root INFO Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
db_1     | 2021-08-24 10:18:18,455 platformsh.agent.service INFO Booting container.
db_1     | Generating public/private rsa key pair.
db_1     | Your identification has been saved in /run/rsa_hostkey.
db_1     | Your public key has been saved in /run/rsa_hostkey.pub.
db_1     | The key fingerprint is:
db_1     | SHA256:K7LKfh9jjTp+0kM0dL0SkiM7wmCR1PFBtOJVSARHspE host
db_1     | The key's randomart image is:
db_1     | +---[RSA 2048]----+
db_1     | |.o+=XO.o .       |
db_1     | |.o EB.O o .      |
db_1     | |.o o B + . .     |
db_1     | |  + = o . .      |
db_1     | |   o o .S.       |
db_1     | |      .o .       |
db_1     | |    .o* o        |
db_1     | | .  +=++         |
db_1     | | .+++=..         |
db_1     | +----[SHA256]-----+
db_1     | 2021-08-24 10:18:18,725 platformsh.agent DEBUG Finished: /etc/platform/boot
db_1     | lando 10:18:18.77 INFO  ==> Lando handing off to: exec init
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
db_1     | runsvdir /etc/service: warning: unable to stat /etc/service: file does not exist
xaqrox commented 3 years ago

I'm also having the identical problem on Lando instances of multiple Platform.sh projects.

pirog commented 3 years ago

Here is the relevant lando issue: https://github.com/lando/lando/issues/3111

xaqrox commented 3 years ago

Seems to be resolved after the image reversion mentioned in the Lando issue: https://github.com/lando/lando/issues/3111#issuecomment-905095965