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

Platform.sh recipe, MariaDB 10.5 unavailable when connecting #63

Open
gilzow opened this issue Sep 28, 2021 · 17 comments
Open

Platform.sh recipe, MariaDB 10.5 unavailable when connecting #63

gilzow opened this issue Sep 28, 2021 · 17 comments
Assignees

Comments

@gilzow
Copy link

gilzow commented Sep 28, 2021

Tl;DR - changing database service from mariadb:10.4 to mariadb:10.5 causes the database service to be unaccessible: ERROR 2002 (HY000): Can't connect to MySQL server on 'db' (115). Changing the db service back to 10.4 and rebuilding allows the db service to be available again.

Lando version: 3.3.2
OS version: macOS 11.6

Contents of .lando.yml

name: mariadb-10.5-test
recipe: platformsh

Using the default Platform.sh WordPress composer template.

Contents of /.platform/services.yml:

db:
    type: mariadb:10.5
    disk: 2048

Contents of .platform.app.yml

# This file describes an application. You can have multiple applications
# in the same project.

# The name of this app. Must be unique within a project.
name: app

# The runtime the application uses.
type: "php:7.4"

# Configuration of the build of the application.
build:
    flavor: composer

dependencies:
    php:
        composer/composer: '^2'
        wp-cli/wp-cli: "^2.2.0"

hooks:
    build: |
        set -e
        # Copy manually-provided plugins into the plugins directory.
        # This allows manually-provided and composer-provided plugins to coexist.
        rsync -a plugins/* wordpress/wp-content/plugins/

# The relationships of the application with services or other applications.
# The left-hand side is the name of the relationship as it will be exposed
# to the application in the PLATFORM_RELATIONSHIPS variable. The right-hand
# side is in the form `<service name>:<endpoint name>`.
relationships:
    database: "db:mysql"

# The configuration of app when it is exposed to the web.
web:
    locations:
        "/":
            # The public directory of the app, relative to its root.
            root: "wordpress"
            # The front-controller script to send non-static requests to.
            passthru: "/index.php"
            # Wordpress has multiple roots (wp-admin) so the following is required
            index:
                - "index.php"
            # The number of seconds whitelisted (static) content should be cached.
            expires: 600
            scripts: true
            allow: true
            rules:
                ^/composer\.json:
                    allow: false
                ^/license\.txt$:
                    allow: false
                ^/readme\.html$:
                    allow: false
        "/wp-content/cache":
            root: "wordpress/wp-content/cache"
            scripts: false
            allow: false
        "/wp-content/uploads":
            root: "wordpress/wp-content/uploads"
            scripts: false
            allow: true

# The size of the persistent disk of the application (in MB).
disk: 2048

# The mounts that will be performed when the package is deployed.
mounts:
    "wordpress/wp-content/cache":
        source: local
        source_path: "cache"
    "wordpress/wp-content/uploads":
        source: local
        source_path: "uploads"

Tell us about the command you were running

After bringing up lando (lando start) and attempting to access the database (lando database), causes the error ERROR 2002 (HY000): Can't connect to MySQL server on 'db' (115). Changing the version back to 10.4 and rebuilding (via lando rebuild) allows the db service to be available again.

Info from lando info:

{ service: 'db',
    urls: [],
    type: 'platformsh-mariadb',
    healthy: true,
    creds:
     [ { internal_hostname: 'database.internal', path: 'main', port: 3306, user: 'user' } ],
    internal_connection: { host: 'db', port: '3306' },
    external_connection: { host: '127.0.0.1', port: '51365' },
    config: {},
    version: '10.5',
    meUser: 'app',
    hasCerts: false,
    hostnames: [ 'db.mariadb105test.internal' ] } 

Similar if not identical issue to #61

@MultcoJeremy
Copy link

I'm seeing the same issue on Ubuntu 20.04 so it's not just a Mac centric issue.

@rtfm-47 rtfm-47 transferred this issue from lando/lando Oct 26, 2021
@pirog pirog self-assigned this Nov 15, 2021
@reynoldsalec reynoldsalec assigned reynoldsalec and unassigned pirog Nov 18, 2021
@reynoldsalec
Copy link
Member

Sounds like the P.sh team thinks this container should be working; I'll test it out and report back.

@MultcoJeremy
Copy link

I just tried with Lando 3.5.1 with one of our existing sites using mariadb 10.5 and got the same error as before.

@reynoldsalec
Copy link
Member

reynoldsalec commented Nov 18, 2021

Yeah, tested using the examples running edge Lando from source (as well as edge P.sh plugin) and no joy.

  1. lando start

  2. Confirm we're running the right image:
    docker ps --filter label=com.docker.compose.project=landoplatformshmariadb105 | grep docker.registry.platform.sh/mariadb-10.5 | grep landoplatformshmariadb105_mariadb_1

  3. Try communicating with the service:
    lando mariadb main -e "show tables;"

Returns: ERROR 2002 (HY000): Can't connect to MySQL server on 'mariadb' (115)

When I run lando logs -s mariadb I see a bunch of these errors repeated:

mariadb_1  | runsv mysql-cluster: fatal: unable to lock supervise/lock: temporary failure
mariadb_1  | runsv idmapd: fatal: unable to lock supervise/lock: temporary failure
mariadb_1  | runsv mysql-standalone: fatal: unable to lock supervise/lock: temporary failure

@reynoldsalec
Copy link
Member

...updating that I tried this using the example that Jan was using, still same error.

@reynoldsalec
Copy link
Member

We want to make sure this isn't an M1 Mac specific problem, so @labboy0276 is going to try on his Linux machine. Please let us know your steps/errors you receive in detail!

@labboy0276
Copy link
Contributor

@reynoldsalec I am not seeing the same on Ubuntu (PopOS) 20.04. Everything seems to work ok:

I used your example here: https://github.com/reynoldsalec/platformsh-63

Did a lando start, all started up ok:

john@tandem:~/lando/platformsh-63 (main)$ lando start
Let's get this party started! Starting app mariadb-test...
Recreating landoproxyhyperion5000gandalfedition_proxy_1 ... done
Creating network "mariadbtest_default" with the default driver
Creating volume "mariadbtest_data_php" with default driver
Creating volume "mariadbtest_home_php" with default driver
Creating volume "mariadbtest_data_mariadb" with default driver
Creating volume "mariadbtest_home_mariadb" with default driver
Creating mariadbtest_php_1 ... done
Platform.sh CLI installer

Environment check
  [*] The "json" PHP extension is installed.
  [*] The "phar" PHP extension is installed.
  [*] Git is installed.
  [*] The "openssl" PHP extension is installed.
  [*] The "pcre" PHP extension is installed.
  [*] One or both of the "mbstring" or "iconv" PHP extensions is installed.
  [*] The "curl" PHP extension is installed.
  [*] The "pcntl" and "posix" extensions are installed.
  [*] The "allow_url_fopen" setting is on.
  [*] The "apc.enable_cli" setting is off.

Download
  Finding the latest version... done
  Downloading version 3.70.0... done
  Checking file integrity... done
  Checking that the file is a valid Phar... done

Install
  Making the Phar executable... done
  Moving the Phar to your home directory... done
  Executable location: /var/www/.platformsh/bin/platform

Running self:install command...

Copying resource files... done

Setting up autocompletion... failed
    Cannot generate hook for unknown shell type 'dash'. Available hooks
    are: bash, zsh

Selected shell configuration file: ~/.bashrc

Do you want to create the file automatically? [Y/n] y

Configuration file created successfully: ~/.bashrc

To use the Platform.sh CLI, run:
    platform
No mounts found on host: localhost
The destination exists: /app/.platform/local/lando. Overwrite? [Y/n] y
Building application php (runtime type: php:7.4)
Running post-build hooks
Creating a .gitignore file

Build complete for application php
Web root: /app/.platform/local/lando

Cleaning up...
Killing mariadbtest_php_1 ... 
Killing mariadbtest_php_1 ... done
Pulling mariadb (docker.registry.platform.sh/mariadb-10.5:)...
latest: Pulling from mariadb-10.5
18e68fe742c4: Pull complete
Digest: sha256:3fd48cda713c116543ed16a0057fafe44fdc65a7452b418009025dd8bdb196cd
Status: Downloaded newer image for docker.registry.platform.sh/mariadb-10.5:latest
Creating mariadbtest_mariadb_1 ... done
Starting mariadbtest_php_1     ... done
Opening platform.sh containers... this may take a bit...
Scanning to determine which services are ready... Please standby...

   ___                      __        __        __     __        ______
  / _ )___  ___  __ _  ___ / /  ___ _/ /_____ _/ /__ _/ /_____ _/ / / /
 / _  / _ \/ _ \/  ' \(_-</ _ \/ _ `/  '_/ _ `/ / _ `/  '_/ _ `/_/_/_/ 
/____/\___/\___/_/_/_/___/_//_/\_,_/_/\_\\_,_/_/\_,_/_/\_\\_,_(_|_|_)  
                                                                       

Your app has started up correctly.
Here are some vitals:

 NAME      mariadb-test                   
 LOCATION  /home/john/lando/platformsh-63 
 SERVICES  php, mariadb                   
 PHP URLS  http://localhost:49199         

john@tandem:~/lando/platformsh-63 (main)$

Then ran the DB commands:

john@tandem:~/lando/platformsh-63 (main)$ lando mariadb main -e "show tables;"
john@tandem:~/lando/platformsh-63 (main)$ lando mariadb main
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 25
Server version: 10.5.13-MariaDB-1:10.5.13+maria~buster mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [main]> show tables;
Empty set (0.001 sec)

@labboy0276 labboy0276 assigned reynoldsalec and unassigned labboy0276 Dec 6, 2021
@reynoldsalec
Copy link
Member

Hmm, booting up the example on my Intel Mac I seem to get the same "Can't connect" error. Seeing if @gilzow or Chad might be able to test this out on their machines to see if there is an OS-specificity.

@gilzow
Copy link
Author

gilzow commented Dec 6, 2021

I too am on macOS (11.6.1). Cloned the same repo: https://github.com/reynoldsalec/platformsh-63
lando start completes successfully, and looks nearly identical to @labboy0276 's output above.
However, attempting to run lando mariadb results in an error:

❯ lando mariadb
ERROR 2002 (HY000): Can't connect to MySQL server on 'mariadb' (115)

Output from lando info :

❯ lando info
[ { service: 'php',
    urls: [ 'http://localhost:61246' ],
    type: 'platformsh-php',
    healthy: true,
    config: {},
    version: '7.4',
    meUser: 'web',
    hasCerts: true,
    hostnames: [ 'php.mariadbtest.internal' ] },
  { service: 'mariadb',
    urls: [],
    type: 'platformsh-mariadb',
    healthy: true,
    creds:
     [ { internal_hostname: 'mariadb.internal', path: 'main', port: 3306, user: 'user' } ],
    internal_connection: { host: 'mariadb', port: '3306' },
    external_connection: { host: '127.0.0.1', port: '61247' },
    config: {},
    version: '10.5',
    meUser: 'app',
    hasCerts: false,
    hostnames: [ 'mariadb.mariadbtest.internal' ] } ]

@gilzow
Copy link
Author

gilzow commented Dec 6, 2021

In the same test repo, if I change the version of mariadb to 10.4 and lando rebuild -y after it comes up, I still can not access mariadb (same can't connect error). However, doing lando stop && lando destroy -y && lando start allows me to connect to the 10.4 version.

@MultcoJeremy
Copy link

Using my own platform.sh sites and a copy of the platformsh-63 repo, no joy on Ubuntu 20.04. Same failure with being unable to connect to mariadb 10.5. ERROR 2003 (HY000): Can't connect to MySQL server on 'db' (111 "Connection refused") to be specific.

@georgatgalaniprojects
Copy link

Same problem here. But even switching back to 10.4 and doing lando destroy && lando rebuild && land start did not fix it.

I am on an 2018 Intel Mac with Monterey.

Lando Version 3.6.2

@gilzow
Copy link
Author

gilzow commented Feb 8, 2022

even switching back to 10.4 and doing lando destroy && lando rebuild && land start

That's interesting. It should get you back to a stable, working set-up. If you're completely stuck, and in an unworking state, you might try

> lando stop && lando destroy -y && lando poweroff
<snip>
> docker system prune -a
> lando start

@ChexWarrior
Copy link

Running into the same issue with my Mac (OS: Monterey Intel), downgrading mariadb to 10.4 fixed the issue and I was able to build my site. With the same codebase I can build on my desktop at home (Ubuntu 20.04) with no issue and mariadb 10.5

@philltran
Copy link

Also confirming this is still an issue on intel Mac 11.6.5, lando v3.6.4 running platformsh recipe with mariadb 10.5

Normally going back to mariadb 10.4 worked. But, today it did not. Team members running ubuntu say the 10.5 service works for them.

Willing to help track down this issue or test a solution

@philltran
Copy link

I was hoping this was related to issue #163 , but I still had the db issues using mariadb 10.5 with the stable tag. downgrading to 10.4 along with wiping ~/.lando/composer/projectname, ~/.lando/config/projectname and ~/.lando/cache/projectname got me working again.

@pjoulot
Copy link

pjoulot commented Aug 31, 2022

I created an similar issue in 2020 (#44)

I confirm that I still have this issue with Ubuntu.

On the other hand, I have the complete opposite solution that @philltran gave . My project was using mariadb 10.4, after updating the .platform/services.yaml to upgrade to 10.5, the problem was gone. For Ubuntu 20

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

No branches or pull requests

10 participants