Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

healthcheck Access denied to database(s) #51

Open
zdenekgebauer opened this issue Mar 3, 2024 · 4 comments
Open

healthcheck Access denied to database(s) #51

zdenekgebauer opened this issue Mar 3, 2024 · 4 comments

Comments

@zdenekgebauer
Copy link

I have a .lando.yml file configured as follows:

name: testlando
recipe: lamp
config:
    webroot: www
    database: mariadb:10.3
proxy:
    appserver:
        - www.testlando.local
    phpmyadmin:
        - phpmyadmin.local
services:
    appserver:
        type: php:8.2
        scanner: false
    database:
        scanner: false
        creds:
            user: testlando
            password:
            database: testlando            
    phpmyadmin:
        type: phpmyadmin
        scanner: false
        hosts:
            - database

Command lando start writes error:

[+] Healthchecking 1/1
 × ERROR 1045 (28000): Access denied for user 'testlando'@'172.23.0.3' (using password: YES)
ERROR ==> ERROR 1045 (28000): Access denied for user 'testlando'@'172.23.0.3' (using password: YES)

However, despite the error, phpMyAdmin can access the database, and the user testlando exists. Error occurs even with a MySQL database.

Shouldn't the healthchecking be skipped with the option scanner:false?

Tested on v3.21.0-beta.7, Windows 10, Docker Desktop version 4.27.2

@zdenekgebauer zdenekgebauer added the bug Something isn't working label Mar 3, 2024
@pirog pirog added the lamp label Mar 3, 2024
@pirog pirog transferred this issue from lando/lando Mar 3, 2024
@pirog pirog added Needs Triage and removed bug Something isn't working lamp labels Mar 3, 2024
@reynoldsalec
Copy link
Member

reynoldsalec commented Mar 4, 2024

@zdenekgebauer could you try doing a lando destroy and then a lando start and see if that works?

The DB creds are set in the app's config when it's first started; if they change after that, it could cause the healthcheck to fail since it may be trying to use the new creds provided in .lando.yml, while the DB is actually using the "old" credentials.

See https://docs.lando.dev/help/switching-dbs.html for more reference.

@zdenekgebauer
Copy link
Author

Error occurs on each start, I did not change DB creds. I tried to do lando destroy, it did not help. Even deleting the volumes in Docker Destop did not help.

@reynoldsalec
Copy link
Member

reynoldsalec commented Mar 4, 2024

So regarding your question; scanner: false doesn't stop the healthchecks. The scanner refers to the proxy scanner, which ascertains the health of the URLs Lando is serving content on: https://docs.lando.dev/core/v3/scanner.html

The healthchecks, in the case of the DB, actually tries to log into the database service from within the container to make sure the service is working: https://docs.lando.dev/core/v3/healthcheck.html

I believe the healthcheck test fails because of the empty password value; when I use a password the healthcheck passes for me. If you want to disable the healthcheck for your service, you can set healthcheck: echo true:

    database:
        healthcheck: echo true
        creds:
            user: testlando
            password:
            database: testlando

Probably the actionable thing on this ticket is to make sure our default healthcheck command can use a blank password.

@zdenekgebauer
Copy link
Author

The problem is really caused by the "password:" setting. If I delete this line, healthcheck passes.

The healthcheck: echo true workaround also works. But I think a more appropriate setting would be e.g. "healthcheck: false", which skips the healthcheck completely, rather than simulating success. Maybe that would speed up the start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants