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

Incompatibility with Laravel 8 schema_dump #68

Open
Synchro opened this issue Mar 5, 2021 · 3 comments
Open

Incompatibility with Laravel 8 schema_dump #68

Synchro opened this issue Mar 5, 2021 · 3 comments

Comments

@Synchro
Copy link
Contributor

Synchro commented Mar 5, 2021

Because this image is based on Alpine, when asked to install MySQL client it actually installs MariaDB's instead. This is often a reasonable substitution, but here it's fatal.

The problem is that Laravel 8's schema dump restore process (which makes CI pipelines run so much faster) builds a command line for the mysql CLI client and uses it to import the schema. MariaDB's CLI client is incompatible with MySQL 8.0 due to lack of support for its default auth mechanism, caching_sha2_password, so unless you also want to have to reconfigure your MySQL server (meaning you can't simply enable it using services: mysql:8.0 in your CI config) you have to disable schema dump and have your tests run slowly.

The command "mysql --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed.
Exit Code: 1(General error)
Working directory: /builds/myapp
Output:
================
Error Output:
================
ERROR 1045 (28000): Plugin caching_sha2_password could not be loaded: /usr/lib/x86_64-linux-gnu/mariadb19/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

It's only the MaraDB client that's the problem. This is tricky to fix for Alpine Linux because it does not have a real MySQL package, even though MySQL includes support for Alpine.

I've been looking through various Laravel/PHP focused images for CI, and nearly all seem to suffer this problem, so I'm hoping one will fix it!

@lorisleiva
Copy link
Owner

lorisleiva commented Mar 21, 2021

Hey 👋

Thanks for raising this.

I'm tempting to support another distribution but I love that this repo is a simple and lightweight DockerFile with the bare minimum for Laravel apps so Alpine feels like the ideal distribution to me.

I'll keep this open until — fingers crossed — a proper MySQL client becomes available for Alpine.

Thanks again. 🙂

@Synchro
Copy link
Contributor Author

Synchro commented Mar 21, 2021

Thanks. I have found a workaround, but it involves downgrading the security of the mysql client connection, so it's not ideal. Add this command arg to the mysql service in your gitlab-ci.yml file:

  services:
    - name: mysql:8.0
      command: [ "--default-authentication-plugin=mysql_native_password" ]

@lorisleiva
Copy link
Owner

Nice, thanks for the update! Let me know if this suddenly becomes achievable without the workaround. 😊

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

2 participants